From 2afe61d75287ad38285658f067284787646e35af Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Tue, 12 Aug 2025 08:14:10 +0000 Subject: [PATCH 1/8] chore: lint-fix --- src/components/DataExportSection.vue | 7 ++++--- src/components/OfferDialog.vue | 6 +----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/components/DataExportSection.vue b/src/components/DataExportSection.vue index ce8ee2fc..a21be7b2 100644 --- a/src/components/DataExportSection.vue +++ b/src/components/DataExportSection.vue @@ -187,9 +187,10 @@ export default class DataExportSection extends Vue { const exContact: Contact = R.omit(["contactMethods"], contact); // now add contactMethods as a true array of ContactMethod objects exContact.contactMethods = contact.contactMethods - ? (typeof contact.contactMethods === 'string' && contact.contactMethods.trim() !== '' - ? JSON.parse(contact.contactMethods) - : []) + ? typeof contact.contactMethods === "string" && + contact.contactMethods.trim() !== "" + ? JSON.parse(contact.contactMethods) + : [] : []; return exContact; }); diff --git a/src/components/OfferDialog.vue b/src/components/OfferDialog.vue index b8b8093f..81664088 100644 --- a/src/components/OfferDialog.vue +++ b/src/components/OfferDialog.vue @@ -18,7 +18,7 @@ Raymer */
@@ -152,8 +152,6 @@ export default class OfferDialog extends Vue { }; } - - // ================================================= // COMPONENT METHODS // ================================================= @@ -199,8 +197,6 @@ export default class OfferDialog extends Vue { this.visible = false; } - - /** * Handle amount updates from AmountInput component * @param value - New amount value From bb357f294aeb3ba2a931fd99cbc64b4d87e205a3 Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Tue, 12 Aug 2025 08:45:08 +0000 Subject: [PATCH 2/8] refactor(ui): remove unused image cache system and fix TypeScript compilation - Remove imageCache Map that only stored null values - Remove selectedImageData Blob property (never used) - Remove cacheImageData method and related function props - Remove handleImageLoad method from ActivityListItem - Clean up ImageViewer component props - Fix TypeScript compilation by replacing legacy logConsoleAndDb calls - Replace logConsoleAndDb with logger.error in deepLinks service - Images continue to work via direct URL references The image cache system was non-functional and only stored null values. ImageViewer component ignored blob data and only used URLs. Fixed production build failure caused by undefined logConsoleAndDb function. Removing dead code improves maintainability without affecting functionality. --- src/components/ActivityListItem.vue | 16 ---------------- src/components/ImageViewer.vue | 1 - src/services/deepLinks.ts | 10 ++++------ src/views/HomeView.vue | 27 +-------------------------- 4 files changed, 5 insertions(+), 49 deletions(-) diff --git a/src/components/ActivityListItem.vue b/src/components/ActivityListItem.vue index d1525e8d..257259b9 100644 --- a/src/components/ActivityListItem.vue +++ b/src/components/ActivityListItem.vue @@ -73,7 +73,6 @@ class="w-full h-auto max-w-lg max-h-96 object-contain mx-auto drop-shadow-md" :src="record.image" alt="Activity image" - @load="handleImageLoad(record.image)" />
@@ -272,13 +271,6 @@ export default class ActivityListItem extends Vue { @Prop() isRegistered!: boolean; @Prop() activeDid!: string; - /** - * Function prop for handling image caching - * Called when an image loads successfully, allowing parent to control caching behavior - */ - @Prop({ type: Function, default: () => {} }) - onImageCache!: (imageUrl: string) => void | Promise; - isHiddenDid = isHiddenDid; notify!: ReturnType; $notify!: (notification: any, timeout?: number) => void; @@ -295,14 +287,6 @@ export default class ActivityListItem extends Vue { this.notify.warning(NOTIFY_UNKNOWN_PERSON.message, TIMEOUTS.STANDARD); } - /** - * Handle image load event - call function prop for caching - * Allows parent to control caching behavior and validation - */ - handleImageLoad(imageUrl: string): void { - this.onImageCache(imageUrl); - } - get fetchAmount(): string { const claim = (this.record.fullClaim as any)?.claim || this.record.fullClaim; diff --git a/src/components/ImageViewer.vue b/src/components/ImageViewer.vue index 07486705..3e8e577f 100644 --- a/src/components/ImageViewer.vue +++ b/src/components/ImageViewer.vue @@ -45,7 +45,6 @@ import { logger } from "../utils/logger"; @Component({ emits: ["update:isOpen"] }) export default class ImageViewer extends Vue { @Prop() imageUrl!: string; - @Prop() imageData!: Blob | null; @Prop() isOpen!: boolean; userAgent = new UAParser(); diff --git a/src/services/deepLinks.ts b/src/services/deepLinks.ts index ad97ef46..62ae7b15 100644 --- a/src/services/deepLinks.ts +++ b/src/services/deepLinks.ts @@ -53,6 +53,7 @@ import { DeepLinkRoute, } from "../interfaces/deepLinks"; import type { DeepLinkError } from "../interfaces/deepLinks"; +import { logger } from "../utils/logger"; // Helper function to extract the first key from a Zod object schema function getFirstKeyFromZodObject( @@ -204,9 +205,8 @@ export class DeepLinkHandler { validatedParams = await schema.parseAsync(params); } catch (error) { // For parameter validation errors, provide specific error feedback - logConsoleAndDb( + logger.error( `[DeepLink] Invalid parameters for route name ${routeName} for path: ${path}: ${JSON.stringify(error)} ... with params: ${JSON.stringify(params)} ... and query: ${JSON.stringify(query)}`, - true, ); await this.router.replace({ name: "deep-link-error", @@ -229,9 +229,8 @@ export class DeepLinkHandler { params: validatedParams, }); } catch (error) { - logConsoleAndDb( + logger.error( `[DeepLink] Error routing to route name ${routeName} for path: ${path}: ${JSON.stringify(error)} ... with validated params: ${JSON.stringify(validatedParams)}`, - true, ); // For parameter validation errors, provide specific error feedback await this.router.replace({ @@ -263,9 +262,8 @@ export class DeepLinkHandler { await this.validateAndRoute(path, sanitizedParams, query); } catch (error) { const deepLinkError = error as DeepLinkError; - logConsoleAndDb( + logger.error( `[DeepLink] Error (${deepLinkError.code}): ${deepLinkError.details}`, - true, ); throw { diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index 25bcac3e..4af9b5bc 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -234,7 +234,6 @@ Raymer * @version 1.0.0 */ :last-viewed-claim-id="feedLastViewedClaimId" :is-registered="isRegistered" :active-did="activeDid" - :on-image-cache="cacheImageData" @load-claim="onClickLoadClaim" @view-image="openImageViewer" /> @@ -255,11 +254,7 @@ Raymer * @version 1.0.0 */ - + diff --git a/src/services/deepLinks.ts b/src/services/deepLinks.ts index 62ae7b15..d8445607 100644 --- a/src/services/deepLinks.ts +++ b/src/services/deepLinks.ts @@ -179,7 +179,7 @@ export class DeepLinkHandler { const validRoute = routeSchema.parse(path) as DeepLinkRoute; routeName = ROUTE_MAP[validRoute].name; } catch (error) { - console.error(`[DeepLink] Invalid route path: ${path}`); + logger.error(`[DeepLink] Invalid route path: ${path}`); // Redirect to error page with information about the invalid link await this.router.replace({ diff --git a/src/services/platforms/WebPlatformService.ts b/src/services/platforms/WebPlatformService.ts index 7ec13c01..a731ee22 100644 --- a/src/services/platforms/WebPlatformService.ts +++ b/src/services/platforms/WebPlatformService.ts @@ -693,7 +693,8 @@ export class WebPlatformService implements PlatformService { const setClause = keys.map((key) => `${key} = ?`).join(", "); const sql = `UPDATE settings SET ${setClause} WHERE accountDid = ?`; const params = [...keys.map((key) => settings[key]), did]; - console.log( + // Log update operation for debugging + logger.debug( "[WebPlatformService] updateDidSpecificSettings", sql, JSON.stringify(params, null, 2), diff --git a/src/views/AccountViewView.vue b/src/views/AccountViewView.vue index 892e1ebc..81c2978e 100644 --- a/src/views/AccountViewView.vue +++ b/src/views/AccountViewView.vue @@ -61,7 +61,8 @@ /> - +

- + Date: Wed, 13 Aug 2025 09:05:04 -0600 Subject: [PATCH 5/8] doc: Add helpful setup instructions for quick start for new devs. --- BUILDING.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/BUILDING.md b/BUILDING.md index ba5649da..e1e94fcd 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -8,8 +8,10 @@ This guide explains how to build TimeSafari for different platforms using the co ```bash # 🖥️ Web Development -npm run build:web:dev # Start development server with hot reload -npm run build:web:prod # Production build +npm install # setup -- and pkgx.dev `dev` command before this will set environment with npm, etc +npm run build:web:serve -- --test # Start with test endorser server +npm run build:web:dev # Start development server with hot reload with local endorser server +npm run build:web:prod # Production build # 📱 Mobile Development npm run build:ios # iOS build (opens Xcode) @@ -2401,4 +2403,4 @@ All scripts use consistent error handling: --- -**Note**: This documentation is maintained alongside the build system. For the most up-to-date information, refer to the actual script files and Vite configuration files in the repository. \ No newline at end of file +**Note**: This documentation is maintained alongside the build system. For the most up-to-date information, refer to the actual script files and Vite configuration files in the repository. From 24a2dce43e32ef41d849d084acb62551117eaa24 Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Wed, 13 Aug 2025 11:17:08 -0600 Subject: [PATCH 6/8] chore: Bump version and add "-beta". --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6d19bd08..5b40d345 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "timesafari", - "version": "1.0.6", + "version": "1.0.7-beta", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "timesafari", - "version": "1.0.6", + "version": "1.0.7-beta", "dependencies": { "@capacitor-community/electron": "^5.0.1", "@capacitor-community/sqlite": "6.0.2", diff --git a/package.json b/package.json index cd34bc17..53e3f5b0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "timesafari", - "version": "1.0.6", + "version": "1.0.7-beta", "description": "Time Safari Application", "author": { "name": "Time Safari Team" From a221a5c5ed4a385c13bd9db68f207f2472a29166 Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Wed, 13 Aug 2025 12:18:06 -0600 Subject: [PATCH 7/8] feat: Add easier way for test users to register themselves. --- src/libs/endorserServer.ts | 10 +++--- src/router/index.ts | 18 +++++----- src/test/index.ts | 32 ++++++++++++++---- src/views/TestView.vue | 67 ++++++++++++++++++++++++++++++-------- 4 files changed, 92 insertions(+), 35 deletions(-) diff --git a/src/libs/endorserServer.ts b/src/libs/endorserServer.ts index e28b3ac9..735252f7 100644 --- a/src/libs/endorserServer.ts +++ b/src/libs/endorserServer.ts @@ -1348,12 +1348,12 @@ export async function createEndorserJwtVcFromClaim( } /** - * Create a JWT for a RegisterAction claim. + * Create a JWT for a RegisterAction claim, used for registrations & invites. * * @param activeDid - The DID of the user creating the invite - * @param contact - The contact to register, with a 'did' field (all optional for invites) - * @param identifier - The identifier for the invite, usually random - * @param expiresIn - The number of seconds until the invite expires + * @param contact - Optional - The contact to register, with a 'did' field (all optional for invites) + * @param identifier - Optional - The identifier for the invite, usually random + * @param expiresIn - Optional - The number of seconds until the invite expires * @returns The JWT for the RegisterAction claim */ export async function createInviteJwt( @@ -1367,7 +1367,7 @@ export async function createInviteJwt( "@type": "RegisterAction", agent: { identifier: activeDid }, object: SERVICE_ID, - identifier: identifier, + identifier: identifier, // not sent if undefined }; if (contact?.did) { vcClaim.participant = { identifier: contact.did }; diff --git a/src/router/index.ts b/src/router/index.ts index 7d1e738c..043d3d0c 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -82,6 +82,15 @@ const routes: Array = [ name: "database-migration", component: () => import("../views/DatabaseMigration.vue"), }, + { + path: "/deep-link-error", + name: "deep-link-error", + component: () => import("../views/DeepLinkErrorView.vue"), + meta: { + title: "Invalid Deep Link", + requiresAuth: false, + }, + }, { path: "/did/:did?", name: "did", @@ -276,15 +285,6 @@ const routes: Array = [ name: "user-profile", component: () => import("../views/UserProfileView.vue"), }, - { - path: "/deep-link-error", - name: "deep-link-error", - component: () => import("../views/DeepLinkErrorView.vue"), - meta: { - title: "Invalid Deep Link", - requiresAuth: false, - }, - }, ]; const isElectron = window.location.protocol === "file:"; diff --git a/src/test/index.ts b/src/test/index.ts index 28b0e349..8974713b 100644 --- a/src/test/index.ts +++ b/src/test/index.ts @@ -1,9 +1,29 @@ import axios from "axios"; import * as didJwt from "did-jwt"; import { SERVICE_ID } from "../libs/endorserServer"; -import { deriveAddress, newIdentifier } from "../libs/crypto"; +import { + DEFAULT_ROOT_DERIVATION_PATH, + deriveAddress, + newIdentifier, +} from "../libs/crypto"; import { logger } from "../utils/logger"; import { AppString } from "../constants/app"; +import { saveNewIdentity } from "@/libs/util"; +import { PlatformServiceFactory } from "@/services/PlatformServiceFactory"; + +const TEST_USER_0_MNEMONIC = + "rigid shrug mobile smart veteran half all pond toilet brave review universe ship congress found yard skate elite apology jar uniform subway slender luggage"; + +export async function testBecomeUser0() { + const [addr, privateHex, publicHex, deriPath] = deriveAddress(TEST_USER_0_MNEMONIC); + + const identity0 = newIdentifier(addr, publicHex, privateHex, deriPath); + await saveNewIdentity(identity0, TEST_USER_0_MNEMONIC, DEFAULT_ROOT_DERIVATION_PATH); + const platformService = await PlatformServiceFactory.getInstance(); + await platformService.updateDidSpecificSettings(identity0.did, { + isRegistered: true, + }); +} /** * Get User #0 to sign & submit a RegisterAction for the user's activeDid. @@ -15,10 +35,7 @@ import { AppString } from "../constants/app"; * @throws Error if registration fails or database access fails */ export async function testServerRegisterUser() { - const testUser0Mnem = - "seminar accuse mystery assist delay law thing deal image undo guard initial shallow wrestle list fragile borrow velvet tomorrow awake explain test offer control"; - - const [addr, privateHex, publicHex, deriPath] = deriveAddress(testUser0Mnem); + const [addr, privateHex, publicHex, deriPath] = deriveAddress(TEST_USER_0_MNEMONIC); const identity0 = newIdentifier(addr, publicHex, privateHex, deriPath); @@ -32,9 +49,9 @@ export async function testServerRegisterUser() { const vcClaim = { "@context": "https://schema.org", "@type": "RegisterAction", - agent: { did: identity0.did }, + agent: { identifier: identity0.did }, object: SERVICE_ID, - participant: { did: settings.activeDid }, + participant: { identifier: settings.activeDid }, }; // Make a payload for the claim @@ -71,4 +88,5 @@ export async function testServerRegisterUser() { const resp = await axios.post(url, payload, { headers }); logger.log("User registration result:", resp); + return resp; } diff --git a/src/views/TestView.vue b/src/views/TestView.vue index a7592afa..df879ad2 100644 --- a/src/views/TestView.vue +++ b/src/views/TestView.vue @@ -21,7 +21,17 @@

-
+
+

User Registration

+ + +
+ +

Notiwind Alerts

@@ -99,7 +109,7 @@
Register Passkey -
@@ -235,6 +245,7 @@ import { registerAndSavePasskey, SHARED_PHOTO_BASE64_KEY, } from "../libs/util"; +import { testBecomeUser0, testServerRegisterUser } from "@/test"; import { logger } from "../utils/logger"; import { Account } from "../db/tables/accounts"; import { PlatformServiceMixin } from "@/utils/PlatformServiceMixin"; @@ -300,6 +311,7 @@ export default class Help extends Vue { // for passkeys credIdHex?: string; activeDid?: string; + apiServer?: string; jwt?: string; peerSetup?: PeerSetup; userName?: string; @@ -521,17 +533,6 @@ export default class Help extends Vue { ]; } - /** - * Method to trigger notification test - * Centralizes notification testing logic - */ - triggerTestNotification(config: { - notification: NotificationIface; - timeout?: number; - }) { - this.$notify(config.notification, config.timeout); - } - /** * Component initialization * @@ -541,6 +542,7 @@ export default class Help extends Vue { async mounted() { const settings = await this.$accountSettings(); this.activeDid = settings.activeDid || ""; + this.apiServer = settings.apiServer || ""; this.userName = settings.firstName; const account = await retrieveAccountMetadata(this.activeDid); @@ -553,6 +555,43 @@ export default class Help extends Vue { } } + /** + * Checks if running on production server + * + * @returns True if not on production server (enables test utilities) + */ + public isNotProdServer() { + return this.apiServer !== AppString.PROD_ENDORSER_API_SERVER; + } + + async registerMe() { + const response = await testServerRegisterUser(); + if (response.status === 201) { + alert("Registration successful."); + this.$router.push({ name: "home" }); // because this page checks for registered status and sets things if it detects a change + } else { + logger.error("Registration failure response:", response); + alert("Registration failed: " + (response.data.error || response.data)); + } + } + + async becomeUser0() { + await testBecomeUser0(); + alert("You are now User 0."); + this.$router.push({ name: "home" }); // because this page checks for registered status and sets things if it detects a change + } + + /** + * Method to trigger notification test + * Centralizes notification testing logic + */ + triggerTestNotification(config: { + notification: NotificationIface; + timeout?: number; + }) { + this.$notify(config.notification, config.timeout); + } + /** * Handles file upload for image sharing tests * @@ -609,7 +648,7 @@ export default class Help extends Vue { * Includes validation and user confirmation workflow * Uses notification helpers for consistent messaging */ - public async register() { + public async registerPasskey() { const DEFAULT_USERNAME = AppString.APP_NAME + " Tester"; if (!this.userName) { const modalConfig = createPasskeyNameModal( From 81096a8bee0a2be936e8e90fae5e30efb401b73f Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Wed, 13 Aug 2025 18:59:00 -0600 Subject: [PATCH 8/8] doc: Add instructions to become test user, and other README refactors. --- README.md | 36 +++++------------------------------- 1 file changed, 5 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 6d987467..59290d4d 100644 --- a/README.md +++ b/README.md @@ -3,36 +3,9 @@ [Time Safari](https://timesafari.org/) allows people to ease into collaboration: start with expressions of gratitude and expand to crowd-fund with time & money, then record and see the impact of contributions. -## Database Migration Status - -**Current Status**: The application is undergoing a migration from Dexie (IndexedDB) to SQLite using absurd-sql. This migration is in **Phase 2** with a well-defined migration fence in place. - -### Migration Progress -- ✅ **SQLite Database Service**: Fully implemented with absurd-sql -- ✅ **Platform Service Layer**: Unified database interface across platforms -- ✅ **Settings Migration**: Core user settings transferred -- ✅ **Account Migration**: Identity and key management -- 🔄 **Contact Migration**: User contact data (via import interface) -- 📋 **Code Cleanup**: Remove unused Dexie imports - -### Migration Fence -The migration is controlled by a **migration fence** that separates legacy Dexie code from the new SQLite implementation. See [Migration Fence Definition](doc/migration-fence-definition.md) for complete details. - -**Key Points**: -- Legacy Dexie database is disabled by default -- All database operations go through `PlatformServiceMixin` -- Migration tools provide controlled access to both databases -- Clear separation between legacy and new code - -### Migration Documentation -- [Migration Guide](doc/migration-to-wa-sqlite.md) - Complete migration process -- [Migration Fence Definition](doc/migration-fence-definition.md) - Fence boundaries and rules -- [Database Migration Guide](doc/database-migration-guide.md) - User-facing migration tools - ## Roadmap -See [project.task.yaml](project.task.yaml) for current priorities. -(Numbers at the beginning of lines are estimated hours. See [taskyaml.org](https://taskyaml.org/) for details.) +See [ClickUp](https://sharing.clickup.com/9014278710/l/h/8cmnyhp-174/10573fec74e2ba0) for current priorities. ## Setup & Building @@ -42,14 +15,16 @@ Quick start: ```bash npm install -npm run dev +npm run build:web:serve -- --test ``` +To be able to make submissions: go to "profile" (bottom left), go to the bottom and expand "Show Advanced Settings", go to the bottom and to the "Test Page", and finally "Become User 0" to see all the functionality. + See [BUILDING.md](BUILDING.md) for comprehensive build instructions for all platforms (Web, Electron, iOS, Android, Docker). ## Development Database Clearing -TimeSafari provides a simple script-based approach to clear the database for development purposes. +TimeSafari provides a simple script-based approach to clear the local database (not the claim server) for development purposes. ### Quick Usage ```bash @@ -126,7 +101,6 @@ const apiUrl = `${APP_SERVER}/api/claim/123`; ### Documentation -- [Domain Configuration System](docs/domain-configuration.md) - Complete guide - [Constants and Configuration](src/constants/app.ts) - Core constants ## Tests