aboutsummaryrefslogtreecommitdiff
path: root/web/pw-server/src/lib/bot_code.ts
diff options
context:
space:
mode:
Diffstat (limited to 'web/pw-server/src/lib/bot_code.ts')
-rw-r--r--web/pw-server/src/lib/bot_code.ts15
1 files changed, 15 insertions, 0 deletions
diff --git a/web/pw-server/src/lib/bot_code.ts b/web/pw-server/src/lib/bot_code.ts
new file mode 100644
index 0000000..088db72
--- /dev/null
+++ b/web/pw-server/src/lib/bot_code.ts
@@ -0,0 +1,15 @@
+import defaultBotCode from "../assets/bot_template.txt?raw";
+
+const BOT_CODE_KEY = "bot_code";
+
+export function getBotCode() {
+ let botCode = localStorage.getItem(BOT_CODE_KEY);
+ if (!botCode) {
+ botCode = defaultBotCode;
+ }
+ return botCode;
+}
+
+export function saveBotCode(botCode: string) {
+ localStorage.setItem(BOT_CODE_KEY, botCode);
+}