Skip to content

Commit

Permalink
Revert update behaviour to Purple A11y
Browse files Browse the repository at this point in the history
  • Loading branch information
younglim committed Sep 2, 2024
1 parent f40b9ed commit b10c1f9
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 23 deletions.
2 changes: 1 addition & 1 deletion installer.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$PHbackendUrl = "https://github.com/GovTechSG/oobee/releases/latest/download/oobee-portable-windows.zip"
$PHbackendUrl = "https://github.com/GovTechSG/purple-a11y/releases/latest/download/purple-a11y-portable-windows.zip"
$PHfrontendUrl = "https://github.com/GovTechSG/purple-a11y-desktop/releases/latest/download/purple-a11y-desktop-windows-prod.zip"
$BEdestinationPath = "$env:APPDATA\PHLatest.zip"
$BEextractPath = "$env:APPDATA\Purple A11y Backend"
Expand Down
8 changes: 4 additions & 4 deletions public/electron/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ const allReleasesUrl = "https://api.github.com/repos/GovTechSG/purple-a11y/relea

const frontendReleaseUrl =
os.platform() === "win32"
? "https://github.com/GovTechSG/oobee-desktop/releases/latest/download/oobee-desktop-windows.zip"
: "https://github.com/GovTechSG/oobee-desktop/releases/latest/download/oobee-desktop-macos.zip";
? "https://github.com/GovTechSG/purple-a11y-desktop/releases/latest/download/purple-a11y-desktop-windows.zip"
: "https://github.com/GovTechSG/purple-a11y-desktop/releases/latest/download/purple-a11y-desktop-macos.zip";

const backendPath = path.join(appPath, "Purple A11y Backend");
const frontendPath = path.join(appPath, "Purple A11y Frontend");
Expand Down Expand Up @@ -54,8 +54,8 @@ const resultsPath =

const installerExePath = path.join(
resultsPath,
"oobee-desktop-windows",
"oobee-setup.exe"
"purple-a11y-desktop-windows",
"Purple-A11y-Setup.exe"
);

const enginePath = path.join(backendPath, "purple-a11y");
Expand Down
2 changes: 1 addition & 1 deletion public/electron/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ app.on("ready", async () => {
}),
});

const { data: releaseInfo } = await axiosInstance.get('https://govtechsg.github.io/oobee-desktop/latest-release.json')
const { data: releaseInfo } = await axiosInstance.get('https://govtechsg.github.io/purple-a11y-desktop/latest-release.json')
.catch((e) => {
console.log("Unable to get release info");
return { data: undefined };
Expand Down
27 changes: 12 additions & 15 deletions public/electron/updateManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const getLatestFrontendVersion = (latestRelease, latestPreRelease) => {
*/
const downloadAndUnzipFrontendWindows = async (tag = undefined) => {
const downloadUrl = tag
? `https://github.com/GovTechSG/oobee-desktop/releases/download/${tag}/oobee-desktop-windows.zip`
? `https://github.com/GovTechSG/purple-a11y-desktop/releases/download/${tag}/purple-a11y-desktop-windows.zip`
: frontendReleaseUrl;

const shellScript = `
Expand All @@ -121,15 +121,15 @@ const downloadAndUnzipFrontendWindows = async (tag = undefined) => {
If (!(Test-Path -Path "${resultsPath}")) {
New-Item -ItemType Directory -Path "${resultsPath}"
}
$webClient.DownloadFile("${downloadUrl}", "${resultsPath}\\oobee-desktop-windows.zip")
$webClient.DownloadFile("${downloadUrl}", "${resultsPath}\\purple-a11y-desktop-windows.zip")
} catch {
Write-Host "Error: Unable to download frontend"
throw "Unable to download frontend"
exit 1
}
try {
Expand-Archive -Path "${resultsPath}\\oobee-desktop-windows.zip" -DestinationPath "${resultsPath}\\oobee-desktop-windows" -Force
Expand-Archive -Path "${resultsPath}\\purple-a11y-desktop-windows.zip" -DestinationPath "${resultsPath}\\purple-a11y-desktop-windows" -Force
} catch {
Write-Host "Error: Unable to unzip frontend"
throw "Unable to unzip frontend"
Expand Down Expand Up @@ -167,26 +167,26 @@ const downloadAndUnzipFrontendWindows = async (tag = undefined) => {
*/
const downloadAndUnzipFrontendMac = async (tag = undefined) => {
const downloadUrl = tag
? `https://github.com/GovTechSG/oobee-desktop/releases/download/${tag}/oobee-desktop-macos.zip`
? `https://github.com/GovTechSG/purple-a11y-desktop/releases/download/${tag}/purple-a11y-desktop-macos.zip`
: frontendReleaseUrl;

const command = `
mkdir -p '${resultsPath}' &&
curl -L '${downloadUrl}' -o '${resultsPath}/oobee-desktop-mac.zip' &&
curl -L '${downloadUrl}' -o '${resultsPath}/purple-a11y-desktop-mac.zip' &&
mv '${macOSExecutablePath}' '${path.join(
macOSExecutablePath,
".."
)}/Oobee Old.app' &&
ditto -xk '${resultsPath}/oobee-desktop-mac.zip' '${path.join(
)}/Purple A11y Old.app' &&
ditto -xk '${resultsPath}/purple-a11y-desktop-mac.zip' '${path.join(
macOSExecutablePath,
".."
)}' &&
rm '${resultsPath}/oobee-desktop-mac.zip' &&
rm -rf '${path.join(macOSExecutablePath, "..")}/Oobee Old.app' &&
rm '${resultsPath}/purple-a11y-desktop-mac.zip' &&
rm -rf '${path.join(macOSExecutablePath, "..")}/Purple A11y Old.app' &&
xattr -rd com.apple.quarantine '${path.join(
macOSExecutablePath,
".."
)}/Oobee.app' `;
)}/Purple A11y.app' `;

await execCommand(command);

Expand Down Expand Up @@ -272,7 +272,7 @@ const downloadAndUnzipBackendWindows = async (tag = undefined) => {
};

const downloadBackend = async (tag, zipPath) => {
const downloadUrl = `https://github.com/GovTechSG/oobee/releases/download/${tag}/oobee-portable-mac.zip`;
const downloadUrl = `https://github.com/GovTechSG/purple-a11y/releases/download/${tag}/purple-a11y-portable-mac.zip`;
const command = `curl '${downloadUrl}' -o '${zipPath}' -L && rm -rf '${backendPath}' && mkdir '${backendPath}'`;

return execCommand(command);
Expand Down Expand Up @@ -393,10 +393,7 @@ const run = async (updaterEventEmitter, latestRelease, latestPreRelease) => {

if (restartRequired) {
consoleLogger.info("restarting app...");
updaterEventEmitter.emit("restartA11yToOobee");
setTimeout(() => {
// Wait for restart to be triggered
}, 10000);
updaterEventEmitter.emit("restartTriggered");
}

const isPrepackageValid = await validateZipFile(macOSPrepackageBackend);
Expand Down
4 changes: 2 additions & 2 deletions scripts/downloadAndUnzipBackend.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ $backendTag = $args[0];
$purpleA11yDirectory = 'C:\Program Files\Purple A11y Desktop';
$purpleA11yBackendDirectory = 'C:\Program Files\Purple A11y Desktop\Purple A11y Backend';
$purpleA11yBackendPHDirectory = 'C:\Program Files\Purple A11y Desktop\Purple A11y Backend\purple-a11y';
$backendReleaseUrl = "https://github.com/GovTechSG/oobee/releases/download/$backendTag/oobee-portable-windows.zip";
$backendZipPath = 'C:\Program Files\Purple A11y Desktop\oobee-portable-windows.zip';
$backendReleaseUrl = "https://github.com/GovTechSG/purple-a11y/releases/download/$backendTag/purple-a11y-portable-windows.zip";
$backendZipPath = 'C:\Program Files\Purple A11y Desktop\purple-a11y-portable-windows.zip';
$backendUnzipPath = 'C:\Program Files\Purple A11y Desktop\Purple A11y Backend';

$command =
Expand Down

0 comments on commit b10c1f9

Please sign in to comment.