fix: run prettier & remove unused fragments

This commit is contained in:
divocat
2025-10-07 00:50:39 +03:00
parent 7cb43ffb65
commit c78f97d64f
5 changed files with 283 additions and 301 deletions

View File

@@ -1,6 +1,5 @@
import { ValidationResult } from './types';
// TODO refactor current validation and add tests
export function validateVlessUrl(url: string): ValidationResult {
try {
const parsedUrl = new URL(url);

View File

@@ -23,12 +23,12 @@ async function uploadFile(filePath) {
const relativePath = path.relative(localDir, filePath);
const remotePath = path.posix.join(remoteDir, relativePath);
console.log(`⬆️ Uploading: ${relativePath} -> ${remotePath}`);
console.log(`Uploading: ${relativePath} -> ${remotePath}`);
try {
await sftp.fastPut(filePath, remotePath);
console.log(`Uploaded: ${relativePath}`);
console.log(`Uploaded: ${relativePath}`);
} catch (err) {
console.error(`Failed: ${relativePath}: ${err.message}`);
console.error(`Failed: ${relativePath}: ${err.message}`);
}
}
@@ -36,34 +36,32 @@ async function deleteFile(filePath) {
const relativePath = path.relative(localDir, filePath);
const remotePath = path.posix.join(remoteDir, relativePath);
console.log(`🗑 Removing: ${relativePath}`);
console.log(`Removing: ${relativePath}`);
try {
await sftp.delete(remotePath);
console.log(`Removed: ${relativePath}`);
console.log(`Removed: ${relativePath}`);
} catch (err) {
console.warn(`⚠️ Could not delete ${relativePath}: ${err.message}`);
console.warn(`Could not delete ${relativePath}: ${err.message}`);
}
}
async function uploadAllFiles() {
console.log('🚀 Uploading all files from', localDir);
console.log('Uploading all files from', localDir);
const files = await glob(`${localDir}/**/*`, { nodir: true });
for (const file of files) {
await uploadFile(file);
}
console.log('Initial upload complete!');
console.log('Initial upload complete!');
}
async function main() {
await sftp.connect(config);
console.log(`Connected to ${config.host}`);
console.log(`Connected to ${config.host}`);
// 🔹 Загрузить всё при старте
await uploadAllFiles();
// 🔹 Затем следить за изменениями
chokidar
.watch(localDir, { ignoreInitial: true })
.on('all', async (event, filePath) => {
@@ -75,7 +73,7 @@ async function main() {
});
process.on('SIGINT', async () => {
console.log('🔌 Disconnecting...');
console.log('Disconnecting...');
await sftp.end();
process.exit();
});

View File

@@ -13,14 +13,14 @@ function createDashboardSection(mainSection) {
o = mainSection.taboption('dashboard', form.DummyValue, '_status');
o.rawhtml = true;
o.cfgvalue = () => {
main.initDashboardController()
main.initDashboardController();
return main.renderDashboard()
return main.renderDashboard();
};
}
const EntryPoint = {
createDashboardSection,
}
};
return baseclass.extend(EntryPoint);

View File

@@ -13,21 +13,6 @@ const EntryNode = {
async render() {
main.injectGlobalStyles();
// main.getClashVersion()
// .then(result => console.log('getClashVersion - then', result))
// .catch(err => console.log('getClashVersion - err', err))
// .finally(() => console.log('getClashVersion - finish'));
//
// main.getClashConfig()
// .then(result => console.log('getClashConfig - then', result))
// .catch(err => console.log('getClashConfig - err', err))
// .finally(() => console.log('getClashConfig - finish'));
//
// main.getClashProxies()
// .then(result => console.log('getClashProxies - then', result))
// .catch(err => console.log('getClashProxies - err', err))
// .finally(() => console.log('getClashProxies - finish'));
const podkopFormMap = new form.Map('podkop', '', null, ['main', 'extra']);
// Main Section
@@ -41,7 +26,7 @@ const EntryNode = {
// Diagnostics Tab (main section)
diagnosticTab.createDiagnosticsSection(mainSection);
const podkopFormMapPromise = podkopFormMap.render().then(node => {
const podkopFormMapPromise = podkopFormMap.render().then((node) => {
// Set up diagnostics event handlers
diagnosticTab.setupDiagnosticsEventHandlers(node);
@@ -73,25 +58,25 @@ const EntryNode = {
});
// Extra Section
const extraSection = podkopFormMap.section(form.TypedSection, 'extra', _('Extra configurations'));
const extraSection = podkopFormMap.section(
form.TypedSection,
'extra',
_('Extra configurations'),
);
extraSection.anonymous = false;
extraSection.addremove = true;
extraSection.addbtntitle = _('Add Section');
extraSection.multiple = true;
configSection.createConfigSection(extraSection);
// Initial dashboard render
dashboardTab.createDashboardSection(mainSection);
// Inject dashboard actualizer logic
// main.initDashboardController();
// Inject core service
main.coreService();
return podkopFormMapPromise;
}
}
},
};
return view.extend(EntryNode);