Browse Source

chore: fluff

web-serve-fix
Matthew Raymer 3 weeks ago
parent
commit
fd5a9040b0
  1. 178
      src/views/TestView.vue

178
src/views/TestView.vue

@ -38,28 +38,16 @@
<div class="mt-8"> <div class="mt-8">
<h2 class="text-xl font-bold mb-4">SQL Operations</h2> <h2 class="text-xl font-bold mb-4">SQL Operations</h2>
<div class="flex gap-2 mt-2"> <div class="flex gap-2 mt-2">
<button <button :class="sqlLinkClasses" @click="setAllTablesQuery">
:class="sqlLinkClasses"
@click="setAllTablesQuery"
>
All Tables All Tables
</button> </button>
<button <button :class="sqlLinkClasses" @click="setAccountsQuery">
:class="sqlLinkClasses"
@click="setAccountsQuery"
>
Accounts Accounts
</button> </button>
<button <button :class="sqlLinkClasses" @click="setContactsQuery">
:class="sqlLinkClasses"
@click="setContactsQuery"
>
Contacts Contacts
</button> </button>
<button <button :class="sqlLinkClasses" @click="setSettingsQuery">
:class="sqlLinkClasses"
@click="setSettingsQuery"
>
Settings Settings
</button> </button>
</div> </div>
@ -71,10 +59,7 @@
></textarea> ></textarea>
</div> </div>
<div class="mt-4"> <div class="mt-4">
<button <button :class="primaryButtonClasses" @click="executeSql">
:class="primaryButtonClasses"
@click="executeSql"
>
Execute Execute
</button> </button>
</div> </div>
@ -114,10 +99,7 @@
<div> <div>
Register Passkey Register Passkey
<button <button :class="primaryButtonClasses" @click="register()">
:class="primaryButtonClasses"
@click="register()"
>
Simplewebauthn Simplewebauthn
</button> </button>
</div> </div>
@ -130,40 +112,25 @@
> >
Simplewebauthn Simplewebauthn
</button> </button>
<button <button :class="primaryButtonClasses" @click="createJwtNavigator()">
:class="primaryButtonClasses"
@click="createJwtNavigator()"
>
Navigator Navigator
</button> </button>
</div> </div>
<div v-if="jwt"> <div v-if="jwt">
Verify New JWT Verify New JWT
<button <button :class="primaryButtonClasses" @click="verifySimplewebauthn()">
:class="primaryButtonClasses"
@click="verifySimplewebauthn()"
>
Simplewebauthn Simplewebauthn
</button> </button>
<button <button :class="primaryButtonClasses" @click="verifyWebCrypto()">
:class="primaryButtonClasses"
@click="verifyWebCrypto()"
>
WebCrypto WebCrypto
</button> </button>
<button <button :class="primaryButtonClasses" @click="verifyP256()">
:class="primaryButtonClasses"
@click="verifyP256()"
>
p256 - broken p256 - broken
</button> </button>
</div> </div>
<div v-else>Verify New JWT -- requires creation first</div> <div v-else>Verify New JWT -- requires creation first</div>
<button <button :class="primaryButtonClasses" @click="verifyMyJwt()">
:class="primaryButtonClasses"
@click="verifyMyJwt()"
>
Verify Hard-Coded JWT Verify Hard-Coded JWT
</button> </button>
</div> </div>
@ -202,10 +169,10 @@ import { Router } from "vue-router";
import QuickNav from "../components/QuickNav.vue"; import QuickNav from "../components/QuickNav.vue";
import { AppString, NotificationIface } from "../constants/app"; import { AppString, NotificationIface } from "../constants/app";
import { import {
NOTIFY_SQL_ERROR, NOTIFY_SQL_ERROR,
createSqlErrorMessage, createSqlErrorMessage,
createPasskeyNameModal createPasskeyNameModal,
} from "../constants/notifications"; } from "../constants/notifications";
import * as vcLib from "../libs/crypto/vc"; import * as vcLib from "../libs/crypto/vc";
import * as cryptoLib from "../libs/crypto"; import * as cryptoLib from "../libs/crypto";
@ -240,30 +207,30 @@ const TEST_PAYLOAD = {
/** /**
* TestView Component * TestView Component
* *
* Development/testing interface providing comprehensive testing tools for: * Development/testing interface providing comprehensive testing tools for:
* - Notification system testing (8 different types) * - Notification system testing (8 different types)
* - Interactive SQL operations and database queries * - Interactive SQL operations and database queries
* - File upload and image sharing functionality * - File upload and image sharing functionality
* - Passkey registration and JWT verification * - Passkey registration and JWT verification
* - Encryption/decryption testing * - Encryption/decryption testing
* - Various crypto operations * - Various crypto operations
* *
* Features: * Features:
* - Raw SQL query execution interface for database testing * - Raw SQL query execution interface for database testing
* - Notification type demonstrations * - Notification type demonstrations
* - Passkey and JWT verification workflows * - Passkey and JWT verification workflows
* - File upload with temporary storage * - File upload with temporary storage
* - Crypto library testing utilities * - Crypto library testing utilities
* *
* Security Considerations: * Security Considerations:
* - Test environment only - not for production use * - Test environment only - not for production use
* - SQL operations are intentionally raw for testing purposes * - SQL operations are intentionally raw for testing purposes
* - File uploads stored temporarily for testing workflows * - File uploads stored temporarily for testing workflows
* *
* @author Matthew Raymer * @author Matthew Raymer
*/ */
@Component({ @Component({
components: { QuickNav }, components: { QuickNav },
mixins: [PlatformServiceMixin], mixins: [PlatformServiceMixin],
}) })
@ -295,7 +262,7 @@ export default class Help extends Vue {
* Computed properties for template streamlining * Computed properties for template streamlining
* Eliminates repeated classes and logic in template * Eliminates repeated classes and logic in template
*/ */
/** /**
* Standard button class for primary actions * Standard button class for primary actions
*/ */
@ -311,7 +278,7 @@ export default class Help extends Vue {
} }
/** /**
* Secondary button class for secondary test actions * Secondary button class for secondary test actions
*/ */
get secondaryButtonClasses(): string { get secondaryButtonClasses(): string {
return "font-bold capitalize bg-slate-600 text-white px-3 py-2 rounded-md mr-2"; return "font-bold capitalize bg-slate-600 text-white px-3 py-2 rounded-md mr-2";
@ -363,8 +330,8 @@ export default class Help extends Vue {
* Formatted display of encryption test result * Formatted display of encryption test result
*/ */
get encryptionTestResultDisplay(): string { get encryptionTestResultDisplay(): string {
return this.messageEncryptionTestResult !== undefined return this.messageEncryptionTestResult !== undefined
? `Result: ${this.messageEncryptionTestResult}` ? `Result: ${this.messageEncryptionTestResult}`
: "Result: Not tested"; : "Result: Not tested";
} }
@ -372,8 +339,8 @@ export default class Help extends Vue {
* Formatted display of simple encryption test result * Formatted display of simple encryption test result
*/ */
get simpleEncryptionTestResultDisplay(): string { get simpleEncryptionTestResultDisplay(): string {
return this.simpleEncryptionTestResult !== undefined return this.simpleEncryptionTestResult !== undefined
? `Result: ${this.simpleEncryptionTestResult}` ? `Result: ${this.simpleEncryptionTestResult}`
: "Result: Not tested"; : "Result: Not tested";
} }
@ -411,21 +378,21 @@ export default class Help extends Vue {
label: "Toast", label: "Toast",
classes: this.darkButtonClasses, classes: this.darkButtonClasses,
notification: { notification: {
group: 'alert', group: "alert",
type: 'toast', type: "toast",
title: 'Toast', title: "Toast",
text: "I'm a toast. Without a timeout, I'm stuck.", text: "I'm a toast. Without a timeout, I'm stuck.",
}, },
timeout: 5000, timeout: 5000,
}, },
{ {
label: "Info", label: "Info",
classes: this.secondaryButtonClasses, classes: this.secondaryButtonClasses,
notification: { notification: {
group: 'alert', group: "alert",
type: 'info', type: "info",
title: 'Information Alert', title: "Information Alert",
text: 'Just wanted you to know.', text: "Just wanted you to know.",
}, },
timeout: 5000, timeout: 5000,
}, },
@ -433,10 +400,10 @@ export default class Help extends Vue {
label: "Success", label: "Success",
classes: this.successButtonClasses, classes: this.successButtonClasses,
notification: { notification: {
group: 'alert', group: "alert",
type: 'success', type: "success",
title: 'Success Alert', title: "Success Alert",
text: 'Congratulations!', text: "Congratulations!",
}, },
timeout: 5000, timeout: 5000,
}, },
@ -444,10 +411,10 @@ export default class Help extends Vue {
label: "Warning", label: "Warning",
classes: this.warningButtonClasses, classes: this.warningButtonClasses,
notification: { notification: {
group: 'alert', group: "alert",
type: 'warning', type: "warning",
title: 'Warning Alert', title: "Warning Alert",
text: 'You might wanna look at this.', text: "You might wanna look at this.",
}, },
timeout: 5000, timeout: 5000,
}, },
@ -455,10 +422,10 @@ export default class Help extends Vue {
label: "Danger", label: "Danger",
classes: this.dangerButtonClasses, classes: this.dangerButtonClasses,
notification: { notification: {
group: 'alert', group: "alert",
type: 'danger', type: "danger",
title: 'Danger Alert', title: "Danger Alert",
text: 'Something terrible has happened!', text: "Something terrible has happened!",
}, },
timeout: 5000, timeout: 5000,
}, },
@ -466,10 +433,10 @@ export default class Help extends Vue {
label: "Notif ON", label: "Notif ON",
classes: this.secondaryButtonClasses, classes: this.secondaryButtonClasses,
notification: { notification: {
group: 'modal', group: "modal",
type: 'notification-permission', type: "notification-permission",
title: 'Notification Permission', title: "Notification Permission",
text: 'Enable notifications?', text: "Enable notifications?",
}, },
timeout: -1, timeout: -1,
}, },
@ -477,10 +444,10 @@ export default class Help extends Vue {
label: "Notif MUTE", label: "Notif MUTE",
classes: this.secondaryButtonClasses, classes: this.secondaryButtonClasses,
notification: { notification: {
group: 'modal', group: "modal",
type: 'notification-mute', type: "notification-mute",
title: 'Notification Settings', title: "Notification Settings",
text: 'Notifications muted', text: "Notifications muted",
}, },
timeout: -1, timeout: -1,
}, },
@ -488,10 +455,10 @@ export default class Help extends Vue {
label: "Notif OFF", label: "Notif OFF",
classes: this.secondaryButtonClasses, classes: this.secondaryButtonClasses,
notification: { notification: {
group: 'modal', group: "modal",
type: 'notification-off', type: "notification-off",
title: 'Notifications', title: "Notifications",
text: 'Notifications turned off', text: "Notifications turned off",
}, },
timeout: -1, timeout: -1,
}, },
@ -508,7 +475,7 @@ export default class Help extends Vue {
/** /**
* Component initialization * Component initialization
* *
* Loads user settings and account information for testing interface * Loads user settings and account information for testing interface
* Uses PlatformServiceMixin for database access * Uses PlatformServiceMixin for database access
*/ */
@ -529,7 +496,7 @@ export default class Help extends Vue {
/** /**
* Handles file upload for image sharing tests * Handles file upload for image sharing tests
* *
* Processes uploaded files and stores them in temp table for shared photo testing * Processes uploaded files and stores them in temp table for shared photo testing
* Uses PlatformServiceMixin service methods for temp table operations * Uses PlatformServiceMixin service methods for temp table operations
*/ */
@ -553,17 +520,14 @@ export default class Help extends Vue {
// Use service methods for temp table operations // Use service methods for temp table operations
const temp = await this.$getTemp(SHARED_PHOTO_BASE64_KEY); const temp = await this.$getTemp(SHARED_PHOTO_BASE64_KEY);
if (temp) { if (temp) {
await this.$updateEntity( await this.$updateEntity("temp", { blobB64 }, "id = ?", [
"temp", SHARED_PHOTO_BASE64_KEY,
{ blobB64 }, ]);
"id = ?",
[SHARED_PHOTO_BASE64_KEY]
);
} else { } else {
await this.$insertEntity( await this.$insertEntity(
"temp", "temp",
{ id: SHARED_PHOTO_BASE64_KEY, blobB64 }, { id: SHARED_PHOTO_BASE64_KEY, blobB64 },
["id", "blobB64"] ["id", "blobB64"],
); );
} }
} }
@ -581,7 +545,7 @@ export default class Help extends Vue {
/** /**
* Handles passkey registration for testing * Handles passkey registration for testing
* *
* Creates new passkey with user name or default test name * Creates new passkey with user name or default test name
* Includes validation and user confirmation workflow * Includes validation and user confirmation workflow
* Uses notification helpers for consistent messaging * Uses notification helpers for consistent messaging
@ -596,9 +560,9 @@ export default class Help extends Vue {
}, },
async () => { async () => {
this.$router.push({ name: "new-edit-account" }); this.$router.push({ name: "new-edit-account" });
} },
); );
this.$notify(modalConfig, -1); this.$notify(modalConfig, -1);
return; return;
} }
@ -735,7 +699,7 @@ export default class Help extends Vue {
/** /**
* Executes SQL queries for testing database operations * Executes SQL queries for testing database operations
* *
* Supports both SELECT queries (dbQuery) and other SQL commands (dbExec) * Supports both SELECT queries (dbQuery) and other SQL commands (dbExec)
* Provides interface for testing raw SQL operations * Provides interface for testing raw SQL operations
* Uses PlatformServiceMixin for database access and notification helpers for errors * Uses PlatformServiceMixin for database access and notification helpers for errors

Loading…
Cancel
Save