fix(dropbox): use direct raw fallback

This commit is contained in:
Christian Vidal Wolf
2026-05-21 14:08:41 +02:00
parent 290b298544
commit 9c3e26c523
3 changed files with 187 additions and 154 deletions
+7 -9
View File
@@ -56,6 +56,8 @@ const FORCED_ZERO_STOCK_SKUS = new Set([
const BC_SYNC_QUEUE_STORAGE_KEY = 'craze_bc_sync_queue';
const LEGACY_CPNP_INDEX = 77;
const DROPBOX_PROXY_URL = '/api/dropbox-proxy';
const DROPBOX_FILE_URL = '/dropbox-file/scl/fi/usa8me7ywgylrij2bt6hj/Data-Matrix.xlsx?rlkey=tsec8csrhye54u1fdvk15ped1&st=qbxxs4cn&dl=0';
type BcSyncStatus = 'queued' | 'previewed' | 'preview_only' | 'syncing' | 'synced' | 'failed';
@@ -216,19 +218,15 @@ export default function App() {
return arrayBuffer.byteLength;
};
const dropboxSources = import.meta.env.DEV
? [
'/api/dropbox-proxy',
`/dropbox-file/scl/fi/usa8me7ywgylrij2bt6hj/Data-Matrix.xlsx?rlkey=tsec8csrhye54u1fdvk15ped1&st=qbxxs4cn&dl=0&t=${Date.now()}`
]
: [
'/api/dropbox-proxy'
];
const dropboxSources = [
DROPBOX_PROXY_URL,
`${DROPBOX_FILE_URL}&t=${Date.now()}`
];
let lastError: unknown = null;
for (const source of dropboxSources) {
try {
console.log(`Fetching Data-Matrix.xlsx from ${source.includes('/api/') ? 'proxy' : 'Dropbox'}...`);
console.log(`Fetching Data-Matrix.xlsx from ${source}...`);
const size = await loadWorkbookFromUrl(source);
fileMeta = { rev: source, size };
lastError = null;