quickonline
Advanced tools
Comparing version 1.0.6 to 1.0.7
module.exports = { | ||
host: require('./src/host'), | ||
bot: require('./src/bot') | ||
host: require('./src/host.js'), | ||
bot: require('./src/bot.js') | ||
} |
{ | ||
"name": "quickonline", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Simple package makes quick.db, online data (it's simple)!", | ||
@@ -17,4 +17,4 @@ "main": "index.js", | ||
"dependencies": { | ||
"superagent": "^6.1.0" | ||
} | ||
} |
243
src/bot.js
const superagent = require("superagent"); | ||
class bot{ | ||
constructor(data) { | ||
if(!data) throw new Error('Missing Server URL, Need Help? http://discord.gg/devs') | ||
this.url = data | ||
function moduleAvailable(name) { // ( i don't own this pog to check if package exist or no forked it from afriend ) | ||
try { | ||
require.resolve(name); | ||
return true; | ||
} catch(e){} | ||
return false; | ||
}; | ||
if(!moduleAvailable('superagent')) throw new Error('Missing superagent package\n need help? join http://discord.gg/devs\nnpm i superagent') | ||
} | ||
/** | ||
* sets avalue to spefic key on the database | ||
* @param key | ||
* @param valuekey | ||
* @example dbo.set('wow', 'hi') | ||
* null > hi | ||
*/ | ||
async set(key, valuekey) { | ||
if(!key) throw new Error('[Key] Missing Data Key\n need help? join http://discord.gg/devs') | ||
if(!valuekey) throw new Error('[Value] Missing data\n need help? join http://discord.gg/devs') | ||
let data = superagent.get(`${this.url}/quickonline/set?set=${key}&value=${valuekey}`) | ||
if(!data) throw new Error('Invaild URL\n need help? http://discord.gg/devs ') | ||
return data; | ||
} | ||
class bot { | ||
constructor(data) { | ||
if (!data) throw new Error('Missing default Array for example go to quickonline.js.org , Need Help? http://discord.gg/devs') | ||
if (!data.url) throw new Error("Missing Database url need help? http://discord.gg/devs") | ||
if (!data.username) throw new Error("Missing Database Username Need help? http://discord.gg/devs") | ||
if (!data.password) throw new Error("Missing Database Password need help? http://discord.gg/devs") | ||
this.url = data | ||
this.username = data.username | ||
this.password = data.password | ||
} | ||
/** | ||
* sets avalue to spefic key on the database | ||
* @param key | ||
* @param valuekey | ||
* @example dbo.set('wow', 'hi') | ||
* null > hi | ||
*/ | ||
async set(key, valuekey) { | ||
if (!key) throw new Error('[Key] Missing Data Key\n need help? join http://discord.gg/devs') | ||
if (!valuekey) throw new Error('[Value] Missing data\n need help? join http://discord.gg/devs') | ||
let data = superagent.get(`${this.url}/quickonline/set?set=${key}&value=${valuekey}&username=${this.username}&password=${this.password}`) | ||
if (!data) throw new Error('Invaild URL\n need help? http://discord.gg/devs ') | ||
if ((await data).body === "invaild username") throw new Error("Invaild Username , need help? http://discord.gg/devs") | ||
if ((await data).body === "invaild password") throw new Error("Invaild Password , need help? http://discord.gg/devs") | ||
/** | ||
* Gets adata from the database | ||
* @param key | ||
* @example dbo.get('wow') | ||
* hi | ||
*/ | ||
async get(key) { | ||
let data = superagent.get(`${this.url}/quickonline/get?key=${key || null}`) | ||
if(!data) throw new Error('Invaild URL\n need help? http://discord.gg/devs ') | ||
return (await data).body; | ||
} | ||
/** | ||
* delete adata from the database | ||
* @param key | ||
* @example dbo.delete('omg') | ||
* hi > null | ||
*/ | ||
async delete(key) { | ||
let data = superagent.get(`${this.url}/quickonline/delete?key=${key || null}`) | ||
if(!data) throw new Error('Invaild URL\n need help? http://discord.gg/devs ') | ||
return (await data).body; | ||
} | ||
/** | ||
* add more value to key on the database | ||
* @param key | ||
* @param value | ||
* @example dbo.add('math', 500) | ||
* null > 500 | ||
* @example dbo.add('math', 290) | ||
* 500 > 790 | ||
*/ | ||
async add(key, value) { | ||
if(isNaN(value)) throw new Error('Value must be only numbers on dbo.add\n need help? http://discord.gg/devs') | ||
let data = superagent.get(`${this.url}/quickonline/add?add=${key}&value=${value}`) | ||
if(!data) throw new Error('Invaild URL\n need help? http://discord.gg/devs ') | ||
if((await data).body === "string") throw new Error("Key is string, not anumber") | ||
return true; | ||
} | ||
/** | ||
* subtract avalue from akey on database | ||
* @param key | ||
* @param value | ||
* @example dbo.subtract('math', 30) | ||
* 790 > 760 | ||
*/ | ||
async subtract(key, value){ | ||
if(!key) throw new Error("Missing key need help with keys ? join \n http://discord.gg/devs") | ||
if(!value )throw new Error("Missing value need help with values ? join \n http://discord.gg/devs") | ||
if(isNaN(value)) throw new Error('Value must be only numbers on dbo.subtract\n need help? http://discord.gg/devs') | ||
let data = superagent.get(`${this.url}/quickonline/subtract?remove=${key}&value=${value}`) | ||
if(!data) throw new Error('Invaild URL\n need help? http://discord.gg/devs ') | ||
if((await data).body === "string") throw new Error("Value of the key is string not anumber need help with values?\n http://discord.gg/devs") | ||
return true; | ||
} | ||
return data; | ||
} | ||
/** | ||
* Gets adata from the database | ||
* @param key | ||
* @example dbo.get('wow') | ||
* hi | ||
*/ | ||
async get(key) { | ||
let data = superagent.get(`${this.url}/quickonline/get?key=${key || null}&username=${this.username}&password=${this.password}`) | ||
if (!data) throw new Error('Invaild URL\n need help? http://discord.gg/devs ') | ||
if ((await data).body === "invaild username") throw new Error("Invaild Username , need help? http://discord.gg/devs") | ||
if ((await data).body === "invaild password") throw new Error("Invaild Password , need help? http://discord.gg/devs") | ||
/** | ||
* fetch key from the database | ||
* @param key | ||
* @example dbo.fetch('omg') | ||
* { key: "omg", data: null } | ||
*/ | ||
async fetch(key) { | ||
if(!key) throw new Error("Missing data key need help?\n join http://discord.gg/devs") | ||
let data = superagent.get(`${this.url}/quickonline/fetch?key=${key}`) | ||
if(!data) throw new Error('Invaild URL\n need help? http://discord.gg/devs ') | ||
return (await data).body | ||
return (await data).body; | ||
} | ||
/** | ||
* delete adata from the database | ||
* @param key | ||
* @example dbo.delete('omg') | ||
* hi > null | ||
*/ | ||
async delete(key) { | ||
let data = superagent.get(`${this.url}/quickonline/delete?key=${key || null}&username=${this.username}&password=${this.password}`) | ||
if (!data) throw new Error('Invaild URL\n need help? http://discord.gg/devs ') | ||
if ((await data).body === "invaild username") throw new Error("Invaild Username , need help? http://discord.gg/devs") | ||
if ((await data).body === "invaild password") throw new Error("Invaild Password , need help? http://discord.gg/devs") | ||
return (await data).body; | ||
} | ||
/** | ||
* add more value to key on the database | ||
* @param key | ||
* @param value | ||
* @example dbo.add('math', 500) | ||
* null > 500 | ||
* @example dbo.add('math', 290) | ||
* 500 > 790 | ||
*/ | ||
async add(key, value) { | ||
if (isNaN(value)) throw new Error('Value must be only numbers on dbo.add\n need help? http://discord.gg/devs') | ||
let data = superagent.get(`${this.url}/quickonline/add?add=${key}&value=${value}&username=${this.username}&password=${this.password}`) | ||
if (!data) throw new Error('Invaild URL\n need help? http://discord.gg/devs ') | ||
if ((await data).body === "invaild username") throw new Error("Invaild Username , need help? http://discord.gg/devs") | ||
if ((await data).body === "invaild password") throw new Error("Invaild Password , need help? http://discord.gg/devs") | ||
if ((await data).body === "string") throw new Error("Key is string, not anumber") | ||
return true; | ||
} | ||
/** | ||
* subtract avalue from akey on database | ||
* @param key | ||
* @param value | ||
* @example dbo.subtract('math', 30) | ||
* 790 > 760 | ||
*/ | ||
async subtract(key, value) { | ||
if (!key) throw new Error("Missing key need help with keys ? join \n http://discord.gg/devs") | ||
if (!value) throw new Error("Missing value need help with values ? join \n http://discord.gg/devs") | ||
if (isNaN(value)) throw new Error('Value must be only numbers on dbo.subtract\n need help? http://discord.gg/devs') | ||
let data = superagent.get(`${this.url}/quickonline/subtract?remove=${key}&value=${value}&username=${this.username}&password=${this.password}`) | ||
if (!data) throw new Error('Invaild URL\n need help? http://discord.gg/devs ') | ||
if ((await data).body === "invaild username") throw new Error("Invaild Username , need help? http://discord.gg/devs") | ||
if ((await data).body === "invaild password") throw new Error("Invaild Password , need help? http://discord.gg/devs") | ||
if ((await data).body === "string") throw new Error("Value of the key is string not anumber need help with values?\n http://discord.gg/devs") | ||
return true; | ||
} | ||
/** | ||
* fetch key from the database | ||
* @param key | ||
* @example dbo.fetch('omg') | ||
* { key: "omg", data: null } | ||
*/ | ||
async fetch(key) { | ||
if (!key) throw new Error("Missing data key need help?\n join http://discord.gg/devs") | ||
let data = superagent.get(`${this.url}/quickonline/fetch?key=${key}&username=${this.username}&password=${this.password}`) | ||
if (!data) throw new Error('Invaild URL\n need help? http://discord.gg/devs ') | ||
if ((await data).body === "invaild username") throw new Error("Invaild Username , need help? http://discord.gg/devs") | ||
if ((await data).body === "invaild password") throw new Error("Invaild Password , need help? http://discord.gg/devs") | ||
return (await data).body | ||
} | ||
/** | ||
* @example | ||
* check if the url working or no | ||
*/ | ||
async check() { | ||
let data = superagent.get(`${this.url}/quickonline/check&username=${this.username}&password=${this.password}`) | ||
if (!data) throw new Error('Invaild URL\n need help? http://discord.gg/devs ') | ||
if ((await data).body === "invaild username") throw new Error("Invaild Username , need help? http://discord.gg/devs") | ||
if ((await data).body === "invaild password") throw new Error("Invaild Password , need help? http://discord.gg/devs") | ||
return (await data).body | ||
} | ||
/** | ||
* fetch all the data from the database | ||
* @param | ||
* @example dbo.all() | ||
*/ | ||
async all() { | ||
let data = superagent.get(`${this.url}/quickonline/all&username=${this.username}&password=${this.password}`) | ||
if (!data) throw new Error('Invaild URL\n need help? http://discord.gg/devs ') | ||
if ((await data).body === "invaild username") throw new Error("Invaild Username , need help? http://discord.gg/devs") | ||
if ((await data).body === "invaild password") throw new Error("Invaild Password , need help? http://discord.gg/devs") | ||
return data; | ||
} | ||
} | ||
/** | ||
* @example | ||
* check if the url working or no | ||
*/ | ||
async check() { | ||
let data = superagent.get(`${this.url}/quickonline/check`) | ||
if(!data) throw new Error('Invaild URL\n need help? http://discord.gg/devs ') | ||
return (await data).body | ||
} | ||
/** | ||
* fetch all the data from the database | ||
* @param | ||
* @example dbo.all() | ||
*/ | ||
async all() { | ||
let data = superagent.get(`${this.url}/quickonline/all`) | ||
if(!data) throw new Error('Invaild URL\n need help? http://discord.gg/devs ') | ||
return data; | ||
} | ||
} | ||
module.exports = bot |
271
src/host.js
class host { | ||
constructor(data) { | ||
if(!data) return; | ||
if(!data) data = 8080 | ||
this.port = data | ||
// ( i don't own this pog to check if package exist or no forked it from afriend ) | ||
} | ||
async start() { | ||
function moduleAvailable(name) { | ||
try { | ||
require.resolve(name); | ||
return true; | ||
} catch(e){} | ||
return false; | ||
}; | ||
if(!moduleAvailable("quick.db")) throw new Error('Missing quick.db package\n need help? join http://discord.gg/devs\nnpm i quick.db') | ||
if(!moduleAvailable("express")) throw new Error('Missing express package\n need help? join http://discord.gg/devs\nnpm i express') | ||
const express = require('express') | ||
const db = require('quick.db') | ||
const app = new express() | ||
constructor(data) { | ||
if (!data) throw new Error("Missing data array need help? http://discord.gg/devs"); | ||
if (!data.port) data.port = 8080 | ||
if (!data.username) throw new Error("Missing Username,, need help? join http://discord.gg/devs") | ||
if (!data.password) throw new Error("Missing Password, need help? join http://discord.gg/devs") | ||
this.port = data.port | ||
this.username = data.username | ||
this.password = data.password | ||
} | ||
async start() { | ||
const express = require('express') | ||
const db = require('quick.db') | ||
const app = new express() | ||
app.listen(this.port, () => { | ||
console.log(`[Database] started.`) | ||
}) | ||
app.get('/quickonline/set', async(req,res) => { | ||
let Key = req.query.set | ||
let value = req.query.value | ||
if(! value && Key) return res.send(false) | ||
db.set(`${Key}`, value) | ||
let data = { | ||
sucsses: true, | ||
key: Key | ||
} | ||
await res.json(data) | ||
}) | ||
app.get('/quickonline/get', async(req,res)=>{ | ||
let key = req.query.key | ||
if(!key) return res.send(false) | ||
let data = db.get(key) | ||
await res.json(`${data || null}`) | ||
}) | ||
app.get('/quickonline/delete', async(req,res)=>{ | ||
let key = req.query.key | ||
if(!key) return res.send(false) | ||
app.listen(this.port, () => { | ||
console.log(`[Database] started.`) | ||
}) | ||
db.delete(`${key}`) | ||
return res.send('Deleted..') | ||
}) | ||
app.get('/quickonline/all', async(req,res)=>{ | ||
let data = db.all() | ||
return res.send(data) | ||
}) | ||
app.get('/quickonline/add', async(req,res)=>{ | ||
let add = req.query.add | ||
if(!add) return res.send(false) | ||
let value = req.query.value | ||
if(!value) return res.send(false) | ||
app.get('/quickonline/set', async(req, res) => { | ||
let Key = req.query.set | ||
let value = req.query.value | ||
let username = req.query.username | ||
let password = req.query.password | ||
// so when i use ! nothing happens so i had to do this sorry js | ||
if (username === this.username) {} else { | ||
return res.send(`invaild username`) | ||
} | ||
if(isNaN(value)) return res.json("string") | ||
let data = db.get(add) | ||
if(!data) { | ||
db.add(add, value) | ||
return res.json(true) | ||
if (password === this.password) {} else { | ||
return res.send(`invaild password`) | ||
} | ||
if (!value && Key) return res.send(false) | ||
db.set(`${Key}`, value) | ||
let data = { | ||
sucsses: true | ||
, key: Key | ||
} | ||
await res.json(data) | ||
}) | ||
app.get('/quickonline/get', async(req, res) => { | ||
let key = req.query.key | ||
if (!key) return res.send(false) | ||
let username = req.query.username | ||
let password = req.query.password | ||
if (username === this.username) {} else { | ||
return res.send(`invaild username`) | ||
} | ||
if (password === this.password) {} else { | ||
return res.send(`invaild password`) | ||
} | ||
let data = db.get(key) | ||
await res.json(`${data || null}`) | ||
}) | ||
app.get('/quickonline/delete', async(req, res) => { | ||
let key = req.query.key | ||
let username = req.query.username | ||
let password = req.query.password | ||
if (username === this.username) {} else { | ||
return res.send(`invaild username`) | ||
} | ||
if (password === this.password) {} else { | ||
return res.send(`invaild password`) | ||
} | ||
if (!key) return res.send(false) | ||
db.delete(`${key}`) | ||
return res.send('Deleted..') | ||
}) | ||
app.get('/quickonline/all', async(req, res) => { | ||
let data = db.all() | ||
let username = req.query.username | ||
let password = req.query.password | ||
if (username === this.username) {} else { | ||
return res.send(`invaild password`) | ||
} | ||
if (password === this.password) {} else { | ||
return res.send(`invaild password`) | ||
} | ||
return res.send(data) | ||
}) | ||
app.get('/quickonline/add', async(req, res) => { | ||
let add = req.query.add | ||
if (!add) return res.send(false) | ||
let value = req.query.value | ||
if (!value) return res.send(false) | ||
if (isNaN(value)) return res.json("string") | ||
let username = req.query.username | ||
let password = req.query.password | ||
if (username === this.username) {} else { | ||
return res.send(`invaild username`) | ||
} | ||
if (password === this.password) {} else { | ||
return res.send(`invaild password`) | ||
} | ||
let data = db.get(add) | ||
if (!data) { | ||
db.add(add, value) | ||
return res.json(true) | ||
} | ||
if (data) { | ||
if (isNaN(data)) return res.json("string") | ||
db.add(add, value) | ||
return res.json(true) | ||
} | ||
}) | ||
app.get('/quickonline/subtract', async(req, res) => { | ||
let remove = req.query.remove | ||
if (!remove) return res.send(false) | ||
let value = req.query.value | ||
if (!value) return res.send(false) | ||
if (isNaN(value)) return res.json("string") | ||
let username = req.query.username | ||
let password = req.query.password | ||
if (username === this.username) {} else { | ||
return res.send(`invaild username`) | ||
} | ||
if (password === this.password) {} else { | ||
return res.send(`invaild password`) | ||
} | ||
let data = db.get(remove) | ||
if (!data) { | ||
db.subtract(remove, value) | ||
return res.json(true) | ||
} // ik i could just use } else { but doing this is more fun >:) | ||
if (data) { | ||
if (isNaN(data)) return res.json("string") | ||
db.subtract(remove, value) | ||
return res.json(true) | ||
} | ||
}) | ||
app.get('/quickonline/fetch', async(req, res) => { | ||
let key = req.query.key | ||
if (!key) return res.json(false) | ||
let username = req.query.username | ||
let password = req.query.password | ||
if (username === this.username) {} else { | ||
return res.send(`invaild username`) | ||
} | ||
if (password === this.password) {} else { | ||
return res.send(`invaild password`) | ||
} | ||
let data = db.get(key) | ||
let pog = { | ||
key: key | ||
, data: data | ||
} | ||
return await res.json(pog) | ||
}) | ||
app.get('/quickonline/check', async(req, res) => { | ||
let username = req.query.username | ||
let password = req.query.password | ||
if (username === this.username) {} else { | ||
return res.send(`invaild username`) | ||
} | ||
if (password === this.password) {} else { | ||
return res.send(`invaild password`) | ||
} | ||
return await res.json("Alive") | ||
}) | ||
} | ||
if(data) { | ||
if(isNaN(data)) return res.json("string") | ||
db.add(add , value) | ||
return res.json(true) | ||
} | ||
}) | ||
app.get('/quickonline/subtract', async(req,res)=>{ | ||
let remove = req.query.remove | ||
if(!remove) return res.send(false) | ||
let value = req.query.value | ||
if(!value) return res.send(false) | ||
if(isNaN(value)) return res.json("string") | ||
let data = db.get(remove) | ||
if(!data) { | ||
db.subtract(remove, value) | ||
return res.json(true) | ||
}// ik i could just use } else { but doing this is more fun >:) | ||
if(data) { | ||
if(isNaN(data)) return res.json("string") | ||
db.subtract(remove, value) | ||
return res.json(true) | ||
} | ||
}) | ||
app.get('/quickonline/fetch', async(req,res)=> { | ||
let key = req.query.key | ||
if(!key) return res.json(false) | ||
let data = db.get(key) | ||
let pog = { | ||
key: key, | ||
data: data | ||
} | ||
return await res.json(pog) | ||
}) | ||
app.get('/quickonline/check', async (req,res)=>{ | ||
return await res.json("Alive") | ||
}) | ||
} | ||
} | ||
module.exports = host; |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
14768
0
288
1
0
- Removedsuperagent@^6.1.0
- Removedasynckit@0.4.0(transitive)
- Removedcall-bind-apply-helpers@1.0.2(transitive)
- Removedcall-bound@1.0.3(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removedcomponent-emitter@1.3.1(transitive)
- Removedcookiejar@2.1.4(transitive)
- Removeddebug@4.4.0(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removeddunder-proto@1.0.1(transitive)
- Removedes-define-property@1.0.1(transitive)
- Removedes-errors@1.3.0(transitive)
- Removedes-object-atoms@1.1.1(transitive)
- Removedes-set-tostringtag@2.1.0(transitive)
- Removedfast-safe-stringify@2.1.1(transitive)
- Removedform-data@3.0.3(transitive)
- Removedformidable@1.2.6(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedget-intrinsic@1.2.7(transitive)
- Removedget-proto@1.0.1(transitive)
- Removedgopd@1.2.0(transitive)
- Removedhas-symbols@1.1.0(transitive)
- Removedhas-tostringtag@1.0.2(transitive)
- Removedhasown@2.0.2(transitive)
- Removedinherits@2.0.4(transitive)
- Removedmath-intrinsics@1.1.0(transitive)
- Removedmethods@1.1.2(transitive)
- Removedmime@2.6.0(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removedms@2.1.3(transitive)
- Removedobject-inspect@1.13.4(transitive)
- Removedqs@6.14.0(transitive)
- Removedreadable-stream@3.6.2(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsemver@7.7.1(transitive)
- Removedside-channel@1.1.0(transitive)
- Removedside-channel-list@1.0.0(transitive)
- Removedside-channel-map@1.0.1(transitive)
- Removedside-channel-weakmap@1.0.2(transitive)
- Removedstring_decoder@1.3.0(transitive)
- Removedsuperagent@6.1.0(transitive)
- Removedutil-deprecate@1.0.2(transitive)