@nka212bg/backend-utils 0.1.16 → 0.1.18

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.
@@ -109,19 +109,58 @@ exports.locales = {
109
109
  languageNameNative: "English",
110
110
  languageNameSimple: "English",
111
111
  regions: {
112
- AB: { regionName: "Alberta", GST: 5 },
113
- BC: { regionName: "British Columbia", GST: 5, PST: 7 },
114
- MB: { regionName: "Manitoba", GST: 5, PST: 7 },
115
- NB: { regionName: "New Brunswick", HST: 15 },
116
- NL: { regionName: "Newfoundland & Labrador", HST: 15 },
117
- NT: { regionName: "Northwest Territories", GST: 5 },
118
- NS: { regionName: "Nova Scotia", HST: 14 },
119
- NU: { regionName: "Nunavut", GST: 5 },
120
- ON: { regionName: "Ontario", HST: 13 },
121
- PE: { regionName: "Prince Edward Island", HST: 15 },
122
- QC: { regionName: "Quebec", GST: 5, PST: 9.975 },
123
- SK: { regionName: "Saskatchewan", GST: 5, PST: 6 },
124
- YT: { regionName: "Yukon", GST: 5 },
112
+ AB: {
113
+ regionName: "Alberta",
114
+ tax: { GST: 5 },
115
+ },
116
+ BC: {
117
+ regionName: "British Columbia",
118
+ tax: { GST: 5, PST: 7 },
119
+ },
120
+ MB: {
121
+ regionName: "Manitoba",
122
+ tax: { GST: 5, PST: 7 },
123
+ },
124
+ NB: {
125
+ regionName: "New Brunswick",
126
+ tax: { HST: 15 },
127
+ },
128
+ NL: {
129
+ regionName: "Newfoundland & Labrador",
130
+ tax: { HST: 15 },
131
+ },
132
+ NT: {
133
+ regionName: "Northwest Territories",
134
+ tax: { GST: 5 },
135
+ },
136
+ NS: {
137
+ regionName: "Nova Scotia",
138
+ tax: { HST: 14 },
139
+ },
140
+ NU: {
141
+ regionName: "Nunavut",
142
+ tax: { GST: 5 },
143
+ },
144
+ ON: {
145
+ regionName: "Ontario",
146
+ tax: { HST: 13 },
147
+ },
148
+ PE: {
149
+ regionName: "Prince Edward Island",
150
+ tax: { HST: 15 },
151
+ },
152
+ QC: {
153
+ regionName: "Quebec",
154
+ tax: { GST: 5, PST: 9.975 },
155
+ },
156
+ SK: {
157
+ regionName: "Saskatchewan",
158
+ tax: { GST: 5, PST: 6 },
159
+ },
160
+ YT: {
161
+ regionName: "Yukon",
162
+ tax: { GST: 5 },
163
+ },
125
164
  },
126
165
  },
127
166
  US: {
@@ -1,11 +1,13 @@
1
- const { existsSync, readFileSync, writeFileSync } = require("fs");
1
+ const { existsSync, readFileSync, writeFileSync, mkdirSync } = require("fs");
2
2
  const { strToEmailsArray, handlebars } = require("../misc");
3
3
  const { location } = require("../location");
4
4
 
5
5
  const nodemailer = require("nodemailer");
6
6
  const defaultTemplate = readFileSync(`${__dirname}/defaultTemplate.html`, "utf8");
7
7
 
8
+ !existsSync(`${__basedir}/state`) && mkdirSync(`${__basedir}/state`, { recursive: true });
8
9
  const emailListFilePath = `${__basedir}/state/useremailList.json`;
10
+
9
11
  let EMAILS_LIST = existsSync(emailListFilePath) ? JSON.parse(readFileSync(emailListFilePath, "utf8") || "{}") : {};
10
12
 
11
13
  const mailTransport = nodemailer.createTransport({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nka212bg/backend-utils",
3
3
  "author": "nka212bg",
4
- "version": "0.1.16",
4
+ "version": "0.1.18",
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
@@ -1,6 +1,8 @@
1
- const { existsSync, readFileSync, writeFileSync } = require("fs");
1
+ const { existsSync, readFileSync, writeFileSync, mkdirSync } = require("fs");
2
2
 
3
+ !existsSync(`${__basedir}/state`) && mkdirSync(`${__basedir}/state`, { recursive: true });
3
4
  const sessionStateFile = `${__basedir}/state/session.json`;
5
+
4
6
  const SESSION = existsSync(sessionStateFile) ? JSON.parse(readFileSync(sessionStateFile, "utf8") || "{}") : {};
5
7
 
6
8
  setInterval(() => {