vari piccoli fix. Importati js e css per eliminare i warning e correzioni W3c.
This commit is contained in:
1 parent
ae458256d5
commit
a1b6d9333c
13 files changed
+954
-130
No files matched your search
@@ -0,0 +1,52 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const https = require('https');
|
||||
|
||||
const vendorDir = path.join(__dirname, '..', 'public', 'vendor');
|
||||
if (!fs.existsSync(vendorDir)) {
|
||||
fs.mkdirSync(vendorDir, { recursive: true });
|
||||
}
|
||||
|
||||
const files = [
|
||||
{ url: 'https://cdn.jsdelivr.net/npm/quill@2.0.2/dist/quill.snow.css', dest: 'quill.snow.css' },
|
||||
{ url: 'https://cdn.jsdelivr.net/npm/quill@2.0.2/dist/quill.js', dest: 'quill.js' },
|
||||
{ url: 'https://cdn.jsdelivr.net/npm/chart.js', dest: 'chart.js' },
|
||||
{ url: 'https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.11.174/pdf.min.js', dest: 'pdf.min.js' },
|
||||
{ url: 'https://cdn.jsdelivr.net/npm/pdf-lib@1.17.1/dist/pdf-lib.min.js', dest: 'pdf-lib.min.js' }
|
||||
];
|
||||
|
||||
function download(url, destPath) {
|
||||
return new Promise((resolve, reject) => {
|
||||
https.get(url, (res) => {
|
||||
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
||||
return download(res.headers.location, destPath).then(resolve).catch(reject);
|
||||
}
|
||||
if (res.statusCode !== 200) {
|
||||
return reject(new Error(`Failed to download ${url}: status ${res.statusCode}`));
|
||||
}
|
||||
const file = fs.createWriteStream(destPath);
|
||||
res.pipe(file);
|
||||
file.on('finish', () => {
|
||||
file.close(() => {
|
||||
console.log(`Downloaded: ${path.basename(destPath)} (${fs.statSync(destPath).size} bytes)`);
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}).on('error', (err) => {
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async function main() {
|
||||
for (const f of files) {
|
||||
const destPath = path.join(vendorDir, f.dest);
|
||||
try {
|
||||
await download(f.url, destPath);
|
||||
} catch (err) {
|
||||
console.error(`Error downloading ${f.dest}:`, err.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
||||
Reference in new issue
Block a user