Initial Camp Scan ticketing system
Backend (Fastify + TS): FluentForms webhook -> NocoDB row + QR + MailerSend email; PIN auth; scan/lookup/redeem with per-code serialization; reusable QR codes with count-based check-in; admin search. App (Expo, one codebase): Android APK + iPhone PWA. Login, camera scanner (native + web barcode-detector split), green/red overlay with sound + haptics, admin lookup/redeem. Session token persisted per device. Ops: multi-stage Dockerfile serving API + PWA same-origin, compose bound to 127.0.0.1; Forgejo Actions runner + tag-triggered signed APK build for Obtainium. Docs in README.md and INSTALL.md. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
commit
3397e3e3ec
60 changed files with 14703 additions and 0 deletions
42
app/lib/storage.ts
Normal file
42
app/lib/storage.ts
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
import { Platform } from "react-native";
|
||||
|
||||
// Token persistence: localStorage on web, SecureStore on native.
|
||||
const KEY = "campscan.token";
|
||||
|
||||
export async function saveToken(token: string): Promise<void> {
|
||||
if (Platform.OS === "web") {
|
||||
try {
|
||||
window.localStorage.setItem(KEY, token);
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
return;
|
||||
}
|
||||
const SecureStore = await import("expo-secure-store");
|
||||
await SecureStore.setItemAsync(KEY, token);
|
||||
}
|
||||
|
||||
export async function loadToken(): Promise<string | null> {
|
||||
if (Platform.OS === "web") {
|
||||
try {
|
||||
return window.localStorage.getItem(KEY);
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
const SecureStore = await import("expo-secure-store");
|
||||
return SecureStore.getItemAsync(KEY);
|
||||
}
|
||||
|
||||
export async function clearToken(): Promise<void> {
|
||||
if (Platform.OS === "web") {
|
||||
try {
|
||||
window.localStorage.removeItem(KEY);
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
return;
|
||||
}
|
||||
const SecureStore = await import("expo-secure-store");
|
||||
await SecureStore.deleteItemAsync(KEY);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue