SSH Push/Pull Mirroring & Migrations

This commit is contained in:
techknowlogick
2025-07-15 15:46:17 -04:00
parent 9854df3e87
commit 4c8e222242
30 changed files with 1495 additions and 28 deletions
+41
View File
@@ -59,3 +59,44 @@ async function doMigrationRetry(e: DOMEvent<MouseEvent>) {
await POST(e.target.getAttribute('data-migrating-task-retry-url'));
window.location.reload();
}
export function initRepoMigrationForm() {
const cloneAddrInput = document.querySelector<HTMLInputElement>('#clone_addr');
const authUsernameInput = document.querySelector<HTMLInputElement>('#auth_username');
const authPasswordInput = document.querySelector<HTMLInputElement>('#auth_password');
const sshHelpText = document.querySelector('.help.ssh-help');
if (!cloneAddrInput || !authUsernameInput || !authPasswordInput || !sshHelpText) return;
function isSSHURL(url: string): boolean {
return url.startsWith('ssh://') ||
url.startsWith('git@') ||
(url.includes('@') && url.includes(':') && !url.includes('://'));
}
function updateAuthFields() {
const url = cloneAddrInput.value.trim();
const isSSH = isSSHURL(url);
if (isSSH) {
// Disable auth fields for SSH URLs
authUsernameInput.disabled = true;
authPasswordInput.disabled = true;
authUsernameInput.value = '';
authPasswordInput.value = '';
authUsernameInput.parentElement?.classList.add('disabled');
authPasswordInput.parentElement?.classList.add('disabled');
showElem(sshHelpText);
} else {
authUsernameInput.disabled = false;
authPasswordInput.disabled = false;
authUsernameInput.parentElement?.classList.remove('disabled');
authPasswordInput.parentElement?.classList.remove('disabled');
hideElem(sshHelpText);
}
}
updateAuthFields();
cloneAddrInput.addEventListener('input', updateAuthFields);
cloneAddrInput.addEventListener('blur', updateAuthFields);
}
+2 -1
View File
@@ -29,7 +29,7 @@ import {initRepoCodeView} from './features/repo-code.ts';
import {initSshKeyFormParser} from './features/sshkey-helper.ts';
import {initUserSettings} from './features/user-settings.ts';
import {initRepoActivityTopAuthorsChart, initRepoArchiveLinks} from './features/repo-common.ts';
import {initRepoMigrationStatusChecker} from './features/repo-migrate.ts';
import {initRepoMigrationStatusChecker, initRepoMigrationForm} from './features/repo-migrate.ts';
import {initRepoDiffView} from './features/repo-diff.ts';
import {initOrgTeam} from './features/org-team.ts';
import {initUserAuthWebAuthn, initUserAuthWebAuthnRegister} from './features/user-auth-webauthn.ts';
@@ -135,6 +135,7 @@ onDomReady(() => {
initRepoIssueSidebarDependency,
initRepoMigration,
initRepoMigrationStatusChecker,
initRepoMigrationForm,
initRepoProject,
initRepoPullRequestAllowMaintainerEdit,
initRepoPullRequestReview,