Update index.html
This commit is contained in:
parent
62f7f97ef6
commit
bc738ae3e8
1 changed files with 66 additions and 25 deletions
91
index.html
91
index.html
|
|
@ -1523,31 +1523,52 @@
|
||||||
try {
|
try {
|
||||||
const files = [];
|
const files = [];
|
||||||
|
|
||||||
// Since we can't directly access the file system in a browser,
|
// Get actual files from the current directory
|
||||||
// we'll need to manually specify the files to include
|
const knownFiles = [
|
||||||
// This would need to be replaced with actual file system access in a proper environment
|
'index.html',
|
||||||
|
'script.js',
|
||||||
// For now, let's scan the current directory files
|
'style.css',
|
||||||
const directoryFiles = [
|
'.replit'
|
||||||
{ name: 'index.html', type: 'file', size: 0 },
|
|
||||||
{ name: 'script.js', type: 'file', size: 0 },
|
|
||||||
{ name: 'style.css', type: 'file', size: 0 }
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// Add any additional files that might exist
|
||||||
|
const potentialFiles = [
|
||||||
|
'README.md',
|
||||||
|
'main.py',
|
||||||
|
'app.js',
|
||||||
|
'server.js',
|
||||||
|
'package.json',
|
||||||
|
'requirements.txt',
|
||||||
|
'config.js',
|
||||||
|
'data.json',
|
||||||
|
'utils.js',
|
||||||
|
'helpers.py',
|
||||||
|
'styles.css',
|
||||||
|
'script.min.js',
|
||||||
|
'favicon.ico',
|
||||||
|
'manifest.json'
|
||||||
|
];
|
||||||
|
|
||||||
|
const allFiles = [...knownFiles, ...potentialFiles];
|
||||||
|
|
||||||
for (const file of directoryFiles) {
|
for (const fileName of allFiles) {
|
||||||
if (file.type === 'file' && (file.name.endsWith('.md') || file.name.endsWith('.txt') || file.name.endsWith('.js') || file.name.endsWith('.html') || file.name.endsWith('.css'))) {
|
try {
|
||||||
try {
|
const response = await fetch(fileName);
|
||||||
const content = await loadFileContent(file.name);
|
if (response.ok) {
|
||||||
|
const content = await response.text();
|
||||||
|
const size = new Blob([content]).size;
|
||||||
|
|
||||||
files.push({
|
files.push({
|
||||||
name: file.name.replace(/\.[^/.]+$/, ""), // Remove extension
|
name: fileName.replace(/\.[^/.]+$/, ""), // Remove extension
|
||||||
folder: determineFolder(file.name),
|
folder: determineFolder(fileName),
|
||||||
path: file.name,
|
path: fileName,
|
||||||
size: content.length,
|
size: size,
|
||||||
content: content
|
content: content
|
||||||
});
|
});
|
||||||
} catch (error) {
|
|
||||||
console.warn(`Could not load ${file.name}:`, error);
|
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
// File doesn't exist or can't be loaded, skip silently
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1575,12 +1596,32 @@
|
||||||
const ext = fileName.split('.').pop().toLowerCase();
|
const ext = fileName.split('.').pop().toLowerCase();
|
||||||
const name = fileName.toLowerCase();
|
const name = fileName.toLowerCase();
|
||||||
|
|
||||||
if (ext === 'html') return 'Web Pages';
|
// Web files
|
||||||
if (ext === 'css') return 'Stylesheets';
|
if (ext === 'html' || ext === 'htm') return 'Web Pages';
|
||||||
if (ext === 'js') return 'JavaScript';
|
if (ext === 'css' || ext === 'scss' || ext === 'sass') return 'Stylesheets';
|
||||||
if (ext === 'md') return 'Documentation';
|
if (ext === 'js' || ext === 'jsx' || ext === 'ts' || ext === 'tsx') return 'JavaScript';
|
||||||
if (ext === 'txt') return 'Text Files';
|
|
||||||
if (name.includes('config')) return 'Configuration';
|
// Programming languages
|
||||||
|
if (ext === 'py' || ext === 'python') return 'Python';
|
||||||
|
if (ext === 'java' || ext === 'class') return 'Java';
|
||||||
|
if (ext === 'cpp' || ext === 'c' || ext === 'h') return 'C/C++';
|
||||||
|
if (ext === 'php') return 'PHP';
|
||||||
|
if (ext === 'rb' || ext === 'ruby') return 'Ruby';
|
||||||
|
|
||||||
|
// Documentation and text
|
||||||
|
if (ext === 'md' || ext === 'markdown') return 'Documentation';
|
||||||
|
if (ext === 'txt' || ext === 'text') return 'Text Files';
|
||||||
|
if (ext === 'json') return 'Data Files';
|
||||||
|
if (ext === 'xml' || ext === 'yaml' || ext === 'yml') return 'Data Files';
|
||||||
|
|
||||||
|
// Configuration
|
||||||
|
if (name.includes('config') || name.includes('.env') || fileName === '.replit') return 'Configuration';
|
||||||
|
if (ext === 'toml' || ext === 'ini' || ext === 'conf') return 'Configuration';
|
||||||
|
if (fileName === 'package.json' || fileName === 'requirements.txt') return 'Dependencies';
|
||||||
|
|
||||||
|
// Media
|
||||||
|
if (ext === 'jpg' || ext === 'jpeg' || ext === 'png' || ext === 'gif' || ext === 'svg') return 'Images';
|
||||||
|
if (ext === 'ico') return 'Assets';
|
||||||
|
|
||||||
return 'Miscellaneous';
|
return 'Miscellaneous';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue