Skip to content

Commit 0cc7869

Browse files
authored
Merge pull request #11 from OpenHomeFoundation/fix/zbt1
Fix zbt1 firmware update
2 parents 57d7288 + ddbbc83 commit 0cc7869

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

vite.config.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,25 @@ export default defineConfig({
1919
if (id.endsWith('.py')) {
2020
return { code: `export default ${JSON.stringify(code)};`, map: null };
2121
}
22+
23+
if (id.endsWith('.txt')) {
24+
if (code.startsWith('export default "data:text/plain;base64,')) {
25+
const match = code.match(/data:text\/plain;base64,(.+?)"$/);
26+
if (match) {
27+
const base64Content = match[1];
28+
const decodedContent = Buffer.from(
29+
base64Content,
30+
'base64'
31+
).toString('utf-8');
32+
return {
33+
code: `export default ${JSON.stringify(decodedContent)};`,
34+
map: null,
35+
};
36+
}
37+
}
38+
return { code: `export default ${JSON.stringify(code)};`, map: null };
39+
}
40+
2241
return null;
2342
},
2443
},
@@ -53,6 +72,7 @@ export default defineConfig({
5372
esbuildOptions: {
5473
loader: {
5574
'.py': 'text',
75+
'.txt': 'text',
5676
},
5777
},
5878
},

0 commit comments

Comments
 (0)