feat: add announcement

- fix: bug encryption not working on newer version

Signed-off-by: pakintada@gmail.com <Pakin>
This commit is contained in:
pakintada@gmail.com 2026-06-19 11:26:44 +07:00
parent d4eb3be886
commit 270faf6b34
4 changed files with 183 additions and 2 deletions

View file

@ -50,6 +50,7 @@ import { handleSheetResponseFromNoti } from './sheetNotiHandler';
import { env } from '$env/dynamic/public';
import * as semver from 'semver';
import { WebCryptoHelper } from '../utils/crypto';
import { GlobalEventBus } from '../utils/eventBus';
export const messages = writable<string[]>([]);
@ -481,6 +482,10 @@ const handlers: Record<string, (payload: any) => void> = {
raw_stream_end_price: (p) => {
// End for price stream
handleRawStreamEnd('price', p);
},
announce: (p) => {
// Server-pushed announcement (e.g., closing maintenance)
GlobalEventBus.emit('announce', p);
}
};
@ -498,7 +503,7 @@ export async function handleIncomingMessages(raw: string, clientPrivateKey: Cryp
return;
}
if (semver.satisfies(APP_VERSION, '^0.0.2')) {
if (semver.satisfies(APP_VERSION, '>=0.0.2')) {
// secured message decryption
let sharedKeyStore = get(sharedKey);
if (sharedKeyStore) {