Browse Source

Fix GitHub backup requiring cloud login and backup log timestamps (#655)

  - Remove Bambu Cloud authentication gate from GitHub backup settings card.
    K-profiles and app settings backup work without cloud login; the Cloud
    Profiles checkbox is disabled with a hint when not authenticated.
  - Fix backup log timestamps showing UTC instead of local time by using
    the shared parseUTCDate utility for correct timezone conversion.
maziggy 2 months ago
parent
commit
c5269b5b0c

+ 2 - 9
CHANGELOG.md

@@ -6,20 +6,13 @@ All notable changes to Bambuddy will be documented in this file.
 
 
 ### New Features
 ### New Features
 - **Virtual Printer Queue Auto-Dispatch Toggle** ([#587](https://github.com/maziggy/bambuddy/issues/587)) — Added an "Auto-dispatch" toggle to virtual printers in Queue mode. When enabled (default), prints sent from the slicer are added to the queue and start automatically on the assigned printer — matching the current behavior. When disabled, prints are added to the queue with `manual_start` set, so they wait for manual dispatch. This allows users who want to review and manually assign prints before they start. Requested by @Percy2Live.
 - **Virtual Printer Queue Auto-Dispatch Toggle** ([#587](https://github.com/maziggy/bambuddy/issues/587)) — Added an "Auto-dispatch" toggle to virtual printers in Queue mode. When enabled (default), prints sent from the slicer are added to the queue and start automatically on the assigned printer — matching the current behavior. When disabled, prints are added to the queue with `manual_start` set, so they wait for manual dispatch. This allows users who want to review and manually assign prints before they start. Requested by @Percy2Live.
-<<<<<<< HEAD
-<<<<<<< HEAD
-=======
->>>>>>> 7934262 (  Add queue-all-plates and fix clear plate prompt for staged items (#530))
 - **Queue All Plates** ([#530](https://github.com/maziggy/bambuddy/issues/530)) — Multi-plate 3MF files can now be queued in one action. When adding a multi-plate file to the queue, a "Queue All N Plates" toggle appears in the plate selector. When activated, every plate is added as a separate queue entry (one per plate × per selected printer), each individually editable from the queue page. The toggle is only available in add-to-queue mode (not reprint or edit). Requested by @Dendrowen.
 - **Queue All Plates** ([#530](https://github.com/maziggy/bambuddy/issues/530)) — Multi-plate 3MF files can now be queued in one action. When adding a multi-plate file to the queue, a "Queue All N Plates" toggle appears in the plate selector. When activated, every plate is added as a separate queue entry (one per plate × per selected printer), each individually editable from the queue page. The toggle is only available in add-to-queue mode (not reprint or edit). Requested by @Dendrowen.
 
 
 ### Fixed
 ### Fixed
 - **Clear Plate Prompt Shown for Staged Queue Items** — The "Clear Plate & Start Next" button on the printer card appeared when all pending queue items were staged (`manual_start`/Queue Only), even though the scheduler won't auto-start them. The clear plate prompt now only appears when there are auto-dispatchable items that the scheduler will actually start after the plate is cleared.
 - **Clear Plate Prompt Shown for Staged Queue Items** — The "Clear Plate & Start Next" button on the printer card appeared when all pending queue items were staged (`manual_start`/Queue Only), even though the scheduler won't auto-start them. The clear plate prompt now only appears when there are auto-dispatchable items that the scheduler will actually start after the plate is cleared.
-<<<<<<< HEAD
 - **Ethernet Badge Always Shown on Printer Cards** — The printer card network badge always showed "Ethernet" instead of the WiFi signal indicator, even on printers without an ethernet port. The `home_flag` bit 18 was incorrectly interpreted as indicating a wired connection. Removed the faulty ethernet detection; the WiFi signal badge now displays correctly when the printer reports signal strength.
 - **Ethernet Badge Always Shown on Printer Cards** — The printer card network badge always showed "Ethernet" instead of the WiFi signal indicator, even on printers without an ethernet port. The `home_flag` bit 18 was incorrectly interpreted as indicating a wired connection. Removed the faulty ethernet detection; the WiFi signal badge now displays correctly when the printer reports signal strength.
-=======
->>>>>>> 319aeae (  Add auto-dispatch toggle for virtual printer queue mode (#587))
-=======
->>>>>>> 7934262 (  Add queue-all-plates and fix clear plate prompt for staged items (#530))
+- **GitHub Backup Required Cloud Login** ([#655](https://github.com/maziggy/bambuddy/issues/655)) — The GitHub backup settings card was completely blocked behind Bambu Cloud authentication, showing "Bambu Cloud login required" even though the backup feature works without it (K-profiles and app settings don't need cloud). Removed the cloud auth gate so GitHub backup can be configured and used without Bambu Cloud. The "Cloud Profiles" checkbox is disabled with a hint when not logged in. Reported by @TravisWilder.
+- **GitHub Backup Log Timestamps Off by 1 Hour** — Backup log timestamps in the history table were displayed in UTC instead of the user's local timezone. The local `formatDateTime` function didn't use `parseUTCDate`, so timezone-less timestamps from SQLite were interpreted as local time. Now uses the shared `parseUTCDate` utility for correct UTC-to-local conversion.
 
 
 ## [0.2.2b3] - Unreleased
 ## [0.2.2b3] - Unreleased
 
 

+ 14 - 17
frontend/src/components/GitHubBackupSettings.tsx

@@ -35,11 +35,12 @@ import { Button } from './Button';
 import { Toggle } from './Toggle';
 import { Toggle } from './Toggle';
 import { ConfirmModal } from './ConfirmModal';
 import { ConfirmModal } from './ConfirmModal';
 import { useToast } from '../contexts/ToastContext';
 import { useToast } from '../contexts/ToastContext';
-import { formatRelativeTime } from '../utils/date';
+import { formatRelativeTime, parseUTCDate } from '../utils/date';
 
 
 function formatDateTime(dateStr: string | null): string {
 function formatDateTime(dateStr: string | null): string {
   if (!dateStr) return '-';
   if (!dateStr) return '-';
-  const date = new Date(dateStr);
+  const date = parseUTCDate(dateStr);
+  if (!date) return '-';
   return date.toLocaleString();
   return date.toLocaleString();
 }
 }
 
 
@@ -383,7 +384,7 @@ export function GitHubBackupSettings() {
                 <Github className="w-5 h-5 text-gray-400" />
                 <Github className="w-5 h-5 text-gray-400" />
                 <h2 className="text-lg font-semibold text-white">{t('backup.githubBackup')}</h2>
                 <h2 className="text-lg font-semibold text-white">{t('backup.githubBackup')}</h2>
               </div>
               </div>
-              {config && cloudStatus?.is_authenticated && (
+              {config && (
                 <div className="flex items-center gap-2">
                 <div className="flex items-center gap-2">
                   <span className="text-sm text-bambu-gray">{t('backup.enabled')}</span>
                   <span className="text-sm text-bambu-gray">{t('backup.enabled')}</span>
                   <Toggle
                   <Toggle
@@ -395,16 +396,6 @@ export function GitHubBackupSettings() {
             </div>
             </div>
           </CardHeader>
           </CardHeader>
           <CardContent className="space-y-4">
           <CardContent className="space-y-4">
-            {/* Bambu Cloud required message */}
-            {!cloudStatus?.is_authenticated ? (
-              <div className="flex items-start gap-2 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg">
-                <AlertTriangle className="w-4 h-4 text-yellow-400 mt-0.5 flex-shrink-0" />
-                <p className="text-sm text-yellow-400">
-                  {t('backup.cloudLoginRequired')}
-                </p>
-              </div>
-            ) : (
-              <>
                 <p className="text-sm text-bambu-gray">
                 <p className="text-sm text-bambu-gray">
                   {t('backup.githubDescription')}
                   {t('backup.githubDescription')}
                 </p>
                 </p>
@@ -505,7 +496,7 @@ export function GitHubBackupSettings() {
                     <p className="text-xs text-bambu-gray">{t('backup.kProfilesDescription')}</p>
                     <p className="text-xs text-bambu-gray">{t('backup.kProfilesDescription')}</p>
                   </div>
                   </div>
                 </label>
                 </label>
-                <label className="flex items-start gap-2 cursor-pointer">
+                <label className={`flex items-start gap-2 ${!cloudStatus?.is_authenticated ? 'cursor-not-allowed opacity-60' : 'cursor-pointer'}`}>
                   <input
                   <input
                     type="checkbox"
                     type="checkbox"
                     checked={backupCloudProfiles}
                     checked={backupCloudProfiles}
@@ -514,7 +505,15 @@ export function GitHubBackupSettings() {
                     disabled={!cloudStatus?.is_authenticated}
                     disabled={!cloudStatus?.is_authenticated}
                   />
                   />
                   <div>
                   <div>
-                    <span className={`text-sm ${cloudStatus?.is_authenticated ? 'text-white' : 'text-bambu-gray'}`}>{t('backup.cloudProfiles')}</span>
+                    <div className="flex items-center gap-2">
+                      <span className={`text-sm ${cloudStatus?.is_authenticated ? 'text-white' : 'text-bambu-gray'}`}>{t('backup.cloudProfiles')}</span>
+                      {!cloudStatus?.is_authenticated && (
+                        <span className="inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs bg-yellow-500/20 text-yellow-400">
+                          <AlertTriangle className="w-3 h-3" />
+                          {t('backup.cloudLoginRequiredShort')}
+                        </span>
+                      )}
+                    </div>
                     <p className="text-xs text-bambu-gray">{t('backup.cloudProfilesDescription')}</p>
                     <p className="text-xs text-bambu-gray">{t('backup.cloudProfilesDescription')}</p>
                   </div>
                   </div>
                 </label>
                 </label>
@@ -621,8 +620,6 @@ export function GitHubBackupSettings() {
                 )}
                 )}
               </div>
               </div>
             </div>
             </div>
-              </>
-            )}
           </CardContent>
           </CardContent>
         </Card>
         </Card>
 
 

+ 1 - 0
frontend/src/i18n/locales/de.ts

@@ -3047,6 +3047,7 @@ export default {
     githubBackup: 'GitHub Backup',
     githubBackup: 'GitHub Backup',
     enabled: 'Aktiviert',
     enabled: 'Aktiviert',
     cloudLoginRequired: 'Bambu Cloud Login erforderlich. Melden Sie sich unter Profile → Cloud-Profile an, um GitHub-Backup zu aktivieren.',
     cloudLoginRequired: 'Bambu Cloud Login erforderlich. Melden Sie sich unter Profile → Cloud-Profile an, um GitHub-Backup zu aktivieren.',
+    cloudLoginRequiredShort: 'Cloud-Login erforderlich',
     githubDescription: 'Synchronisieren Sie Ihre Profile automatisch mit einem privaten GitHub-Repository für Backup und Versionsverlauf.',
     githubDescription: 'Synchronisieren Sie Ihre Profile automatisch mit einem privaten GitHub-Repository für Backup und Versionsverlauf.',
     repositoryUrl: 'Repository-URL',
     repositoryUrl: 'Repository-URL',
     personalAccessToken: 'Persönlicher Zugriffstoken',
     personalAccessToken: 'Persönlicher Zugriffstoken',

+ 1 - 0
frontend/src/i18n/locales/en.ts

@@ -3051,6 +3051,7 @@ export default {
     githubBackup: 'GitHub Backup',
     githubBackup: 'GitHub Backup',
     enabled: 'Enabled',
     enabled: 'Enabled',
     cloudLoginRequired: 'Bambu Cloud login required. Sign in under Profiles → Cloud Profiles to enable GitHub backup.',
     cloudLoginRequired: 'Bambu Cloud login required. Sign in under Profiles → Cloud Profiles to enable GitHub backup.',
+    cloudLoginRequiredShort: 'Cloud login required',
     githubDescription: 'Automatically sync your profiles to a private GitHub repository for backup and version history.',
     githubDescription: 'Automatically sync your profiles to a private GitHub repository for backup and version history.',
     repositoryUrl: 'Repository URL',
     repositoryUrl: 'Repository URL',
     personalAccessToken: 'Personal Access Token',
     personalAccessToken: 'Personal Access Token',

+ 1 - 0
frontend/src/i18n/locales/fr.ts

@@ -3038,6 +3038,7 @@ export default {
     githubBackup: 'Sauvegarde GitHub',
     githubBackup: 'Sauvegarde GitHub',
     enabled: 'Activé',
     enabled: 'Activé',
     cloudLoginRequired: 'Connexion Bambu Cloud requise. Connectez-vous sous Profils → Profils Cloud pour activer la sauvegarde GitHub.',
     cloudLoginRequired: 'Connexion Bambu Cloud requise. Connectez-vous sous Profils → Profils Cloud pour activer la sauvegarde GitHub.',
+    cloudLoginRequiredShort: 'Connexion Cloud requise',
     githubDescription: 'Synchronisez automatiquement vos profils vers un dépôt GitHub privé pour la sauvegarde et l\'historique des versions.',
     githubDescription: 'Synchronisez automatiquement vos profils vers un dépôt GitHub privé pour la sauvegarde et l\'historique des versions.',
     repositoryUrl: 'URL du dépôt',
     repositoryUrl: 'URL du dépôt',
     personalAccessToken: 'Jeton d\'accès personnel',
     personalAccessToken: 'Jeton d\'accès personnel',

+ 1 - 0
frontend/src/i18n/locales/it.ts

@@ -3037,6 +3037,7 @@ export default {
     githubBackup: 'Backup GitHub',
     githubBackup: 'Backup GitHub',
     enabled: 'Abilitato',
     enabled: 'Abilitato',
     cloudLoginRequired: 'Accesso Bambu Cloud richiesto. Accedi in Profili → Profili Cloud per abilitare il backup GitHub.',
     cloudLoginRequired: 'Accesso Bambu Cloud richiesto. Accedi in Profili → Profili Cloud per abilitare il backup GitHub.',
+    cloudLoginRequiredShort: 'Accesso Cloud richiesto',
     githubDescription: 'Sincronizza automaticamente i tuoi profili con un repository GitHub privato per backup e cronologia delle versioni.',
     githubDescription: 'Sincronizza automaticamente i tuoi profili con un repository GitHub privato per backup e cronologia delle versioni.',
     repositoryUrl: 'URL del repository',
     repositoryUrl: 'URL del repository',
     personalAccessToken: 'Token di accesso personale',
     personalAccessToken: 'Token di accesso personale',

+ 1 - 0
frontend/src/i18n/locales/ja.ts

@@ -3051,6 +3051,7 @@ export default {
     githubBackup: 'GitHubバックアップ',
     githubBackup: 'GitHubバックアップ',
     enabled: '有効',
     enabled: '有効',
     cloudLoginRequired: 'Bambu Cloudログインが必要です。GitHubバックアップを有効にするには、プロファイル → クラウドプロファイルからサインインしてください。',
     cloudLoginRequired: 'Bambu Cloudログインが必要です。GitHubバックアップを有効にするには、プロファイル → クラウドプロファイルからサインインしてください。',
+    cloudLoginRequiredShort: 'Cloudログインが必要',
     githubDescription: 'プロファイルをプライベートGitHubリポジトリに自動的に同期し、バックアップとバージョン履歴を保持します。',
     githubDescription: 'プロファイルをプライベートGitHubリポジトリに自動的に同期し、バックアップとバージョン履歴を保持します。',
     repositoryUrl: 'リポジトリURL',
     repositoryUrl: 'リポジトリURL',
     personalAccessToken: '個人アクセストークン',
     personalAccessToken: '個人アクセストークン',

+ 1 - 0
frontend/src/i18n/locales/pt-BR.ts

@@ -3037,6 +3037,7 @@ export default {
     githubBackup: 'Backup GitHub',
     githubBackup: 'Backup GitHub',
     enabled: 'Ativado',
     enabled: 'Ativado',
     cloudLoginRequired: 'Login no Bambu Cloud necessário. Entre em Perfis → Perfis Cloud para ativar o backup GitHub.',
     cloudLoginRequired: 'Login no Bambu Cloud necessário. Entre em Perfis → Perfis Cloud para ativar o backup GitHub.',
+    cloudLoginRequiredShort: 'Login Cloud necessário',
     githubDescription: 'Sincronize automaticamente seus perfis com um repositório GitHub privado para backup e histórico de versões.',
     githubDescription: 'Sincronize automaticamente seus perfis com um repositório GitHub privado para backup e histórico de versões.',
     repositoryUrl: 'URL do repositório',
     repositoryUrl: 'URL do repositório',
     personalAccessToken: 'Token de acesso pessoal',
     personalAccessToken: 'Token de acesso pessoal',

+ 1 - 0
frontend/src/i18n/locales/zh-CN.ts

@@ -3037,6 +3037,7 @@ export default {
     githubBackup: 'GitHub 备份',
     githubBackup: 'GitHub 备份',
     enabled: '已启用',
     enabled: '已启用',
     cloudLoginRequired: '需要登录 Bambu Cloud。请在 配置文件 → 云配置文件 中登录以启用 GitHub 备份。',
     cloudLoginRequired: '需要登录 Bambu Cloud。请在 配置文件 → 云配置文件 中登录以启用 GitHub 备份。',
+    cloudLoginRequiredShort: '需要Cloud登录',
     githubDescription: '自动将您的配置文件同步到私有 GitHub 仓库以进行备份和版本历史记录。',
     githubDescription: '自动将您的配置文件同步到私有 GitHub 仓库以进行备份和版本历史记录。',
     repositoryUrl: '仓库 URL',
     repositoryUrl: '仓库 URL',
     personalAccessToken: '个人访问令牌',
     personalAccessToken: '个人访问令牌',

File diff suppressed because it is too large
+ 0 - 0
static/assets/index-DuXI-THY.js


+ 1 - 1
static/index.html

@@ -23,7 +23,7 @@
 
 
     <!-- Splash screens for iOS -->
     <!-- Splash screens for iOS -->
     <link rel="apple-touch-startup-image" href="/img/android-chrome-512x512.png" />
     <link rel="apple-touch-startup-image" href="/img/android-chrome-512x512.png" />
-    <script type="module" crossorigin src="/assets/index-CnBVCYFe.js"></script>
+    <script type="module" crossorigin src="/assets/index-DuXI-THY.js"></script>
     <link rel="stylesheet" crossorigin href="/assets/index-BoLtXYT2.css">
     <link rel="stylesheet" crossorigin href="/assets/index-BoLtXYT2.css">
   </head>
   </head>
   <body>
   <body>

Some files were not shown because too many files changed in this diff