mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-22 06:41:46 +00:00
Merge pull request #284 from jubnl/main
This commit is contained in:
@@ -4,6 +4,7 @@ import { useAuthStore } from '../store/authStore'
|
|||||||
import { useSettingsStore } from '../store/settingsStore'
|
import { useSettingsStore } from '../store/settingsStore'
|
||||||
import { SUPPORTED_LANGUAGES, useTranslation } from '../i18n'
|
import { SUPPORTED_LANGUAGES, useTranslation } from '../i18n'
|
||||||
import { authApi } from '../api/client'
|
import { authApi } from '../api/client'
|
||||||
|
import { getApiErrorMessage } from '../types'
|
||||||
import { Plane, Eye, EyeOff, Mail, Lock, MapPin, Calendar, Package, User, Globe, Zap, Users, Wallet, Map, CheckSquare, BookMarked, FolderOpen, Route, Shield, KeyRound } from 'lucide-react'
|
import { Plane, Eye, EyeOff, Mail, Lock, MapPin, Calendar, Package, User, Globe, Zap, Users, Wallet, Map, CheckSquare, BookMarked, FolderOpen, Route, Shield, KeyRound } from 'lucide-react'
|
||||||
|
|
||||||
interface AppConfig {
|
interface AppConfig {
|
||||||
@@ -171,7 +172,7 @@ export default function LoginPage(): React.ReactElement {
|
|||||||
setShowTakeoff(true)
|
setShowTakeoff(true)
|
||||||
setTimeout(() => navigate('/dashboard'), 2600)
|
setTimeout(() => navigate('/dashboard'), 2600)
|
||||||
} catch (err: unknown) {
|
} catch (err: unknown) {
|
||||||
setError(err instanceof Error ? err.message : t('login.error'))
|
setError(getApiErrorMessage(err, t('login.error')))
|
||||||
setIsLoading(false)
|
setIsLoading(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -152,7 +152,7 @@ app.get('/uploads/photos/:filename', (req: Request, res: Response) => {
|
|||||||
jwt.verify(token, process.env.JWT_SECRET || require('./config').JWT_SECRET);
|
jwt.verify(token, process.env.JWT_SECRET || require('./config').JWT_SECRET);
|
||||||
} catch {
|
} catch {
|
||||||
// Check if it's a share token
|
// Check if it's a share token
|
||||||
const shareRow = db.prepare('SELECT id FROM share_tokens WHERE token = ?').get(token);
|
const shareRow = addonDb.prepare('SELECT id FROM share_tokens WHERE token = ?').get(token);
|
||||||
if (!shareRow) return res.status(401).send('Authentication required');
|
if (!shareRow) return res.status(401).send('Authentication required');
|
||||||
}
|
}
|
||||||
res.sendFile(resolved);
|
res.sendFile(resolved);
|
||||||
@@ -203,7 +203,7 @@ app.use('/api/admin', adminRoutes);
|
|||||||
|
|
||||||
// Public addons endpoint (authenticated but not admin-only)
|
// Public addons endpoint (authenticated but not admin-only)
|
||||||
import { authenticate as addonAuth } from './middleware/auth';
|
import { authenticate as addonAuth } from './middleware/auth';
|
||||||
import { db as addonDb } from './db/database';
|
import {db as addonDb} from './db/database';
|
||||||
import { Addon } from './types';
|
import { Addon } from './types';
|
||||||
app.get('/api/addons', addonAuth, (req: Request, res: Response) => {
|
app.get('/api/addons', addonAuth, (req: Request, res: Response) => {
|
||||||
const addons = addonDb.prepare('SELECT id, name, type, icon, enabled FROM addons WHERE enabled = 1 ORDER BY sort_order').all() as Pick<Addon, 'id' | 'name' | 'type' | 'icon' | 'enabled'>[];
|
const addons = addonDb.prepare('SELECT id, name, type, icon, enabled FROM addons WHERE enabled = 1 ORDER BY sort_order').all() as Pick<Addon, 'id' | 'name' | 'type' | 'icon' | 'enabled'>[];
|
||||||
|
|||||||
Reference in New Issue
Block a user