mirror of
https://github.com/v2rayA/v2rayA.git
synced 2026-11-20 23:02:25 +03:00
fix(gui): one welcome toast per session, no toast duplicate of the core-version banner
Every load and every remount showed the "service is running" toast, and a core version mismatch showed twice: the persistent banner in node.vue and a sticky red toast over it. Show the welcome once per browser session (again when a new version is found) and leave the mismatch to the banner.
This commit is contained in:
1 file changed
+16
-8
+16
-8
@@ -246,17 +246,25 @@ export default {
|
||||
});
|
||||
toastConf.type = "is-success";
|
||||
}
|
||||
this.$buefy.toast.open(toastConf);
|
||||
// the running/new-version notice once per browser session, not on
|
||||
// every reload or remount
|
||||
const seenKey = "welcomeShown:" + res.data.data.version;
|
||||
let seen = false;
|
||||
try {
|
||||
seen = sessionStorage.getItem(seenKey) === "1";
|
||||
sessionStorage.setItem(seenKey, "1");
|
||||
} catch (_) {
|
||||
// storage unavailable: fall back to showing it
|
||||
}
|
||||
if (!seen || res.data.data.foundNew) {
|
||||
this.$buefy.toast.open(toastConf);
|
||||
}
|
||||
localStorage["docker"] = res.data.data.dockerMode;
|
||||
localStorage["version"] = res.data.data.version;
|
||||
// a core version mismatch is already shown as the persistent banner
|
||||
// in node.vue; no toast on top of it
|
||||
if (res.data.data.coreVersionValid === false) {
|
||||
this.$buefy.toast.open({
|
||||
message: this.$t("version.coreVersionMismatch", { err: res.data.data.coreVersionErr || "" }),
|
||||
type: "is-danger",
|
||||
position: "is-top",
|
||||
queue: false,
|
||||
duration: 0,
|
||||
});
|
||||
// banner only
|
||||
} else if (res.data.data.serviceValid === false) {
|
||||
this.$buefy.toast.open({
|
||||
message: this.$t("version.v2rayInvalid"),
|
||||
|
||||
Reference in new issue
Block a user