notherbase-fs 4.0.22 → 4.0.23

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.
Files changed (54) hide show
  1. package/README.md +6 -6
  2. package/controllers/creation.js +147 -147
  3. package/controllers/spirit-world.js +174 -174
  4. package/controllers/user.js +240 -240
  5. package/controllers/util.js +64 -64
  6. package/models/index.js +33 -33
  7. package/models/send-mail.js +58 -58
  8. package/models/spirit.js +234 -234
  9. package/notherbase-fs.js +112 -112
  10. package/package.json +40 -40
  11. package/public/js/base.js +222 -227
  12. package/public/js/chat-box.js +120 -120
  13. package/test/coast/tall-beach/nono-cove/index.css +17 -17
  14. package/test/coast/tall-beach/nono-cove/index.ejs +29 -29
  15. package/test/coast/tall-beach/nono-cove/nono-og/add-gold.js +15 -15
  16. package/test/coast/tall-beach/nono-cove/nono-og/index.ejs +46 -46
  17. package/test/coast/tall-beach/nono-cove/nono-og/nono.css +88 -88
  18. package/test/coast/tall-beach/nono-cove/nono-og/nono.js +207 -207
  19. package/test/pages/test-page/emailTime.js +8 -8
  20. package/test/pages/test-page/index.ejs +104 -104
  21. package/test/pages/void/index.ejs +35 -35
  22. package/test/pages/void/void.css +2 -2
  23. package/test/public/styles/main.css +792 -792
  24. package/test/the-front/add-gold.js +13 -13
  25. package/test/the-front/check/check.css +2 -2
  26. package/test/the-front/check/emailTime.js +9 -9
  27. package/test/the-front/check/flip.js +9 -9
  28. package/test/the-front/check/index.ejs +54 -54
  29. package/test/the-front/check/save-input.js +7 -7
  30. package/test/the-front/index.ejs +116 -99
  31. package/test/the-front/keeper/clipboards.js +133 -133
  32. package/test/the-front/keeper/index.ejs +80 -80
  33. package/test/the-front/keeper/keeper.css +157 -157
  34. package/test/the-front/keeper/keeper.js +140 -140
  35. package/test-index.js +19 -19
  36. package/test2/pages/test-page/emailTime.js +8 -8
  37. package/test2/pages/test-page/index.ejs +104 -104
  38. package/test2/pages/void/index.ejs +35 -35
  39. package/test2/pages/void/void.css +2 -2
  40. package/test2/public/styles/main.css +792 -792
  41. package/test2/the-front/add-gold.js +13 -13
  42. package/test2/the-front/check/check.css +2 -2
  43. package/test2/the-front/check/emailTime.js +9 -9
  44. package/test2/the-front/check/flip.js +9 -9
  45. package/test2/the-front/check/index.ejs +54 -54
  46. package/test2/the-front/check/save-input.js +7 -7
  47. package/test2/the-front/index.ejs +99 -99
  48. package/test2/the-front/keeper/clipboards.js +133 -133
  49. package/test2/the-front/keeper/index.ejs +80 -80
  50. package/test2/the-front/keeper/keeper.css +157 -157
  51. package/test2/the-front/keeper/keeper.js +140 -140
  52. package/views/explorer.ejs +82 -82
  53. package/views/footer.ejs +9 -9
  54. package/views/head.ejs +17 -17
@@ -1,14 +1,14 @@
1
- export default async (req, user, io) => {
2
- // let deleted = await req.db.Spirit.delete("gold");
3
- let spirit = await req.db.Spirit.recallOrCreateOne("gold");
4
- spirit.addBackup({
5
- amount: spirit.memory?.data?.amount != null ? spirit.memory.data.amount + 1 : 1
6
- });
7
- await spirit.commit();
8
-
9
- spirit = await req.db.Spirit.recallOrCreateOne("gold", user.memory._id);
10
- spirit.addBackup({
11
- amount: spirit.memory?.data?.amount != null ? spirit.memory.data.amount + 1 : 1
12
- });
13
- await spirit.commit();
1
+ export default async (req, user, io) => {
2
+ // let deleted = await req.db.Spirit.delete("gold");
3
+ let spirit = await req.db.Spirit.recallOrCreateOne("gold");
4
+ spirit.addBackup({
5
+ amount: spirit.memory?.data?.amount != null ? spirit.memory.data.amount + 1 : 1
6
+ });
7
+ await spirit.commit();
8
+
9
+ spirit = await req.db.Spirit.recallOrCreateOne("gold", user.memory._id);
10
+ spirit.addBackup({
11
+ amount: spirit.memory?.data?.amount != null ? spirit.memory.data.amount + 1 : 1
12
+ });
13
+ await spirit.commit();
14
14
  }
@@ -1,3 +1,3 @@
1
- .flipped {
2
- background: black;
1
+ .flipped {
2
+ background: black;
3
3
  }
@@ -1,10 +1,10 @@
1
- export default async function emailTime(req, user) {
2
- await req.db.SendMail.send(
3
- 'wyattsushi@gmail.com',
4
- 'Test',
5
- 'sdntndtjln l',
6
- "NB"
7
- );
8
-
9
- return "Sent";
1
+ export default async function emailTime(req, user) {
2
+ await req.db.SendMail.send(
3
+ 'wyattsushi@gmail.com',
4
+ 'Test',
5
+ 'sdntndtjln l',
6
+ "NB"
7
+ );
8
+
9
+ return "Sent";
10
10
  }
@@ -1,10 +1,10 @@
1
- export default async (req, user, io) => {
2
- let bigSwitch = await req.db.Spirit.recallOne("big-switch");
3
-
4
- if (!bigSwitch.memory.data.flipped) await bigSwitch.commit({ flipped: true });
5
- else await bigSwitch.commit({ flipped: false });
6
- console.log(bigSwitch.memory.data);
7
-
8
- io.to("big-switch").emit("big-switch", { flipped: bigSwitch.memory.data.flipped });
9
- return "success";
1
+ export default async (req, user, io) => {
2
+ let bigSwitch = await req.db.Spirit.recallOne("big-switch");
3
+
4
+ if (!bigSwitch.memory.data.flipped) await bigSwitch.commit({ flipped: true });
5
+ else await bigSwitch.commit({ flipped: false });
6
+ console.log(bigSwitch.memory.data);
7
+
8
+ io.to("big-switch").emit("big-switch", { flipped: bigSwitch.memory.data.flipped });
9
+ return "success";
10
10
  }
@@ -1,55 +1,55 @@
1
- <style>
2
- <%- include("./check.css"); %>
3
- </style>
4
-
5
- <h1>The Big Check</h1>
6
-
7
- <hr>
8
-
9
- <button onclick="base.do('add-more-gold')">+3</button>
10
- <button onclick="base.do('subtract-gold')">-30</button>
11
- <button onclick="base.do('emailTime', { route: '/the-front/check'})">email</button>
12
- <button class="switch" onclick="base.do('flip')">Flip Me</button>
13
- <input type="text" id="test" placeholder="Loading...">
14
- <button onclick="saveInput()">Save</button>
15
-
16
- <hr>
17
-
18
- <a href="/the-front">
19
- Go to The Front
20
- </a>
21
-
22
- <script>
23
- const $inp = $("input#test");
24
-
25
- base.loadAll("test-save3").then((res) => {
26
- console.log(res);
27
- if (res[0]?.memory.data.text) $inp.attr("placeholder", res[0].memory.data.text);
28
- else $inp.attr("placeholder", "No Input Saved");
29
- });
30
-
31
- const saveInput = function saveInput() {
32
- let inp = $inp.val();
33
-
34
- base.do("save-input", {
35
- text: inp,
36
- route: "/the-front/check"
37
- });
38
- }
39
-
40
- let switchSocket = io({
41
- query: {
42
- room: "big-switch",
43
- name: "player"
44
- }
45
- });
46
-
47
- switchSocket.on('big-switch', (update) => {
48
- flipSwitch(update.flipped);
49
- });
50
-
51
- let flipSwitch = function flipSwitch(flipped) {
52
- if (flipped) $(".switch").addClass("flipped");
53
- else $(".switch").removeClass("flipped");
54
- }
1
+ <style>
2
+ <%- include("./check.css"); %>
3
+ </style>
4
+
5
+ <h1>The Big Check</h1>
6
+
7
+ <hr>
8
+
9
+ <button onclick="base.do('add-more-gold')">+3</button>
10
+ <button onclick="base.do('subtract-gold')">-30</button>
11
+ <button onclick="base.do('emailTime', { route: '/the-front/check'})">email</button>
12
+ <button class="switch" onclick="base.do('flip')">Flip Me</button>
13
+ <input type="text" id="test" placeholder="Loading...">
14
+ <button onclick="saveInput()">Save</button>
15
+
16
+ <hr>
17
+
18
+ <a href="/the-front">
19
+ Go to The Front
20
+ </a>
21
+
22
+ <script>
23
+ const $inp = $("input#test");
24
+
25
+ base.loadAll("test-save3").then((res) => {
26
+ console.log(res);
27
+ if (res[0]?.memory.data.text) $inp.attr("placeholder", res[0].memory.data.text);
28
+ else $inp.attr("placeholder", "No Input Saved");
29
+ });
30
+
31
+ const saveInput = function saveInput() {
32
+ let inp = $inp.val();
33
+
34
+ base.do("save-input", {
35
+ text: inp,
36
+ route: "/the-front/check"
37
+ });
38
+ }
39
+
40
+ let switchSocket = io({
41
+ query: {
42
+ room: "big-switch",
43
+ name: "player"
44
+ }
45
+ });
46
+
47
+ switchSocket.on('big-switch', (update) => {
48
+ flipSwitch(update.flipped);
49
+ });
50
+
51
+ let flipSwitch = function flipSwitch(flipped) {
52
+ if (flipped) $(".switch").addClass("flipped");
53
+ else $(".switch").removeClass("flipped");
54
+ }
55
55
  </script>
@@ -1,8 +1,8 @@
1
- export default async (req, user, io) => {
2
- let spirit = await req.db.Spirit.recallOne("test-save3", user.memory._id);
3
- // console.log(req.body.text, spirit.memory);
4
-
5
- await spirit.commit({
6
- text: req.body.text
7
- });
1
+ export default async (req, user, io) => {
2
+ let spirit = await req.db.Spirit.recallOne("test-save3", user.memory._id);
3
+ // console.log(req.body.text, spirit.memory);
4
+
5
+ await spirit.commit({
6
+ text: req.body.text
7
+ });
8
8
  }
@@ -1,100 +1,117 @@
1
- <h1>NotherBase</h1>
2
-
3
- <p>
4
- Welcome to The Front Test.
5
- </p>
6
-
7
- <p id="gold">0 Gold Added</p>
8
-
9
- <hr>
10
-
11
- <h3>Test Accounts</h3>
12
- <button onclick="test.runTest()">Run Test</button>
13
-
14
- <p id="info"></p>
15
-
16
- <input type="number" id="token">
17
- <button onclick="test.continueTest()">Continue Test</button>
18
- <button onclick="base.do('add-gold', { route: '/the-front' })">add gold</button>
19
- <!-- download you data -->
20
- <button onclick="base.downloadData()">Download Data</button>
21
- <!-- delete all your data -->
22
- <button onclick="base.deleteData($('#password').val())">Delete Data</button>
23
- <!-- import your data -->
24
- <button onclick="base.importData($('#password').val(), $('#fileInput')[0].files[0])">Import Data</button>
25
- <input type="file" id="fileInput">
26
- <!-- password input -->
27
- <input type="test" id="password" placeholder="pass">
28
-
29
- <hr>
30
-
31
- <a href="/coast/tall-beach/nono-cove" class="to nother-base">
32
- Go inside
33
- </a>
34
-
35
- <a href="/check">
36
- Go to The Check
37
- </a>
38
-
39
- <script>
40
- class Test {
41
- constructor() {
42
- this.$info = $("main #info");
43
- this.$gold = $("#gold");
44
-
45
- this.oldID = Math.floor(Math.random() * 1000);
46
- this.oldUsername = `testuser00${this.oldID}`;
47
- this.oldPassword = `password00${this.oldID}`;
48
-
49
- this.newID = Math.floor(Math.random() * 1000);
50
- this.newUsername = `testuser00${this.newID}`;
51
- this.newPassword = `password00${this.newID}`;
52
-
53
- this.prepTest();
54
- }
55
-
56
- prepTest = async () => {
57
- this.$info.empty();
58
-
59
- this.$info.append(this.oldUsername + "<br>");
60
- this.$info.append(this.oldPassword + "<br>");
61
-
62
- this.$info.append(this.newUsername + "<br>");
63
- this.$info.append(this.newPassword + "<br>");
64
-
65
- let loaded = await base.load("gold", "global");
66
- console.log("global gold ", loaded);
67
- this.$gold.text(`?/${loaded?.memory?.data?.amount !== null ? loaded.memory.data.amount : 0} Gold Added`);
68
- loaded = await base.loadAll("gold");
69
- console.log("local gold ", loaded);
70
- }
71
-
72
- runTest = async () => {
73
- let response = await base.attemptRegister(this.oldUsername, this.oldPassword);
74
- this.$info.append(response.message + "<br>");
75
-
76
- response = await base.attemptLogin(this.oldUsername, this.oldPassword);
77
- this.$info.append(response.message + "<br>");
78
- }
79
-
80
- continueTest = async () => {
81
- let response = await base.changePassword(
82
- this.oldPassword,
83
- this.newPassword,
84
- this.newPassword
85
- );
86
- this.$info.append(response.message + "<br>");
87
-
88
- response = await base.logout(true);
89
- this.$info.append(response.message + "<br>");
90
-
91
- response = await base.attemptLogin(this.oldUsername, this.newPassword);
92
- this.$info.append(response.message + "<br>");
93
-
94
- response = await base.logout(true);
95
- this.$info.append(response.message + "<br>");
96
- }
97
- }
98
-
99
- let test = new Test();
1
+ <h1>NotherBase</h1>
2
+
3
+ <p>
4
+ Welcome to The Front Test.
5
+ </p>
6
+
7
+ <p id="gold">0 Gold Added</p>
8
+
9
+ <hr>
10
+
11
+ <h3>Test Accounts</h3>
12
+ <button onclick="test.runTest()">Run Test</button>
13
+
14
+ <p id="info"></p>
15
+
16
+ <input type="number" id="token">
17
+ <button onclick="test.continueTest()">Continue Test</button>
18
+ <button onclick="base.do('add-gold', { route: '/the-front' })">add gold</button>
19
+ <!-- download you data -->
20
+ <button onclick="downloadData()">Download Data</button>
21
+ <!-- delete all your data -->
22
+ <button onclick="deleteData()">Delete Data</button>
23
+ <!-- import your data -->
24
+ <button onclick="importData()">Import Data</button>
25
+ <input type="file" id="fileInput">
26
+ <!-- password input -->
27
+ <input type="test" id="password" placeholder="pass">
28
+
29
+ <hr>
30
+
31
+ <a href="/coast/tall-beach/nono-cove" class="to nother-base">
32
+ Go inside
33
+ </a>
34
+
35
+ <a href="/check">
36
+ Go to The Check
37
+ </a>
38
+
39
+ <script>
40
+ class Test {
41
+ constructor() {
42
+ this.$info = $("main #info");
43
+ this.$gold = $("#gold");
44
+
45
+ this.oldID = Math.floor(Math.random() * 1000);
46
+ this.oldUsername = `testuser00${this.oldID}`;
47
+ this.oldPassword = `password00${this.oldID}`;
48
+
49
+ this.newID = Math.floor(Math.random() * 1000);
50
+ this.newUsername = `testuser00${this.newID}`;
51
+ this.newPassword = `password00${this.newID}`;
52
+
53
+ this.prepTest();
54
+ }
55
+
56
+ prepTest = async () => {
57
+ this.$info.empty();
58
+
59
+ this.$info.append(this.oldUsername + "<br>");
60
+ this.$info.append(this.oldPassword + "<br>");
61
+
62
+ this.$info.append(this.newUsername + "<br>");
63
+ this.$info.append(this.newPassword + "<br>");
64
+
65
+ let loaded = await base.load("gold", "global");
66
+ console.log("global gold ", loaded);
67
+ this.$gold.text(`?/${loaded?.memory?.data?.amount !== null ? loaded.memory.data.amount : 0} Gold Added`);
68
+ loaded = await base.loadAll("gold");
69
+ console.log("local gold ", loaded);
70
+ }
71
+
72
+ runTest = async () => {
73
+ let response = await base.attemptRegister(this.oldUsername, this.oldPassword);
74
+ this.$info.append(response.message + "<br>");
75
+
76
+ response = await base.attemptLogin(this.oldUsername, this.oldPassword);
77
+ this.$info.append(response.message + "<br>");
78
+ }
79
+
80
+ continueTest = async () => {
81
+ let response = await base.changePassword(
82
+ this.oldPassword,
83
+ this.newPassword,
84
+ this.newPassword
85
+ );
86
+ this.$info.append(response.message + "<br>");
87
+
88
+ response = await base.logout(true);
89
+ this.$info.append(response.message + "<br>");
90
+
91
+ response = await base.attemptLogin(this.oldUsername, this.newPassword);
92
+ this.$info.append(response.message + "<br>");
93
+
94
+ response = await base.logout(true);
95
+ this.$info.append(response.message + "<br>");
96
+ }
97
+ }
98
+
99
+ let test = new Test();
100
+
101
+ let downloadData = async () => {
102
+ let res = base.downloadData();
103
+ console.log(res.message);
104
+ }
105
+
106
+ let deleteData = async () => {
107
+ let res = base.deleteData($('#password').val());
108
+ console.log(res.message);
109
+ }
110
+
111
+ let importData = async () => {
112
+ let pass = $('#password').val();
113
+ let file = $('#fileInput')[0].files[0];
114
+ let res = await base.importData(pass, file);
115
+ console.log(res.message);
116
+ }
100
117
  </script>