| 1496 | } |
| 1497 | |
| 1498 | void Backend::enableAutoUpdates() |
| 1499 | { |
| 1500 | QString repoFile = flatpakRepoDescriptorPath(); |
| 1501 | if (!QFile::exists(repoFile)) { |
| 1502 | fprintf(stderr, "[Backend] Flatpak repo descriptor missing; not adding update remote\n"); |
| 1503 | dismissAutoUpdatePrompt(); |
| 1504 | return; |
| 1505 | } |
| 1506 | if (!flatpakRepoDescriptorHasGpgKey()) { |
| 1507 | fprintf(stderr, "[Backend] Flatpak repo descriptor has no GPG key; not adding update remote\n"); |
| 1508 | dismissAutoUpdatePrompt(); |
| 1509 | return; |
| 1510 | } |
| 1511 | |
| 1512 | // Use the hosted .flatpakrepo URL; the local file is inside the sandbox |
| 1513 | // and inaccessible to the host flatpak process via flatpak-spawn. |
| 1514 | QString repoUrl = "https://selectively11.github.io/CloudRedirect/cloudredirect.flatpakrepo"; |
| 1515 | |
| 1516 | QProcess proc; |
| 1517 | proc.start("flatpak-spawn", {"--host", "flatpak", "remote-add", "--user", "--if-not-exists", "cloudredirect", repoUrl}); |
| 1518 | proc.waitForFinished(15000); |
| 1519 | |
| 1520 | if (proc.exitCode() == 0) { |
| 1521 | fprintf(stderr, "[Backend] Added cloudredirect Flatpak remote\n"); |
| 1522 | } else { |
| 1523 | fprintf(stderr, "[Backend] Failed to add remote: %s\n", |
| 1524 | proc.readAllStandardError().constData()); |
| 1525 | } |
| 1526 | |
| 1527 | dismissAutoUpdatePrompt(); |
| 1528 | } |
| 1529 | |
| 1530 | void Backend::dismissAutoUpdatePrompt() |
| 1531 | { |
nothing calls this directly
no test coverage detected