forked from Lurkars/gloomhavensecretariat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add server ping in debug settings, add version check
- Loading branch information
Showing
18 changed files
with
313 additions
and
86 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<div class="menu-container about"> | ||
<div class="line"> | ||
<p [ghs-label]="'about.ip'" | ||
[ghs-label-args]="['<a href=\'https:\/\/cephalofair.com\' target=\'_blank\'>Cephalofair Games</a>']"> | ||
</p> | ||
</div> | ||
<div class="line version"> | ||
<a target="_blank" | ||
[href]="'https://github.com/Lurkars/gloomhavensecretariat/releases/tag/v' + version">Gloomhaven | ||
Secretariat | ||
v{{version}}</a> | ||
|
||
<div class="version-info"> | ||
<span class="unknown" *ngIf="!updateVersion"> | ||
<span [ghs-label]="'about.version.unknown'"></span> | ||
</span> | ||
<span class="latest" *ngIf="updateVersion && updateVersion.latest"> | ||
<span [ghs-label]="'about.version.latest'"></span> | ||
</span> | ||
<span class="update" *ngIf="updateVersion && !updateVersion.latest"> | ||
<span [ghs-label]="'about.version.update'" | ||
[ghs-label-args]="[updateVersion.version, updateVersion.url]"></span> | ||
</span> | ||
<a class="force" *ngIf="!updateVersion || !updateVersion.latest" (click)="forceUpdate()"><span | ||
[ghs-label]="'about.forceUpdate'"></span></a> | ||
</div> | ||
</div> | ||
|
||
<div class="line"> | ||
<div class="columns"> | ||
<div class="column"> | ||
<p> | ||
<a href="https://ko-fi.com/lurkars" target="_blank"><span [ghs-label]="'about.support'"></span></a> | ||
</p> | ||
</div> | ||
<div class="column"> | ||
<p><a href="https://github.com/Lurkars/gloomhavensecretariat" target="_blank"><span | ||
[ghs-label]="'about.sourceCode'"></span></a></p> | ||
</div> | ||
<div class="column"> | ||
<p [ghs-label]="'about.license'" | ||
[ghs-label-args]="['<a href=\'https:\/\/\github.com\/Lurkars\/gloomhavensecretariat\/blob\/main\/LICENSE\' target=\'_blank\'> AGPL3</a>']"> | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
.version-info { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
font-family: var(--ghs-font-title); | ||
font-size: calc(var(--ghs-unit) * 2.5 * var(--ghs-dialog-factor)); | ||
color: var(--ghs-color-gray); | ||
margin-left: calc(var(--ghs-unit) * 1.5 * var(--ghs-dialog-factor)); | ||
|
||
span { | ||
margin-right: calc(var(--ghs-unit) * 1 * var(--ghs-dialog-factor)); | ||
|
||
&.unknown { | ||
font-size: calc(var(--ghs-unit) * 2 * var(--ghs-dialog-factor)); | ||
color: var(--ghs-color-darkgray); | ||
} | ||
|
||
&.latest { | ||
color: var(--ghs-color-darkgreen); | ||
} | ||
|
||
&.update { | ||
color: var(--ghs-color-yellow); | ||
} | ||
} | ||
|
||
.force { | ||
margin-left: calc(var(--ghs-unit) * 1.5 * var(--ghs-dialog-factor)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { Component, EventEmitter, OnInit, Output } from "@angular/core"; | ||
import { SwUpdate } from "@angular/service-worker"; | ||
import packageJson from '../../../../../../package.json'; | ||
|
||
|
||
@Component({ | ||
selector: 'ghs-about-menu', | ||
templateUrl: 'about.html', | ||
styleUrls: ['../menu.scss', 'about.scss'] | ||
}) | ||
export class AboutMenuComponent implements OnInit { | ||
|
||
@Output() close = new EventEmitter(); | ||
version = packageJson.version; | ||
updateVersion: { latest: boolean, version: string, url: string } | undefined; | ||
|
||
constructor(private swUpdate: SwUpdate) { } | ||
|
||
async ngOnInit() { | ||
await fetch('https://api.github.com/repos/lurkars/gloomhavensecretariat/releases/latest') | ||
.then(response => { | ||
if (!response.ok) { | ||
throw Error(); | ||
} | ||
return response.json(); | ||
}).then((value: any) => { | ||
this.updateVersion = { latest: value.tag_name == this.version || value.tag_name == 'v' + this.version, version: value.tag_name, url: value.html_url }; | ||
}); | ||
} | ||
|
||
forceUpdate(): void { | ||
if (this.swUpdate.isEnabled) { | ||
this.swUpdate.activateUpdate().then(() => { | ||
this.clearAndRefresh(); | ||
}); | ||
} else { | ||
this.clearAndRefresh(); | ||
} | ||
} | ||
|
||
async clearAndRefresh() { | ||
if ('caches' in window) { | ||
const keyList = await caches.keys(); | ||
await Promise.all(keyList.map(async (key) => await caches.delete(key))); | ||
} | ||
window.location.reload() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.