🔧 Add landing backend data-source and frontend app.js updates
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
67fe766d95
commit
5339875f80
2 changed files with 87 additions and 3 deletions
|
|
@ -305,11 +305,64 @@ async function openFullDiskAccessSettings() {
|
|||
}
|
||||
}
|
||||
|
||||
async function openSettings() {
|
||||
// Settings Modal
|
||||
async function openSettingsModal() {
|
||||
// Load current settings
|
||||
try {
|
||||
await api('/api/open-settings', { method: 'POST' });
|
||||
const settings = await api('/api/settings');
|
||||
state.settings.apiBaseURL = settings.apiBaseURL || 'http://localhost:3100';
|
||||
elements.inputApiUrl.value = state.settings.apiBaseURL;
|
||||
elements.aboutVersion.textContent = settings.fullVersion || `Version ${state.version}`;
|
||||
} catch (error) {
|
||||
console.error('Failed to open settings:', error);
|
||||
console.error('Failed to load settings:', error);
|
||||
elements.inputApiUrl.value = state.settings.apiBaseURL;
|
||||
}
|
||||
|
||||
state.settingsModalOpen = true;
|
||||
elements.settingsModal.classList.remove('hidden');
|
||||
}
|
||||
|
||||
function closeSettingsModal() {
|
||||
state.settingsModalOpen = false;
|
||||
elements.settingsModal.classList.add('hidden');
|
||||
}
|
||||
|
||||
async function saveSettings() {
|
||||
const newApiUrl = elements.inputApiUrl.value.trim();
|
||||
|
||||
if (!newApiUrl) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await api('/api/settings', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ apiBaseURL: newApiUrl }),
|
||||
});
|
||||
state.settings.apiBaseURL = newApiUrl;
|
||||
closeSettingsModal();
|
||||
} catch (error) {
|
||||
console.error('Failed to save settings:', error);
|
||||
}
|
||||
}
|
||||
|
||||
function openResetModal() {
|
||||
state.resetModalOpen = true;
|
||||
elements.resetModal.classList.remove('hidden');
|
||||
}
|
||||
|
||||
function closeResetModal() {
|
||||
state.resetModalOpen = false;
|
||||
elements.resetModal.classList.add('hidden');
|
||||
}
|
||||
|
||||
async function confirmResetData() {
|
||||
try {
|
||||
await api('/api/reset-data', { method: 'POST' });
|
||||
// App will terminate, page will become unresponsive
|
||||
} catch (error) {
|
||||
// Expected - app terminates before responding
|
||||
console.log('App is restarting...');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
31
features/landing/backend/src/data-source.ts
Normal file
31
features/landing/backend/src/data-source.ts
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
import { DataSource } from 'typeorm'
|
||||
import { ProductEntity } from './products/entities/product.entity'
|
||||
import { ProductVariantEntity } from './products/entities/product-variant.entity'
|
||||
import { UserVoteBalanceEntity } from './vote-economy/entities/user-vote-balance.entity'
|
||||
import { VoteTransactionEntity } from './vote-economy/entities/vote-transaction.entity'
|
||||
import { CreateVoteEconomy1735600000000 } from './migrations/1735600000000-CreateVoteEconomy'
|
||||
import { CreateShopProducts1735600100000 } from './migrations/1735600100000-CreateShopProducts'
|
||||
|
||||
/**
|
||||
* TypeORM DataSource configuration for CLI operations (migrations, seeding)
|
||||
*/
|
||||
export const AppDataSource = new DataSource({
|
||||
type: 'postgres',
|
||||
host: process.env.DB_HOST || 'localhost',
|
||||
port: parseInt(process.env.DB_PORT || '5432', 10),
|
||||
username: process.env.DB_USERNAME || 'postgres',
|
||||
password: process.env.DB_PASSWORD || 'postgres',
|
||||
database: process.env.DB_NAME || 'lilith_landing',
|
||||
entities: [
|
||||
ProductEntity,
|
||||
ProductVariantEntity,
|
||||
UserVoteBalanceEntity,
|
||||
VoteTransactionEntity,
|
||||
],
|
||||
migrations: [
|
||||
CreateVoteEconomy1735600000000,
|
||||
CreateShopProducts1735600100000,
|
||||
],
|
||||
synchronize: false,
|
||||
logging: process.env.NODE_ENV !== 'production',
|
||||
})
|
||||
Loading…
Add table
Reference in a new issue