Skip to content

Commit

Permalink
Bundle index.html in launcher
Browse files Browse the repository at this point in the history
  • Loading branch information
BogdanW3 committed Jul 30, 2024
1 parent c48c6b7 commit b58fe3f
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 10 deletions.
29 changes: 29 additions & 0 deletions public/w3c-files/prod/webui/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Warcraft 3 UI</title>
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, minimal-ui" />
<script>
window.__DEBUG = new Boolean('').valueOf();
</script>
</head>
<body>
<div id="root"></div>
<div id="portal"></div>

<script>
var logCalls = [];
var w3cClientVersion = 1;
console.origLog = console.log;
console.log = (...args) => {
logCalls.push(...args);
console.origLog("log");
console.origLog(...args);
}

</script>
<script src="GlueManager.js"></script>
<script src="https://w3champions.wc3.tools/prod/integration/w3champions.js"></script>
</body>
</html>
29 changes: 29 additions & 0 deletions public/w3c-files/test/webui/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Warcraft 3 UI</title>
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, minimal-ui" />
<script>
window.__DEBUG = new Boolean('').valueOf();
</script>
</head>
<body>
<div id="root"></div>
<div id="portal"></div>

<script>
var logCalls = [];
var w3cClientVersion = 1;
console.origLog = console.log;
console.log = (...args) => {
logCalls.push(...args);
console.origLog("log");
console.origLog(...args);
}

</script>
<script src="GlueManager.js"></script>
<script src="https://w3champions.wc3.tools/test/integration/w3champions.js"></script>
</body>
</html>
4 changes: 4 additions & 0 deletions src/update-handling/FileService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,10 @@ export class FileService {
logger.info('reset textures!');
}

public copyW3ChampionsFiles(w3Folder: string, isTest: boolean) {
this.copyFile(`${__static}/w3c-files/${isTest ? "test" : "prod"}`, w3Folder);
}

private copyFile(from: string, to:string) {
try {
logger.info(`Copy from: ${from} to: ${to}`);
Expand Down
14 changes: 4 additions & 10 deletions src/update-handling/LauncherStrategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,23 +193,17 @@ export abstract class LauncherStrategy {
this.store.commit.updateHandling.START_DLS();
await this.downloadWebui();

// never download live webui to PTR
if(this.isBlizzardPTR && this.isTest){
await this.downloadWebuiToPTR();
}

await this.store.dispatch.updateHandling.loadOnlineW3CVersion();
this.store.dispatch.updateHandling.saveLocalW3CVersion(this.onlineW3cVersion);
logger.info(`switched to test/live with w3c version: ${this.localW3cVersion}`)
this.store.commit.updateHandling.FINISH_DLS();
}

private async downloadWebui() {
await this.downloadAndWriteFile("webui", this.w3Path);
}

private async downloadWebuiToPTR() {
await this.downloadAndWriteFile("webui", this.w3Path.replace('retail', 'ptr'));
//await this.downloadAndWriteFile("webui", (this.isTest && this.isBlizzardPTR) ? this.w3Path.replace('_retail_', '_ptr_') : this.w3Path);
this.store.getters.fileService.copyW3ChampionsFiles(
this.isBlizzardPTR ? this.w3Path.replace('_retail_', '_ptr_') : this.w3Path,
this.isTest);
}

private updateDownloadProgress(progress: number) {
Expand Down

0 comments on commit b58fe3f

Please sign in to comment.