Andreas Brett
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
15 additions and
2 deletions
-
db/patch-monitor-push_token.sql
-
src/languages/de-DE.js
-
src/languages/en.js
-
src/pages/EditMonitor.vue
|
|
@ -2,6 +2,6 @@ |
|
|
|
BEGIN TRANSACTION; |
|
|
|
|
|
|
|
ALTER TABLE monitor |
|
|
|
ADD push_token VARCHAR(20) DEFAULT NULL; |
|
|
|
ADD push_token VARCHAR(32) DEFAULT NULL; |
|
|
|
|
|
|
|
COMMIT; |
|
|
|
|
|
@ -304,4 +304,5 @@ export default { |
|
|
|
"One record": "Ein Eintrag", |
|
|
|
steamApiKeyDescription: "Um einen Steam Game Server zu überwachen, wird ein Steam Web-API-Schlüssel benötigt. Dieser kann hier registriert werden: ", |
|
|
|
"Current User": "Aktueller Benutzer", |
|
|
|
"Reset Token": "Token zurücksetzen", |
|
|
|
}; |
|
|
|
|
|
@ -307,4 +307,5 @@ export default { |
|
|
|
steamApiKeyDescription: "For monitoring a Steam Game Server you need a Steam Web-API key. You can register your API key here: ", |
|
|
|
"Current User": "Current User", |
|
|
|
recent: "Recent", |
|
|
|
"Reset Token": "Reset Token", |
|
|
|
}; |
|
|
|
|
|
@ -55,6 +55,9 @@ |
|
|
|
{{ $t("needPushEvery", [monitor.interval]) }}<br /> |
|
|
|
{{ $t("pushOptionalParams", ["msg, ping"]) }} |
|
|
|
</div> |
|
|
|
<button class="btn btn-primary" type="button" @click="resetToken"> |
|
|
|
{{ $t("Reset Token") }} |
|
|
|
</button> |
|
|
|
</div> |
|
|
|
|
|
|
|
<!-- Keyword --> |
|
|
@ -287,6 +290,8 @@ import { genSecret, isDev } from "../util.ts"; |
|
|
|
|
|
|
|
const toast = useToast(); |
|
|
|
|
|
|
|
const pushTokenLength = 32; |
|
|
|
|
|
|
|
export default { |
|
|
|
components: { |
|
|
|
CopyableInput, |
|
|
@ -370,7 +375,9 @@ export default { |
|
|
|
"monitor.type"() { |
|
|
|
if (this.monitor.type === "push") { |
|
|
|
if (! this.monitor.pushToken) { |
|
|
|
this.monitor.pushToken = genSecret(10); |
|
|
|
// ideally this would require checking if the generated token is already used |
|
|
|
// it's very unlikely to get a collision though (62^32 ~ 2.27265788 * 10^57 unique tokens) |
|
|
|
this.monitor.pushToken = genSecret(pushTokenLength); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -470,6 +477,10 @@ export default { |
|
|
|
return true; |
|
|
|
}, |
|
|
|
|
|
|
|
resetToken() { |
|
|
|
this.monitor.pushToken = genSecret(pushTokenLength); |
|
|
|
}, |
|
|
|
|
|
|
|
async submit() { |
|
|
|
this.processing = true; |
|
|
|
|
|
|
|