notherbase-fs 3.5.2 → 4.0.1
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/controllers/creation.js +4 -3
- package/controllers/spirit-world.js +25 -22
- package/controllers/user.js +110 -126
- package/controllers/util.js +10 -1
- package/models/spirit.js +1 -1
- package/notherbase-fs.js +46 -34
- package/package.json +2 -2
- package/public/js/base.js +72 -30
- package/test/coast/tall-beach/nono-cove/index.ejs +3 -3
- package/test/public/drum.png +0 -0
- package/test/the-front/check/index.ejs +1 -1
- package/test/the-front/check/save-input.js +2 -2
- package/test/the-front/index.ejs +23 -33
- package/test-index.js +10 -3
- package/test2/pages/test-page/emailTime.js +9 -0
- package/test2/pages/test-page/index.ejs +105 -0
- package/test2/pages/void/index.ejs +36 -0
- package/test2/pages/void/void.css +3 -0
- package/test2/public/drum.png +0 -0
- package/test2/the-front/add-gold.js +14 -0
- package/test2/the-front/check/check.css +3 -0
- package/test2/the-front/check/emailTime.js +10 -0
- package/test2/the-front/check/flip.js +10 -0
- package/test2/the-front/check/index.ejs +55 -0
- package/test2/the-front/check/save-input.js +8 -0
- package/test2/the-front/index.ejs +100 -0
- package/test2/the-front/keeper/clipboards.js +134 -0
- package/test2/the-front/keeper/index.ejs +81 -0
- package/test2/the-front/keeper/keeper.css +158 -0
- package/test2/the-front/keeper/keeper.js +140 -0
- package/views/explorer.ejs +22 -22
- package/views/footer.ejs +2 -2
package/public/js/base.js
CHANGED
|
@@ -15,12 +15,15 @@ class Base {
|
|
|
15
15
|
|
|
16
16
|
constructor() {
|
|
17
17
|
this.playerAccount = {
|
|
18
|
-
username: null
|
|
19
|
-
email: null
|
|
18
|
+
username: null
|
|
20
19
|
};
|
|
21
20
|
|
|
22
21
|
this.$viewToggle = null;
|
|
23
22
|
this.viewState = "compact";
|
|
23
|
+
|
|
24
|
+
Base.commune("getView").then((res) => {
|
|
25
|
+
if (res.data === "full") this.toggleView(false);
|
|
26
|
+
});
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
/**
|
|
@@ -31,7 +34,11 @@ class Base {
|
|
|
31
34
|
let response = await Base.commune("logout");
|
|
32
35
|
|
|
33
36
|
if (!test) location.reload();
|
|
34
|
-
else
|
|
37
|
+
else {
|
|
38
|
+
this.playerAccount.username = null;
|
|
39
|
+
this.updateLoginStatus();
|
|
40
|
+
return response;
|
|
41
|
+
}
|
|
35
42
|
}
|
|
36
43
|
|
|
37
44
|
/**
|
|
@@ -41,9 +48,9 @@ class Base {
|
|
|
41
48
|
* @param {String} password The user's ****.
|
|
42
49
|
* @returns Communion response.
|
|
43
50
|
*/
|
|
44
|
-
attemptRegister = async (
|
|
51
|
+
attemptRegister = async (username, password) => {
|
|
45
52
|
let response = await Base.commune("register", {
|
|
46
|
-
|
|
53
|
+
username, password
|
|
47
54
|
});
|
|
48
55
|
|
|
49
56
|
return response;
|
|
@@ -55,32 +62,19 @@ class Base {
|
|
|
55
62
|
* @param {String} password The user's password.
|
|
56
63
|
* @returns Communion response.
|
|
57
64
|
*/
|
|
58
|
-
attemptLogin = async (
|
|
65
|
+
attemptLogin = async (username, password) => {
|
|
59
66
|
let response = await Base.commune("login", {
|
|
60
|
-
|
|
61
|
-
password: password
|
|
67
|
+
username, password
|
|
62
68
|
});
|
|
63
69
|
|
|
64
70
|
if (response.status === "success") {
|
|
65
71
|
this.playerAccount.username = response.data;
|
|
66
|
-
this.
|
|
72
|
+
this.updateLoginStatus(response.data);
|
|
67
73
|
}
|
|
68
74
|
|
|
69
75
|
return response;
|
|
70
76
|
};
|
|
71
77
|
|
|
72
|
-
/**
|
|
73
|
-
* Communes to send a password reset email.
|
|
74
|
-
* @param {String} email The user's email.
|
|
75
|
-
* @param {Boolean} test Debug mode
|
|
76
|
-
* @returns Communion response.
|
|
77
|
-
*/
|
|
78
|
-
resetPassword = async (email, test = false) => {
|
|
79
|
-
let response = await Base.commune("sendPasswordReset", { email, test });
|
|
80
|
-
|
|
81
|
-
return response;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
78
|
/**
|
|
85
79
|
* Communes to finalize a password change.
|
|
86
80
|
* @param {Number} token The password reset token.
|
|
@@ -89,8 +83,8 @@ class Base {
|
|
|
89
83
|
* @param {String} confirmation Confirmation of the user's new password.
|
|
90
84
|
* @returns Communion response.
|
|
91
85
|
*/
|
|
92
|
-
changePassword = async (
|
|
93
|
-
let response = await Base.commune("changePassword", {
|
|
86
|
+
changePassword = async (oldPassword, newPassword, confirmation) => {
|
|
87
|
+
let response = await Base.commune("changePassword", { oldPassword, newPassword, confirmation });
|
|
94
88
|
|
|
95
89
|
return response;
|
|
96
90
|
}
|
|
@@ -150,11 +144,7 @@ class Base {
|
|
|
150
144
|
this.$viewToggle.on("click", () => {
|
|
151
145
|
this.toggleView();
|
|
152
146
|
});
|
|
153
|
-
$("footer").append(this.$viewToggle);
|
|
154
|
-
|
|
155
|
-
Base.commune("getView").then((res) => {
|
|
156
|
-
if (res.data === "full") this.toggleView(false);
|
|
157
|
-
});
|
|
147
|
+
$("footer").append(this.$viewToggle);
|
|
158
148
|
}
|
|
159
149
|
|
|
160
150
|
/**
|
|
@@ -164,12 +154,12 @@ class Base {
|
|
|
164
154
|
toggleView = async (save = true) => {
|
|
165
155
|
if (this.viewState === "compact") {
|
|
166
156
|
this.viewState = "full";
|
|
167
|
-
this.$viewToggle.text("<");
|
|
157
|
+
if (this.$viewToggle) this.$viewToggle.text("<");
|
|
168
158
|
$("main").addClass("full-view");
|
|
169
159
|
}
|
|
170
160
|
else {
|
|
171
161
|
this.viewState = "compact";
|
|
172
|
-
this.$viewToggle.text(">");
|
|
162
|
+
if (this.$viewToggle) this.$viewToggle.text(">");
|
|
173
163
|
$("main").removeClass("full-view");
|
|
174
164
|
}
|
|
175
165
|
|
|
@@ -183,4 +173,56 @@ class Base {
|
|
|
183
173
|
appendToHead = (html) => {
|
|
184
174
|
$("head").append($(html));
|
|
185
175
|
}
|
|
176
|
+
|
|
177
|
+
//update login status
|
|
178
|
+
updateLoginStatus = (name = null) => {
|
|
179
|
+
let $status = $("footer .login-status");
|
|
180
|
+
let $logout = $("footer .logout");
|
|
181
|
+
|
|
182
|
+
if (name) {
|
|
183
|
+
$status.text(`Logged In: ${name}`);
|
|
184
|
+
$logout.removeClass("invisible");
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
$status.text("Not Logged In");
|
|
188
|
+
$logout.addClass("invisible");
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// download your data
|
|
193
|
+
downloadData = async () => {
|
|
194
|
+
let response = await Base.commune("downloadData");
|
|
195
|
+
console.log(response);
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
if (response.status === "success") {
|
|
199
|
+
let blob = new Blob([JSON.stringify(response.data)], { type: "application/json" });
|
|
200
|
+
let url = URL.createObjectURL(blob);
|
|
201
|
+
let a = document.createElement("a");
|
|
202
|
+
a.href = url;
|
|
203
|
+
a.download = "data.json";
|
|
204
|
+
document.body.appendChild(a);
|
|
205
|
+
a.click();
|
|
206
|
+
URL.revokeObjectURL(url);
|
|
207
|
+
a.remove();
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
deleteData = async (password) => {
|
|
212
|
+
let response = await Base.commune("deleteAlldata", { password });
|
|
213
|
+
|
|
214
|
+
console.log("Deleted: ", response.status === "success" ? response.data : "no");
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
importData = async (password, data) => {
|
|
218
|
+
|
|
219
|
+
let reader = new FileReader();
|
|
220
|
+
reader.addEventListener('load', async (event) => {
|
|
221
|
+
let parsed = JSON.parse(event.target.result);
|
|
222
|
+
//console.log(parsed);
|
|
223
|
+
let response = await Base.commune("importData", { password, data: parsed });
|
|
224
|
+
console.log("Imported: ", response.status === "success" ? response.data : "no");
|
|
225
|
+
});
|
|
226
|
+
reader.readAsText(data);
|
|
227
|
+
}
|
|
186
228
|
}
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
|
|
23
23
|
<script src="/js/chat-box.js"></script>
|
|
24
24
|
<script>
|
|
25
|
-
let chatTest = new ChatBox("<%= user.username %>", "test-chat");
|
|
26
|
-
let chatTest2 = new ChatBox("<%= user.username %>", "test-chat-2");
|
|
27
|
-
let chatTest3 = new ChatBox("<%= user.username %>", "test-chat-3");
|
|
25
|
+
let chatTest = new ChatBox("<%= user.memory.data.username %>", "test-chat");
|
|
26
|
+
let chatTest2 = new ChatBox("<%= user.memory.data.username %>", "test-chat-2");
|
|
27
|
+
let chatTest3 = new ChatBox("<%= user.memory.data.username %>", "test-chat-3");
|
|
28
28
|
|
|
29
29
|
chatTest.sendMessage("Hello, world!");
|
|
30
30
|
</script>
|
|
Binary file
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
base.loadAll("test-save3").then((res) => {
|
|
26
26
|
console.log(res);
|
|
27
|
-
if (res[0].data.text) $inp.attr("placeholder", res[0].data.text);
|
|
27
|
+
if (res[0]?.memory.data.text) $inp.attr("placeholder", res[0].memory.data.text);
|
|
28
28
|
else $inp.attr("placeholder", "No Input Saved");
|
|
29
29
|
});
|
|
30
30
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default async (req, user, io) => {
|
|
2
|
-
let spirit = await req.db.Spirit.recallOne("test-save3", user.
|
|
3
|
-
console.log(req.body);
|
|
2
|
+
let spirit = await req.db.Spirit.recallOne("test-save3", user.memory._id);
|
|
3
|
+
// console.log(req.body.text, spirit.memory);
|
|
4
4
|
|
|
5
5
|
await spirit.commit({
|
|
6
6
|
text: req.body.text
|
package/test/the-front/index.ejs
CHANGED
|
@@ -16,6 +16,15 @@
|
|
|
16
16
|
<input type="number" id="token">
|
|
17
17
|
<button onclick="test.continueTest()">Continue Test</button>
|
|
18
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">
|
|
19
28
|
|
|
20
29
|
<hr>
|
|
21
30
|
|
|
@@ -34,14 +43,12 @@
|
|
|
34
43
|
this.$gold = $("#gold");
|
|
35
44
|
|
|
36
45
|
this.oldID = Math.floor(Math.random() * 1000);
|
|
37
|
-
this.oldUsername = `
|
|
38
|
-
this.
|
|
39
|
-
this.oldPassword = `${this.oldID}password`;
|
|
46
|
+
this.oldUsername = `testuser00${this.oldID}`;
|
|
47
|
+
this.oldPassword = `password00${this.oldID}`;
|
|
40
48
|
|
|
41
49
|
this.newID = Math.floor(Math.random() * 1000);
|
|
42
|
-
this.newUsername = `
|
|
43
|
-
this.
|
|
44
|
-
this.newPassword = `${this.newID}password`;
|
|
50
|
+
this.newUsername = `testuser00${this.newID}`;
|
|
51
|
+
this.newPassword = `password00${this.newID}`;
|
|
45
52
|
|
|
46
53
|
this.prepTest();
|
|
47
54
|
}
|
|
@@ -50,55 +57,38 @@
|
|
|
50
57
|
this.$info.empty();
|
|
51
58
|
|
|
52
59
|
this.$info.append(this.oldUsername + "<br>");
|
|
53
|
-
this.$info.append(this.oldEmail + "<br>");
|
|
54
60
|
this.$info.append(this.oldPassword + "<br>");
|
|
55
61
|
|
|
56
62
|
this.$info.append(this.newUsername + "<br>");
|
|
57
|
-
this.$info.append(this.newEmail + "<br>");
|
|
58
63
|
this.$info.append(this.newPassword + "<br>");
|
|
59
64
|
|
|
60
65
|
let loaded = await base.load("gold", "global");
|
|
61
|
-
console.log(loaded);
|
|
66
|
+
console.log("global gold ", loaded);
|
|
62
67
|
this.$gold.text(`?/${loaded?.memory?.data?.amount !== null ? loaded.memory.data.amount : 0} Gold Added`);
|
|
63
68
|
loaded = await base.loadAll("gold");
|
|
64
|
-
console.log(loaded);
|
|
69
|
+
console.log("local gold ", loaded);
|
|
65
70
|
}
|
|
66
71
|
|
|
67
72
|
runTest = async () => {
|
|
68
|
-
let response = await base.attemptRegister(
|
|
69
|
-
this.oldEmail,
|
|
70
|
-
this.oldUsername,
|
|
71
|
-
this.oldPassword
|
|
72
|
-
);
|
|
73
|
-
this.$info.append(response.message + "<br>");
|
|
74
|
-
|
|
75
|
-
response = await base.attemptLogin(this.oldEmail, this.oldPassword);
|
|
73
|
+
let response = await base.attemptRegister(this.oldUsername, this.oldPassword);
|
|
76
74
|
this.$info.append(response.message + "<br>");
|
|
77
75
|
|
|
78
|
-
|
|
79
|
-
// this.$info.append(response.message + "<br>");
|
|
80
|
-
|
|
81
|
-
// let amountLocal = await base.load("gold");
|
|
82
|
-
// let amountGlobal = await base.load("gold", "global");
|
|
83
|
-
// this.$gold.text(`${amountLocal.gold}/${amountGlobal.gold} Gold Added`);
|
|
84
|
-
|
|
85
|
-
response = await base.resetPassword(this.oldEmail, true);
|
|
76
|
+
response = await base.attemptLogin(this.oldUsername, this.oldPassword);
|
|
86
77
|
this.$info.append(response.message + "<br>");
|
|
87
78
|
}
|
|
88
79
|
|
|
89
80
|
continueTest = async () => {
|
|
90
|
-
let response = await base.
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
response = await base.changePassword(
|
|
94
|
-
$("#token").val(),
|
|
95
|
-
this.oldEmail,
|
|
81
|
+
let response = await base.changePassword(
|
|
82
|
+
this.oldPassword,
|
|
96
83
|
this.newPassword,
|
|
97
84
|
this.newPassword
|
|
98
85
|
);
|
|
99
86
|
this.$info.append(response.message + "<br>");
|
|
100
87
|
|
|
101
|
-
response = await base.
|
|
88
|
+
response = await base.logout(true);
|
|
89
|
+
this.$info.append(response.message + "<br>");
|
|
90
|
+
|
|
91
|
+
response = await base.attemptLogin(this.oldUsername, this.newPassword);
|
|
102
92
|
this.$info.append(response.message + "<br>");
|
|
103
93
|
|
|
104
94
|
response = await base.logout(true);
|
package/test-index.js
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import NotherBaseFS from "./notherbase-fs.js";
|
|
2
|
-
import { fileURLToPath } from 'node:url';
|
|
3
|
-
const __dirname = fileURLToPath(new URL('./test', import.meta.url));
|
|
4
2
|
|
|
5
|
-
const notherBaseFS = new NotherBaseFS(
|
|
3
|
+
const notherBaseFS = new NotherBaseFS({}, {
|
|
4
|
+
notherbase: {
|
|
5
|
+
directory: './test',
|
|
6
|
+
icon: '/public/drum.png'
|
|
7
|
+
},
|
|
8
|
+
test: {
|
|
9
|
+
directory: './test2',
|
|
10
|
+
icon: '/public/drum.png'
|
|
11
|
+
}
|
|
12
|
+
});
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<title>Test</title>
|
|
6
|
+
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
|
7
|
+
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
|
|
8
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
9
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
10
|
+
<!-- font-family: 'Roboto' or 'Roboto Condensed', sans-serif; -->
|
|
11
|
+
<link href="https://fonts.googleapis.com/css2?family=Roboto&family=Roboto+Condensed:wght@700&display=swap" rel="stylesheet">
|
|
12
|
+
<!-- 'Redacted Script', cursive; -->
|
|
13
|
+
<link href="https://fonts.googleapis.com/css2?family=Redacted+Script:wght@300&display=swap" rel="stylesheet">
|
|
14
|
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
|
|
15
|
+
<link rel="stylesheet" href="/styles/main.css">
|
|
16
|
+
<link rel="stylesheet" href="/styles/menu.css">
|
|
17
|
+
<link rel="stylesheet" href="/styles/inventory.css">
|
|
18
|
+
<link rel="stylesheet" href="/styles/player.css">
|
|
19
|
+
<link rel="stylesheet" href="/styles/account.css">
|
|
20
|
+
<link rel="stylesheet" href="/styles/more.css">
|
|
21
|
+
<link rel="stylesheet" href="/styles/chat.css">
|
|
22
|
+
<script src="/js/base.js"></script>
|
|
23
|
+
</head>
|
|
24
|
+
<script>
|
|
25
|
+
const currentRoute = "<%- route %>";
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<body>
|
|
29
|
+
<main>
|
|
30
|
+
<div class="chatter" id="adam"></div>
|
|
31
|
+
<input type="text" id="adam">
|
|
32
|
+
<button id="adam">Chat</button>
|
|
33
|
+
</main>
|
|
34
|
+
</body>
|
|
35
|
+
|
|
36
|
+
<script>
|
|
37
|
+
class Spirit {
|
|
38
|
+
constructor(name) {
|
|
39
|
+
this.name = name;
|
|
40
|
+
this.children = {};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
addChild(child, parent) {
|
|
44
|
+
if (!this.children[child.name]) {
|
|
45
|
+
this.children[child.name] = 1;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
this.children[child.name]++;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
class Chatter {
|
|
53
|
+
constructor(id) {
|
|
54
|
+
this.name = id;
|
|
55
|
+
this.brain = new Spirit("i");
|
|
56
|
+
this.$div = $(`.chatter#${id}`);
|
|
57
|
+
this.$input = $(`input#${id}`);
|
|
58
|
+
this.$submit = $(`button#${id}`);
|
|
59
|
+
|
|
60
|
+
this.$submit.click(() => {
|
|
61
|
+
this.listen(this.$input.val());
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
register = (word) => {
|
|
66
|
+
if (!this.brain[word]) {
|
|
67
|
+
this.brain[word] = new Spirit(word);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return this.brain[word];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
think = () => {
|
|
74
|
+
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
listen = (message) => {
|
|
78
|
+
message = message.toLowerCase();
|
|
79
|
+
let words = message.split(" ");
|
|
80
|
+
|
|
81
|
+
//add words to the dialogue tree
|
|
82
|
+
this.register(words[0]);
|
|
83
|
+
for (let i = 0; i < words.length; i++) {
|
|
84
|
+
if (i < words.length - 1) {
|
|
85
|
+
let child = this.register(words[i + 1]);
|
|
86
|
+
if (i > 0) this.brain[words[i]].addChild(child, this.brain[words[i - 1]]);
|
|
87
|
+
else this.brain[words[i]].addChild(child, null);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
//think
|
|
92
|
+
|
|
93
|
+
this.respond(message);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
respond(message) {
|
|
97
|
+
this.$div.append(`<p>${this.name}: ${message}</p>`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const adam = new Chatter("adam");
|
|
102
|
+
adam.listen(`In the beginning God created the heavens and the earth`);
|
|
103
|
+
adam.listen("if i have the first two words in a three word relationship can the third word be guessed")
|
|
104
|
+
</script>
|
|
105
|
+
</html>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<title>Test</title>
|
|
6
|
+
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
|
7
|
+
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
|
|
8
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
9
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
10
|
+
<!-- font-family: 'Roboto' or 'Roboto Condensed', sans-serif; -->
|
|
11
|
+
<link href="https://fonts.googleapis.com/css2?family=Roboto&family=Roboto+Condensed:wght@700&display=swap" rel="stylesheet">
|
|
12
|
+
<!-- 'Redacted Script', cursive; -->
|
|
13
|
+
<link href="https://fonts.googleapis.com/css2?family=Redacted+Script:wght@300&display=swap" rel="stylesheet">
|
|
14
|
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
|
|
15
|
+
<link rel="stylesheet" href="/styles/main.css">
|
|
16
|
+
<link rel="stylesheet" href="/styles/menu.css">
|
|
17
|
+
<link rel="stylesheet" href="/styles/inventory.css">
|
|
18
|
+
<link rel="stylesheet" href="/styles/player.css">
|
|
19
|
+
<link rel="stylesheet" href="/styles/account.css">
|
|
20
|
+
<link rel="stylesheet" href="/styles/more.css">
|
|
21
|
+
<link rel="stylesheet" href="/styles/chat.css">
|
|
22
|
+
<script src="/js/base.js"></script>
|
|
23
|
+
</head>
|
|
24
|
+
<script>
|
|
25
|
+
const currentRoute = "<%- route %>";
|
|
26
|
+
</script>
|
|
27
|
+
<style>
|
|
28
|
+
<%- include("./void.css"); %>
|
|
29
|
+
</style>
|
|
30
|
+
|
|
31
|
+
<body>
|
|
32
|
+
<main>
|
|
33
|
+
<a href="/">Leave the Void</a>
|
|
34
|
+
</main>
|
|
35
|
+
</body>
|
|
36
|
+
</html>
|
|
Binary file
|
|
@@ -0,0 +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();
|
|
14
|
+
}
|
|
@@ -0,0 +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";
|
|
10
|
+
}
|
|
@@ -0,0 +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
|
+
}
|
|
55
|
+
</script>
|