7 Commits

Author SHA1 Message Date
Tola Leng 250f5bd62e Merge pull request #235 from narithum/develop
Add missing maintenance translations
2026-07-17 09:51:25 +07:00
Um Narith c484ac5567 Add missing maintenance translations 2026-07-17 00:38:10 +07:00
Tola Leng e2b20fef2e Merge pull request #224 from sebastiondev/fix/cwe922-pocketbase-authentica-a417
fix(auth): stop persisting PocketBase JWT in localStorage (CWE-922)
2026-05-04 23:01:18 +07:00
Sebastion 03cead6102 fix: avoid localStorage auth persistence 2026-04-30 20:32:20 +01:00
Tola Leng 5ac6f16fb5 Merge pull request #222 from cniry/alpine-icon
Alpine icon
2026-04-13 12:54:27 +07:00
Pavel Sieder 681efc4383 Alpine icon 2026-04-12 18:33:58 +02:00
Tola Leng 8740f35728 Merge pull request #219 from operacle/feature/multi-db-support
add new functionality and improve backend server structure
2026-03-09 17:39:17 +07:00
5 changed files with 45 additions and 27 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

+5 -25
View File
@@ -1,4 +1,4 @@
import PocketBase from 'pocketbase'; import PocketBase, { BaseAuthStore } from 'pocketbase';
// Dynamically detect API base URL from current host (for use in browser) // Dynamically detect API base URL from current host (for use in browser)
const dynamicBaseUrl = const dynamicBaseUrl =
@@ -28,8 +28,9 @@ export const setApiEndpoint = (endpoint: string): void => {
} }
}; };
// Initialize the PocketBase client with the current API URL // Initialize the PocketBase client with an in-memory auth store so auth tokens
export const pb = new PocketBase(getCurrentEndpoint()); // are not persisted in localStorage where XSS can trivially exfiltrate them.
export const pb = new PocketBase(getCurrentEndpoint(), new BaseAuthStore());
// Helper to check if user is authenticated // Helper to check if user is authenticated
export const isAuthenticated = () => { export const isAuthenticated = () => {
@@ -39,28 +40,7 @@ export const isAuthenticated = () => {
// Export the auth store for use in components // Export the auth store for use in components
export const authStore = pb.authStore; export const authStore = pb.authStore;
// Configure PocketBase to persist authentication between page reloads // Remove any auth tokens that may have been persisted by earlier versions.
if (typeof window !== 'undefined') { if (typeof window !== 'undefined') {
const storedAuthData = localStorage.getItem('pocketbase_auth');
if (storedAuthData) {
try {
const parsedData = JSON.parse(storedAuthData);
pb.authStore.save(parsedData.token, parsedData.model);
} catch (error) {
console.error('Failed to parse stored auth data:', error);
localStorage.removeItem('pocketbase_auth'); localStorage.removeItem('pocketbase_auth');
}
}
// Subscribe to authStore changes to persist authentication
pb.authStore.onChange(() => {
if (pb.authStore.isValid) {
localStorage.setItem('pocketbase_auth', JSON.stringify({
token: pb.authStore.token,
model: pb.authStore.model
}));
} else {
localStorage.removeItem('pocketbase_auth');
}
});
} }
@@ -1,3 +1,4 @@
import { MaintenanceTranslations } from '../types/maintenance'; import { MaintenanceTranslations } from '../types/maintenance';
export const maintenanceTranslations: MaintenanceTranslations = { export const maintenanceTranslations: MaintenanceTranslations = {
@@ -77,4 +78,12 @@ export const maintenanceTranslations: MaintenanceTranslations = {
selectNotificationChannel: 'Benachrichtigungskanal hinzufügen', selectNotificationChannel: 'Benachrichtigungskanal hinzufügen',
enableNotificationsFirst: 'Aktivieren Sie zuerst Benachrichtigungen, um einen Kanal auszuwählen', enableNotificationsFirst: 'Aktivieren Sie zuerst Benachrichtigungen, um einen Kanal auszuwählen',
updateMaintenance: 'Wartung aktualisieren', updateMaintenance: 'Wartung aktualisieren',
loginToViewProfile: 'Bitte melden Sie sich an, um Ihr Profil anzuzeigen',
goToLogin: 'Zum Login',
loadingUserData: 'Benutzerdaten werden geladen...',
retry: 'Erneut versuchen',
loadingServerData: 'Serverdaten werden geladen...',
retrievingYourInformation: 'Bitte warten Sie, während wir Ihre Informationen abrufen...',
servicesPagination: '{startItem}-{endItem} von {totalItems} Diensten',
servicesPaginationNoService: '0 Dienste',
}; };
@@ -64,4 +64,25 @@ export const maintenanceTranslations: MaintenanceTranslations = {
noScheduledMaintenance: 'スケジュール済みメンテナンスなし', noScheduledMaintenance: 'スケジュール済みメンテナンスなし',
noMaintenanceWindows: 'この期間にメンテナンスウィンドウはありません。「メンテナンス作成」ボタンをクリックして作成してください。', noMaintenanceWindows: 'この期間にメンテナンスウィンドウはありません。「メンテナンス作成」ボタンをクリックして作成してください。',
maintenanceCreatedSuccess: 'メンテナンスウィンドウが正常に作成されました', maintenanceCreatedSuccess: 'メンテナンスウィンドウが正常に作成されました',
assignedPersonnelDescription: '現在割り当てられているユーザー',
editMaintenanceDesc: 'メンテナンス詳細を編集',
editMaintenanceWindow: 'メンテナンス編集',
enableNotificationsFirst: 'チャンネルを選択するには先に通知を有効にしてください',
goToLogin: 'ログインへ',
impactLevel: '影響レベル',
impactLevelDescription: '影響レベルを選択',
loadingServerData: 'サーバーデータを読み込み中...',
loadingUserData: 'ユーザーデータを読み込み中...',
loginToViewProfile: 'プロフィールを表示するにはログインしてください',
mutedNotifications: '通知が無効になっています',
notificationsAreMuted: 'このメンテナンスでは現在通知がミュートされています',
priorityDescription: 'メンテナンス優先度を選択',
retrievingYourInformation: '情報を取得しています。しばらくお待ちください...',
retry: '再試行',
selectAssignedUsers: '割り当てユーザーを選択',
selectNotificationChannel: '通知チャンネルを追加',
servicesPagination: '{startItem}-{endItem} / {totalItems} サービス',
servicesPaginationNoService: '0 サービス',
statusDescription: 'メンテナンスステータスを選択',
updateMaintenance: 'メンテナンスを更新',
}; };
@@ -78,4 +78,12 @@ export const maintenanceTranslations: MaintenanceTranslations = {
selectNotificationChannel: '알림 채널 추가', selectNotificationChannel: '알림 채널 추가',
enableNotificationsFirst: '채널을 선택하려면 먼저 알림을 활성화하세요', enableNotificationsFirst: '채널을 선택하려면 먼저 알림을 활성화하세요',
updateMaintenance: '유지보수 업데이트', updateMaintenance: '유지보수 업데이트',
goToLogin: '로그인으로 이동',
loadingServerData: '서버 데이터를 불러오는 중...',
loadingUserData: '사용자 데이터를 불러오는 중...',
loginToViewProfile: '프로필을 보려면 로그인하세요',
retrievingYourInformation: '정보를 가져오는 중입니다. 잠시 기다려 주세요...',
retry: '다시 시도',
servicesPagination: '{startItem}-{endItem} / {totalItems} 서비스',
servicesPaginationNoService: '0 서비스',
}; };