Commit iniziale

This commit is contained in:
2026-03-05 14:45:06 +01:00
commit 7008f57119
13 changed files with 5162 additions and 0 deletions

29
services/router.js Normal file
View File

@@ -0,0 +1,29 @@
const path = require('path');
function findDestination(filename, config) {
const ext = path.extname(filename).slice(1).toLowerCase();
for (const rule of config.rules || []) {
if ((rule.ext || '').toLowerCase() !== ext) {
continue;
}
if (!rule.pattern) {
return rule.destination;
}
const regex = new RegExp(rule.pattern);
if (regex.test(path.basename(filename))) {
return rule.destination;
}
}
return null;
}
function isCadFile(filename) {
const ext = path.extname(filename).slice(1).toLowerCase();
return ['prt', 'asm', 'drw'].includes(ext);
}
module.exports = { findDestination, isCadFile };