@nka212bg/backend-utils 0.1.33 → 0.1.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -0
- package/db/dbUtils.js +0 -0
- package/db/mysql2.js +0 -0
- package/db/sqlite3.js +0 -0
- package/index.js +0 -0
- package/location/GeoLite2-City.mmdb +0 -0
- package/location/VPNs-master.zip +0 -0
- package/location/index.js +0 -0
- package/location/localelib.js +0 -0
- package/mailSmsTools/defaultTemplate.html +0 -0
- package/mailSmsTools/index.js +0 -0
- package/markdown/index.js +0 -0
- package/markdown/markdown.js +0 -0
- package/misc.js +0 -0
- package/os.js +0 -0
- package/package.json +2 -2
- package/session.js +6 -3
- package/socket.js +0 -0
- package/stripe.js +3 -5
- package/systemLog.js +0 -0
package/README.md
CHANGED
|
File without changes
|
package/db/dbUtils.js
CHANGED
|
File without changes
|
package/db/mysql2.js
CHANGED
|
File without changes
|
package/db/sqlite3.js
CHANGED
|
File without changes
|
package/index.js
CHANGED
|
File without changes
|
|
File without changes
|
package/location/VPNs-master.zip
CHANGED
|
File without changes
|
package/location/index.js
CHANGED
|
File without changes
|
package/location/localelib.js
CHANGED
|
File without changes
|
|
File without changes
|
package/mailSmsTools/index.js
CHANGED
|
File without changes
|
package/markdown/index.js
CHANGED
|
File without changes
|
package/markdown/markdown.js
CHANGED
|
File without changes
|
package/misc.js
CHANGED
|
File without changes
|
package/os.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nka212bg/backend-utils",
|
|
3
3
|
"author": "nka212bg",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.35",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@maxmind/geoip2-node": "^5.0.0",
|
|
@@ -15,4 +15,4 @@
|
|
|
15
15
|
"sharp": "^0.33.5",
|
|
16
16
|
"ws": "^7.3.0"
|
|
17
17
|
}
|
|
18
|
-
}
|
|
18
|
+
}
|
package/session.js
CHANGED
|
@@ -46,7 +46,8 @@ exports.serverState = new Proxy(
|
|
|
46
46
|
// const all = serverState.getAll; // => whole STATE map
|
|
47
47
|
// const alices = serverState["name=alice"]; // => all entries where name == "alice", each with its token
|
|
48
48
|
get(_, token) {
|
|
49
|
-
if (
|
|
49
|
+
if (/^\s*(undefined|null|0)?\s*$/.test(token)) return false;
|
|
50
|
+
token = String(token).trim();
|
|
50
51
|
|
|
51
52
|
if (token === "getAll") return STATE;
|
|
52
53
|
|
|
@@ -65,7 +66,8 @@ exports.serverState = new Proxy(
|
|
|
65
66
|
// delete serverState["abc123"];
|
|
66
67
|
// delete serverState["name=alice"]; // bulk delete, removes every entry where name == "alice"
|
|
67
68
|
deleteProperty(_, token) {
|
|
68
|
-
if (
|
|
69
|
+
if (/^\s*(undefined|null|0)?\s*$/.test(token)) return false;
|
|
70
|
+
token = String(token).trim();
|
|
69
71
|
|
|
70
72
|
if (token.includes("=")) {
|
|
71
73
|
const [field, value] = token.trim().split(/\s*=\s*/);
|
|
@@ -89,7 +91,8 @@ exports.serverState = new Proxy(
|
|
|
89
91
|
// serverState["abc123"] = null; // delete, cookie-expiry trick
|
|
90
92
|
// serverState["name=alice"] = {name: 'john'}; // bulk update, merges into every entry where name == "alice"
|
|
91
93
|
set(_, token, fields) {
|
|
92
|
-
if (
|
|
94
|
+
if (/^\s*(undefined|null|0)?\s*$/.test(token)) return false;
|
|
95
|
+
token = String(token).trim();
|
|
93
96
|
|
|
94
97
|
if (!fields) {
|
|
95
98
|
delete STATE[token];
|
package/socket.js
CHANGED
|
File without changes
|
package/stripe.js
CHANGED
|
@@ -36,13 +36,11 @@ module.exports = (key, appInfo) => {
|
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
|
|
39
|
-
async getPayments(
|
|
40
|
-
if (!
|
|
39
|
+
async getPayments(query) {
|
|
40
|
+
if (!query) return { error: "missing_required" };
|
|
41
41
|
|
|
42
42
|
try {
|
|
43
|
-
let { data = [], ...rest } = await stripe.charges.search({
|
|
44
|
-
query: `metadata["user_id"]:"${user_id}"`,
|
|
45
|
-
});
|
|
43
|
+
let { data = [], ...rest } = await stripe.charges.search({ query });
|
|
46
44
|
|
|
47
45
|
data = data.map((e) => ({
|
|
48
46
|
id: e.id,
|
package/systemLog.js
CHANGED
|
File without changes
|