Importar projetos da máquina local via upload de pasta

Substitui o navegador de diretórios do servidor por upload de pasta
local usando webkitdirectory. Filtra automaticamente .git,
node_modules e padrões do .gitignore antes do envio. Cria o repo
no Gitea, faz push e clona em /home/projetos/ para uso com agentes.
This commit is contained in:
Frederico Castro
2026-02-28 05:46:03 -03:00
parent 8a9a3d7988
commit e3103d27e7
4 changed files with 312 additions and 194 deletions

View File

@@ -151,7 +151,21 @@ const API = {
projects: {
browse(path) { return API.request('GET', `/browse?path=${encodeURIComponent(path || '/home')}`); },
import(sourcePath, repoName) { return API.request('POST', '/projects/import', { sourcePath, repoName }); },
importLocal(sourcePath, repoName) { return API.request('POST', '/projects/import', { sourcePath, repoName }); },
async upload(files, paths, repoName) {
const form = new FormData();
form.append('repoName', repoName);
form.append('paths', JSON.stringify(paths));
for (const f of files) form.append('files', f);
const response = await fetch('/api/projects/upload', {
method: 'POST',
headers: { 'X-Client-Id': API.clientId },
body: form,
});
const data = await response.json();
if (!response.ok) throw new Error(data.error || 'Erro no upload');
return data;
},
},
files: {