From 05a1841f336b590761de18ce10ba74c067c95087 Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Sat, 16 Mar 2024 19:42:37 -0700 Subject: [PATCH] feat: add cool feature --- client/package.json | 2 + client/pnpm-lock.yaml | 14 ++ client/src/globals.d.ts | 8 ++ .../lib/Apps/Camera/CameraContainer.svelte | 15 +- client/src/lib/Apps/Settings/Settings.svelte | 128 ++++++++++++------ 5 files changed, 125 insertions(+), 42 deletions(-) diff --git a/client/package.json b/client/package.json index 983b5e5..a68a5e2 100644 --- a/client/package.json +++ b/client/package.json @@ -17,6 +17,7 @@ "@tauri-apps/cli": "^1.5.10", "@tsconfig/svelte": "^5.0.2", "@types/howler": "^2.2.11", + "@types/konami-code-js": "^0.8.3", "@types/three": "^0.161.2", "autoprefixer": "^10.4.17", "postcss": "^8.4.35", @@ -35,6 +36,7 @@ "@threlte/extras": "^8.8.0", "camera-controls": "^2.8.3", "howler": "^2.2.4", + "konami-code-js": "^0.8.1", "material-icons": "^1.13.12", "material-symbols": "^0.15.0", "overlayscrollbars-svelte": "^0.5.3", diff --git a/client/pnpm-lock.yaml b/client/pnpm-lock.yaml index 1ec875f..6180997 100644 --- a/client/pnpm-lock.yaml +++ b/client/pnpm-lock.yaml @@ -23,6 +23,9 @@ dependencies: howler: specifier: ^2.2.4 version: 2.2.4 + konami-code-js: + specifier: ^0.8.1 + version: 0.8.1 material-icons: specifier: ^1.13.12 version: 1.13.12 @@ -61,6 +64,9 @@ devDependencies: '@types/howler': specifier: ^2.2.11 version: 2.2.11 + '@types/konami-code-js': + specifier: ^0.8.3 + version: 0.8.3 '@types/three': specifier: ^0.161.2 version: 0.161.2 @@ -724,6 +730,10 @@ packages: resolution: {integrity: sha512-7aBoUL6RbSIrqKnpEgfa1wSNUBK06mn08siP2QI0zYk7MXfEJAaORc4tohamQYqCqVESoDyRWSdQn2BOKWj2Qw==} dev: true + /@types/konami-code-js@0.8.3: + resolution: {integrity: sha512-TYwIDZ16MuzqHdgv/zhbbE3p/iXY/FotJkMYx1oOzZKJoINezl91stc/U/i5AknH5lrEpXoims+tsCnAwIJGew==} + dev: true + /@types/pug@2.0.10: resolution: {integrity: sha512-Sk/uYFOBAB7mb74XcpizmH0KOR2Pv3D2Hmrh1Dmy5BmK3MpdSa5kqZcg6EKBdklU0bFXX9gCfzvpnyUehrPIuA==} dev: true @@ -1312,6 +1322,10 @@ packages: engines: {node: '>=6'} dev: true + /konami-code-js@0.8.1: + resolution: {integrity: sha512-bJ0tuWYLYiUueIVTpA0MV4h4Gz1X16uuJggh5TpIWXOQoLv0238SU7Im23z2wYKCCBsOfk5j4HKWB/pqdCgu5Q==} + dev: false + /lilconfig@2.1.0: resolution: {integrity: sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==} engines: {node: '>=10'} diff --git a/client/src/globals.d.ts b/client/src/globals.d.ts index 444d7c6..35fa02b 100644 --- a/client/src/globals.d.ts +++ b/client/src/globals.d.ts @@ -1,3 +1,11 @@ +declare module 'konami-code-js' { + export default class KonamiCode { + constructor(options: any = {}) + setCallback: (callback: () => void) => void + disable: () => void + } +} + type Gear = 'park' | 'reverse' | 'neutral' | 'low' | 'auto' | 'drive' type Mode = 'chill' | 'ludicrous' | 'cruise' diff --git a/client/src/lib/Apps/Camera/CameraContainer.svelte b/client/src/lib/Apps/Camera/CameraContainer.svelte index 279667b..6445aec 100644 --- a/client/src/lib/Apps/Camera/CameraContainer.svelte +++ b/client/src/lib/Apps/Camera/CameraContainer.svelte @@ -7,10 +7,19 @@ -->
-
⠀
diff --git a/client/src/lib/Apps/Settings/Settings.svelte b/client/src/lib/Apps/Settings/Settings.svelte index 394f905..9cc389d 100644 --- a/client/src/lib/Apps/Settings/Settings.svelte +++ b/client/src/lib/Apps/Settings/Settings.svelte @@ -5,6 +5,9 @@ import SettingsSelector from './SettingsSelector.svelte' import SettingsInput from './SettingsInput.svelte' import SettingsToggle from './SettingsToggle.svelte' + import KonamiCode from 'konami-code-js' + import { onMount } from 'svelte' + import { fly } from 'svelte/transition' settingsStore.subscribe(async value => { window.localStorage.setItem('settings', JSON.stringify(value)) @@ -15,59 +18,97 @@ settingsStore.reset() Notifications.success('Settings reset! Refresh for all changes to apply.') } + + let unlockSecret = false + + onMount(() => { + const kc = new KonamiCode() + kc.setCallback(() => { + kc.disable() + unlockSecret = true + }) + })

Settings

Hover over setting names to see helpful tooltips

General

- Disable Annoyances - Voice Prompt Language +
    +
  • + Disable Annoyances +
  • +
  • + Voice Prompt Language +
  • +

Camera Configuration

- Front Camera IP - Rear Camera IP +
    +
  • + Front Camera IP +
  • +
  • + Rear Camera IP +
  • +

Fun

- Sentry Mode - - RNG Weight - -

Secret

- Go Woke +
    +
  • + Sentry Mode +
  • +
  • + + RNG Weight + +
  • +
+ {#if unlockSecret} +
+

+ Secret +

+
    +
  • + Go Woke +
  • +
+
+ {/if}
+
+ +