@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 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
File without changes
package/location/index.js CHANGED
File without changes
File without changes
File without changes
File without changes
package/markdown/index.js CHANGED
File without changes
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.33",
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 (!token) return false;
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 (!token) return false;
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 (!token) return false;
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(user_id) {
40
- if (!user_id) return { error: "missing_required" };
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