Fix CORS restrictions and development server configuration

Remove CORS headers to enable universal image support and fix local API server settings.

## Changes

**Remove CORS Headers**
- Remove Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy headers
- Enables images from any domain (Facebook, Medium, arbitrary websites)
- Database falls back to IndexedDB mode (minimal performance impact)

**Fix Local Development Configuration**
- Set LOCAL_ENDORSER_API_SERVER to http://127.0.0.1:3000 (was "/api")
- Create .env.development with local API server config
- Fix ensureCorrectApiServer() method in HomeView.vue
- "Use Local" button now sets proper localhost address

**Fix Settings Cache Issues**
- Add PlatformServiceMixin to AccountViewView.vue
- Disable settings caching to prevent stale data
- Settings changes now apply immediately without browser refresh

## Impact

**Tradeoffs:**
- Lost: ~2x SharedArrayBuffer database performance
- Gained: Universal image support from any domain
- Result: Better user experience, database still fast via IndexedDB

**Files Modified:**
- Configuration: vite.config.*.mts, index.html, .env.development
- Source: constants/app.ts, libs/util.ts, views/*.vue, utils/PlatformServiceMixin.ts

## Rationale

For a community platform, universal image support is more critical than marginal
database performance gains. Users share images from arbitrary websites, making
CORS restrictions incompatible with Time Safari's core mission.
This commit is contained in:
Matthew Raymer
2025-07-04 06:25:25 +00:00
parent 1059aa01a1
commit d823d1ad37
13 changed files with 589 additions and 223 deletions

View File

@@ -1029,6 +1029,7 @@ import {
} from "../libs/util";
import { UserProfile } from "@/libs/partnerServer";
import { logger } from "../utils/logger";
import { PlatformServiceMixin } from "../utils/PlatformServiceMixin";
const inputImportFileNameRef = ref<Blob>();
@@ -1077,6 +1078,7 @@ function extractErrorMessage(error: unknown): string {
UserNameDialog,
DataExportSection,
},
mixins: [PlatformServiceMixin],
})
export default class AccountViewView extends Vue {
$notify!: (notification: NotificationIface, timeout?: number) => void;
@@ -1300,35 +1302,35 @@ export default class AccountViewView extends Vue {
async toggleShowContactAmounts() {
this.showContactGives = !this.showContactGives;
await databaseUtil.updateDefaultSettings({
await this.$saveSettings({
showContactGivesInline: this.showContactGives,
});
}
async toggleShowGeneralAdvanced() {
this.showGeneralAdvanced = !this.showGeneralAdvanced;
await databaseUtil.updateDefaultSettings({
await this.$saveSettings({
showGeneralAdvanced: this.showGeneralAdvanced,
});
}
async toggleProdWarning() {
this.warnIfProdServer = !this.warnIfProdServer;
await databaseUtil.updateDefaultSettings({
await this.$saveSettings({
warnIfProdServer: this.warnIfProdServer,
});
}
async toggleTestWarning() {
this.warnIfTestServer = !this.warnIfTestServer;
await databaseUtil.updateDefaultSettings({
await this.$saveSettings({
warnIfTestServer: this.warnIfTestServer,
});
}
async toggleShowShortcutBvc() {
this.showShortcutBvc = !this.showShortcutBvc;
await databaseUtil.updateDefaultSettings({
await this.$saveSettings({
showShortcutBvc: this.showShortcutBvc,
});
}
@@ -1386,7 +1388,7 @@ export default class AccountViewView extends Vue {
this.$refs.pushNotificationPermission as PushNotificationPermission
).open(DAILY_CHECK_TITLE, async (success: boolean, timeText: string) => {
if (success) {
await databaseUtil.updateDefaultSettings({
await this.$saveSettings({
notifyingNewActivityTime: timeText,
});
this.notifyingNewActivity = true;
@@ -1402,7 +1404,7 @@ export default class AccountViewView extends Vue {
text: "", // unused, only here to satisfy type check
callback: async (success) => {
if (success) {
await databaseUtil.updateDefaultSettings({
await this.$saveSettings({
notifyingNewActivityTime: "",
});
this.notifyingNewActivity = false;
@@ -1446,7 +1448,7 @@ export default class AccountViewView extends Vue {
DIRECT_PUSH_TITLE,
async (success: boolean, timeText: string, message?: string) => {
if (success) {
await databaseUtil.updateDefaultSettings({
await this.$saveSettings({
notifyingReminderMessage: message,
notifyingReminderTime: timeText,
});
@@ -1465,7 +1467,7 @@ export default class AccountViewView extends Vue {
text: "", // unused, only here to satisfy type check
callback: async (success) => {
if (success) {
await databaseUtil.updateDefaultSettings({
await this.$saveSettings({
notifyingReminderMessage: "",
notifyingReminderTime: "",
});
@@ -1482,14 +1484,14 @@ export default class AccountViewView extends Vue {
public async toggleHideRegisterPromptOnNewContact() {
const newSetting = !this.hideRegisterPromptOnNewContact;
await databaseUtil.updateDefaultSettings({
await this.$saveSettings({
hideRegisterPromptOnNewContact: newSetting,
});
this.hideRegisterPromptOnNewContact = newSetting;
}
public async updatePasskeyExpiration() {
await databaseUtil.updateDefaultSettings({
await this.$saveSettings({
passkeyExpirationMinutes: this.passkeyExpirationMinutes,
});
clearPasskeyToken();
@@ -1498,7 +1500,7 @@ export default class AccountViewView extends Vue {
public async turnOffNotifyingFlags() {
// should tell the push server as well
await databaseUtil.updateDefaultSettings({
await this.$saveSettings({
notifyingNewActivityTime: "",
notifyingReminderMessage: "",
notifyingReminderTime: "",