diff --git a/.gitignore b/.gitignore
index e11c9b1..c7a5fe5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,3 +19,5 @@ cypress.env.json
cypress/screenshots
cypress/videos
coverage
+/.direnv
+/.envrc
diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 0000000..2555c53
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,16 @@
+{
+ // Use IntelliSense to learn about possible attributes.
+ // Hover to view descriptions of existing attributes.
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "name": "Launch localhost",
+ "type": "firefox",
+ "request": "launch",
+ "reAttach": true,
+ "url": "https://localhost:9443/join",
+ "webRoot": "${workspaceFolder}"
+ }
+ ]
+}
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
new file mode 100644
index 0000000..80811f4
--- /dev/null
+++ b/.vscode/tasks.json
@@ -0,0 +1,12 @@
+{
+ "version": "2.0.0",
+ "tasks": [
+ {
+ "type": "npm",
+ "script": "dev",
+ "problemMatcher": ["$tsc"],
+ "label": "npm: dev",
+ "detail": "npx vite serve --https"
+ }
+ ]
+}
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 0000000..761cd71
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,61 @@
+{
+ "nodes": {
+ "flake-utils": {
+ "inputs": {
+ "systems": "systems"
+ },
+ "locked": {
+ "lastModified": 1705309234,
+ "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
+ }
+ },
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1705641746,
+ "narHash": "sha256-D6c2aH8HQbWc7ZWSV0BUpFpd94ImFyCP8jFIsKQ4Slg=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "d2003f2223cbb8cd95134e4a0541beea215c1073",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixos-23.11",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "root": {
+ "inputs": {
+ "flake-utils": "flake-utils",
+ "nixpkgs": "nixpkgs"
+ }
+ },
+ "systems": {
+ "locked": {
+ "lastModified": 1681028828,
+ "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+ "owner": "nix-systems",
+ "repo": "default",
+ "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-systems",
+ "repo": "default",
+ "type": "github"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..24f8baa
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,31 @@
+{
+ description = "GM Notes";
+
+ inputs = {
+ nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
+ flake-utils.url = "github:numtide/flake-utils";
+ };
+
+ outputs = { self, nixpkgs, flake-utils }:
+ flake-utils.lib.eachDefaultSystem (system:
+ let
+ overlays = [];
+ pkgs = import nixpkgs {
+ inherit system overlays;
+ };
+ # During build time
+ nativeBuildInputs = with pkgs; [
+ ];
+ # During runtime
+ buildInputs = with pkgs; [
+ nodejs
+ ];
+ in
+ with pkgs;
+ {
+ devShells.default = mkShell {
+ inherit buildInputs nativeBuildInputs;
+ };
+ }
+ );
+}
\ No newline at end of file
diff --git a/jest.config.ts b/jest.config.ts
index 2a8e8ae..94f06e3 100644
--- a/jest.config.ts
+++ b/jest.config.ts
@@ -26,7 +26,7 @@ const config: Config = {
statements: 75
}
},
- moduleFileExtensions: ['js', 'ts', 'svelte'],
+ moduleFileExtensions: ['js', 'ts', 'svelte', 'node'],
setupFilesAfterEnv: ['/jest.setup.ts'],
testEnvironment: 'jsdom',
transform: {
diff --git a/jest.setup.ts b/jest.setup.ts
index fa03cc6..6baf18a 100644
--- a/jest.setup.ts
+++ b/jest.setup.ts
@@ -20,6 +20,10 @@ Object.defineProperty(global, 'foundry', {
}
});
+import { TextEncoder, TextDecoder } from 'util';
+
+Object.assign(global, { TextDecoder, TextEncoder });
+
function flattenObject(ob: any, _d: number = 0) {
var toReturn: any = {};
if (_d > 100) {
diff --git a/package-lock.json b/package-lock.json
index d94f492..1ee413d 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -9,6 +9,8 @@
"version": "1.0.0",
"license": "MIT",
"dependencies": {
+ "blake2b": "^2.1.4",
+ "blakejs": "^1.2.1",
"lodash": "^4.17.21",
"papaparse": "^5.3.2",
"reflect-metadata": "^0.1.13",
@@ -26,6 +28,7 @@
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/svelte": "^3.2.2",
"@tsconfig/svelte": "^3.0.0",
+ "@types/blake2b": "^2.1.3",
"@types/cypress": "^1.1.3",
"@types/jest": "^29.2.6",
"@types/lodash": "^4.14.191",
@@ -5799,6 +5802,12 @@
"@babel/types": "^7.3.0"
}
},
+ "node_modules/@types/blake2b": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/@types/blake2b/-/blake2b-2.1.3.tgz",
+ "integrity": "sha512-MFCdX0MNxFBP/xEILO5Td0kv6nI7+Q2iRWZbTL/yzH2/eDVZS5Wd1LHdsmXClvsCyzqaZfHFzZaN6BUeUCfSDA==",
+ "dev": true
+ },
"node_modules/@types/cypress": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/@types/cypress/-/cypress-1.1.3.tgz",
@@ -6303,6 +6312,11 @@
"integrity": "sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg==",
"dev": true
},
+ "node_modules/b4a": {
+ "version": "1.6.4",
+ "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.4.tgz",
+ "integrity": "sha512-fpWrvyVHEKyeEvbKZTVOeZF3VSKKWtJxFIxX/jaVPf+cLbGUSitjb49pHLqPV2BUNNZ0LcoeEGfE/YCpyDYHIw=="
+ },
"node_modules/babel-jest": {
"version": "29.3.1",
"resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.3.1.tgz",
@@ -6571,6 +6585,29 @@
"node": ">=8"
}
},
+ "node_modules/blake2b": {
+ "version": "2.1.4",
+ "resolved": "https://registry.npmjs.org/blake2b/-/blake2b-2.1.4.tgz",
+ "integrity": "sha512-AyBuuJNI64gIvwx13qiICz6H6hpmjvYS5DGkG6jbXMOT8Z3WUJ3V1X0FlhIoT1b/5JtHE3ki+xjtMvu1nn+t9A==",
+ "dependencies": {
+ "blake2b-wasm": "^2.4.0",
+ "nanoassert": "^2.0.0"
+ }
+ },
+ "node_modules/blake2b-wasm": {
+ "version": "2.4.0",
+ "resolved": "https://registry.npmjs.org/blake2b-wasm/-/blake2b-wasm-2.4.0.tgz",
+ "integrity": "sha512-S1kwmW2ZhZFFFOghcx73+ZajEfKBqhP82JMssxtLVMxlaPea1p9uoLiUZ5WYyHn0KddwbLc+0vh4wR0KBNoT5w==",
+ "dependencies": {
+ "b4a": "^1.0.1",
+ "nanoassert": "^2.0.0"
+ }
+ },
+ "node_modules/blakejs": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.2.1.tgz",
+ "integrity": "sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ=="
+ },
"node_modules/blob-util": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/blob-util/-/blob-util-2.0.2.tgz",
@@ -12440,6 +12477,11 @@
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
"dev": true
},
+ "node_modules/nanoassert": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/nanoassert/-/nanoassert-2.0.0.tgz",
+ "integrity": "sha512-7vO7n28+aYO4J+8w96AzhmU8G+Y/xpPDJz/se19ICsqj/momRbb9mh9ZUtkoJ5X3nTnPdhEJyc0qnM6yAsHBaA=="
+ },
"node_modules/nanoid": {
"version": "3.3.4",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz",
diff --git a/package.json b/package.json
index 8df9ae2..e62bb8c 100644
--- a/package.json
+++ b/package.json
@@ -60,6 +60,7 @@
"vite-tsconfig-paths": "^4.0.5"
},
"dependencies": {
+ "blakejs": "^1.2.1",
"lodash": "^4.17.21",
"papaparse": "^5.3.2",
"reflect-metadata": "^0.1.13",
diff --git a/src/components/config/ambient-sound/index.spec.ts b/src/components/config/ambient-sound/index.spec.ts
index 824a3d3..f63bce4 100644
--- a/src/components/config/ambient-sound/index.spec.ts
+++ b/src/components/config/ambient-sound/index.spec.ts
@@ -90,7 +90,9 @@ describe('Ambient Sound Config', () => {
expect(darknessMax).toBeVisible();
const path = screen.queryByTestId('syrin-path');
- expect(path).toHaveValue('syrinscape.wav');
+ expect(path).toHaveValue(
+ 'syrinscape:e7a81fff2ffebce8f7ac69b842609f3fb92719ba15d7b1a63d6e5f69d26b3379f5a85b5e6221c1ab8ada2ad68fb9d037c2df44acae59cd2baec4c5f8cb4c2eb6.wav'
+ );
expect(path).not.toBeVisible();
const flagsType = screen.queryByTestId('syrin-flags-type');
@@ -169,7 +171,9 @@ describe('Ambient Sound Config', () => {
expect(darknessMax).toBeVisible();
const path = screen.queryByTestId('syrin-path');
- expect(path).toHaveValue('syrinscape.wav');
+ expect(path).toHaveValue(
+ 'syrinscape:f554770b5a49ed068cf0f9790ce33ae43909cb5dd04616ab49b3f500258f828a0700afc2b67e4d2c3daf42f93cabf936d50113e7e2a68a91e4c62eb6654f47c8.wav'
+ );
expect(path).not.toBeVisible();
const flagsType = screen.queryByTestId('syrin-flags-type');
diff --git a/src/components/config/ambient-sound/index.svelte b/src/components/config/ambient-sound/index.svelte
index 2eb476f..494fa41 100644
--- a/src/components/config/ambient-sound/index.svelte
+++ b/src/components/config/ambient-sound/index.svelte
@@ -2,6 +2,7 @@
import Context from '@/services/context';
import type { SyrinAmbientSoundFlags } from '@/sounds/ambient-sound';
import type { Soundsets } from '@/models/store';
+ import { hashPath } from '@/utils';
// Context
const ctx = Context();
@@ -20,6 +21,9 @@
export let flags: SyrinAmbientSoundFlags;
export let create: boolean;
+
+ $: hashedPath = hashPath(flags.type, (flags as any)[flags.type]);
+
let soundsets = ctx.stores.soundsets;
let soundsetName: string = '...';
let ambientName: string = '...';
@@ -148,7 +152,7 @@
-
+
{
expect(name).toBeVisible();
const path = screen.queryByTestId('syrin-path');
- expect(path).toHaveValue('syrinscape.wav');
+ expect(path).toHaveValue(
+ 'syrinscape:e7a81fff2ffebce8f7ac69b842609f3fb92719ba15d7b1a63d6e5f69d26b3379f5a85b5e6221c1ab8ada2ad68fb9d037c2df44acae59cd2baec4c5f8cb4c2eb6.wav'
+ );
expect(path).not.toBeVisible();
const controlled = screen.queryByTestId('syrin-controlled');
@@ -93,7 +95,9 @@ describe('Playlist Sound Config', () => {
expect(name).toBeVisible();
const path = screen.queryByTestId('syrin-path');
- expect(path).toHaveValue('syrinscape.wav');
+ expect(path).toHaveValue(
+ 'syrinscape:f554770b5a49ed068cf0f9790ce33ae43909cb5dd04616ab49b3f500258f828a0700afc2b67e4d2c3daf42f93cabf936d50113e7e2a68a91e4c62eb6654f47c8.wav'
+ );
expect(path).not.toBeVisible();
const controlled = screen.queryByTestId('syrin-controlled');
diff --git a/src/components/config/playlist-sound/index.svelte b/src/components/config/playlist-sound/index.svelte
index 34b7a9e..d7a0323 100644
--- a/src/components/config/playlist-sound/index.svelte
+++ b/src/components/config/playlist-sound/index.svelte
@@ -1,6 +1,7 @@