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:
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user