Frontend: Removed the update check
This commit is contained in:
parent
39f9ecd8d3
commit
40c471ff56
|
@ -2034,10 +2034,6 @@ export type Endpoints = {
|
|||
req: NoParams;
|
||||
res: ServerInfo;
|
||||
};
|
||||
"latest-version": {
|
||||
req: NoParams;
|
||||
res: TODO;
|
||||
};
|
||||
"sw/register": {
|
||||
req: TODO;
|
||||
res: TODO;
|
||||
|
|
|
@ -1698,10 +1698,6 @@ export declare type Endpoints = {
|
|||
req: NoParams;
|
||||
res: ServerInfo;
|
||||
};
|
||||
"latest-version": {
|
||||
req: NoParams;
|
||||
res: TODO;
|
||||
};
|
||||
"sw/register": {
|
||||
req: TODO;
|
||||
res: TODO;
|
||||
|
|
|
@ -5,7 +5,6 @@ import {
|
|||
App,
|
||||
AuthSession,
|
||||
Blocking,
|
||||
Channel,
|
||||
Clip,
|
||||
DateString,
|
||||
DetailedInstanceMetadata,
|
||||
|
@ -17,24 +16,23 @@ import {
|
|||
FollowRequest,
|
||||
GalleryPost,
|
||||
Instance,
|
||||
InstanceMetadata,
|
||||
LiteInstanceMetadata,
|
||||
MeDetailed,
|
||||
MessagingMessage,
|
||||
Note,
|
||||
NoteFavorite,
|
||||
NoteReaction,
|
||||
Notification,
|
||||
OriginType,
|
||||
Page,
|
||||
ServerInfo,
|
||||
Signin,
|
||||
Stats,
|
||||
User,
|
||||
UserDetailed,
|
||||
UserGroup,
|
||||
UserList,
|
||||
UserSorting,
|
||||
Notification,
|
||||
NoteReaction,
|
||||
Signin,
|
||||
MessagingMessage,
|
||||
} from "./entities";
|
||||
|
||||
type TODO = Record<string, any> | null;
|
||||
|
@ -758,10 +756,7 @@ export type Endpoints = {
|
|||
$cases: [
|
||||
[{ detail: true }, DetailedInstanceMetadata],
|
||||
[{ detail: false }, LiteInstanceMetadata],
|
||||
[
|
||||
{ detail: boolean },
|
||||
LiteInstanceMetadata | DetailedInstanceMetadata,
|
||||
],
|
||||
[{ detail: boolean }, LiteInstanceMetadata | DetailedInstanceMetadata]
|
||||
];
|
||||
$default: LiteInstanceMetadata;
|
||||
};
|
||||
|
@ -977,9 +972,6 @@ export type Endpoints = {
|
|||
// server-info
|
||||
"server-info": { req: NoParams; res: ServerInfo };
|
||||
|
||||
// ck specific
|
||||
"latest-version": { req: NoParams; res: TODO };
|
||||
|
||||
// sw
|
||||
"sw/register": { req: TODO; res: TODO };
|
||||
|
||||
|
|
|
@ -38,15 +38,6 @@
|
|||
i18n.ts.configure
|
||||
}}</MkA></MkInfo
|
||||
>
|
||||
<MkInfo v-if="updateAvailable" warn class="info"
|
||||
>{{ i18n.ts.updateAvailable }}
|
||||
<a
|
||||
href="https://codeberg.org/calckey/calckey/releases"
|
||||
target="_bank"
|
||||
class="_link"
|
||||
>{{ i18n.ts.check }}</a
|
||||
></MkInfo
|
||||
>
|
||||
|
||||
<MkSuperMenu :def="menuDef" :grid="narrow"></MkSuperMenu>
|
||||
</div>
|
||||
|
@ -59,35 +50,21 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {
|
||||
defineAsyncComponent,
|
||||
inject,
|
||||
nextTick,
|
||||
onMounted,
|
||||
onUnmounted,
|
||||
onActivated,
|
||||
provide,
|
||||
watch,
|
||||
ref,
|
||||
} from "vue";
|
||||
import { onActivated, onMounted, onUnmounted, provide, ref, watch } from "vue";
|
||||
import { i18n } from "@/i18n";
|
||||
import MkSuperMenu from "@/components/MkSuperMenu.vue";
|
||||
import MkInfo from "@/components/MkInfo.vue";
|
||||
import { scroll } from "@/scripts/scroll";
|
||||
import { instance } from "@/instance";
|
||||
import { version } from "@/config";
|
||||
import { $i } from "@/account";
|
||||
import * as os from "@/os";
|
||||
import { lookupUser } from "@/scripts/lookup-user";
|
||||
import { lookupFile } from "@/scripts/lookup-file";
|
||||
import { lookupInstance } from "@/scripts/lookup-instance";
|
||||
import { indexPosts } from "@/scripts/index-posts";
|
||||
import { defaultStore } from "@/store";
|
||||
import { useRouter } from "@/router";
|
||||
import {
|
||||
definePageMetadata,
|
||||
provideMetadataReceiver,
|
||||
setPageMetadata,
|
||||
} from "@/scripts/page-metadata";
|
||||
|
||||
const isEmpty = (x: string | null) => x == null || x === "";
|
||||
|
@ -115,7 +92,6 @@ let noBotProtection =
|
|||
!instance.enableRecaptcha;
|
||||
let noEmailServer = !instance.enableEmail;
|
||||
let thereIsUnresolvedAbuseReport = $ref(false);
|
||||
let updateAvailable = $ref(false);
|
||||
let currentPage = $computed(() => router.currentRef.value.child);
|
||||
|
||||
os.api("admin/abuse-user-reports", {
|
||||
|
@ -125,16 +101,6 @@ os.api("admin/abuse-user-reports", {
|
|||
if (reports?.length > 0) thereIsUnresolvedAbuseReport = true;
|
||||
});
|
||||
|
||||
if (defaultStore.state.showAdminUpdates) {
|
||||
os.api("latest-version").then((res) => {
|
||||
const cleanRes = parseInt(res?.tag_name.replace(/[^0-9]/g, ""));
|
||||
const cleanVersion = parseInt(version.replace(/[^0-9]/g, ""));
|
||||
if (cleanRes > cleanVersion) {
|
||||
updateAvailable = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const NARROW_THRESHOLD = 600;
|
||||
const ro = new ResizeObserver((entries, observer) => {
|
||||
if (entries.length === 0) return;
|
||||
|
@ -247,15 +213,13 @@ const menuDef = $computed(() => [
|
|||
icon: "ph-envelope-simple-open ph-bold ph-lg",
|
||||
text: i18n.ts.emailServer,
|
||||
to: "/admin/email-settings",
|
||||
active:
|
||||
currentPage?.route.name === "email-settings",
|
||||
active: currentPage?.route.name === "email-settings",
|
||||
},
|
||||
{
|
||||
icon: "ph-cloud ph-bold ph-lg",
|
||||
text: i18n.ts.objectStorage,
|
||||
to: "/admin/object-storage",
|
||||
active:
|
||||
currentPage?.route.name === "object-storage",
|
||||
active: currentPage?.route.name === "object-storage",
|
||||
},
|
||||
{
|
||||
icon: "ph-lock ph-bold ph-lg",
|
||||
|
@ -279,8 +243,7 @@ const menuDef = $computed(() => [
|
|||
icon: "ph-prohibit ph-bold ph-lg",
|
||||
text: i18n.ts.instanceBlocking,
|
||||
to: "/admin/instance-block",
|
||||
active:
|
||||
currentPage?.route.name === "instance-block",
|
||||
active: currentPage?.route.name === "instance-block",
|
||||
},
|
||||
{
|
||||
icon: "ph-hash ph-bold ph-lg",
|
||||
|
|
|
@ -187,12 +187,6 @@
|
|||
<FormSwitch v-model="showFixedPostForm" class="_formBlock">{{
|
||||
i18n.ts.showFixedPostForm
|
||||
}}</FormSwitch>
|
||||
<FormSwitch
|
||||
v-if="$i?.isAdmin"
|
||||
v-model="showAdminUpdates"
|
||||
class="_formBlock"
|
||||
>{{ i18n.ts.showAdminUpdates }}</FormSwitch
|
||||
>
|
||||
<FormSelect v-model="instanceTicker" class="_formBlock">
|
||||
<template #label>{{ i18n.ts.instanceTicker }}</template>
|
||||
<option value="none">{{ i18n.ts._instanceTicker.none }}</option>
|
||||
|
@ -238,8 +232,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { reactive, computed, ref, watch } from "vue";
|
||||
import { $i } from "@/account";
|
||||
import { computed, ref, watch } from "vue";
|
||||
import FormSwitch from "@/components/form/switch.vue";
|
||||
import FormSelect from "@/components/form/select.vue";
|
||||
import FormRadios from "@/components/form/radios.vue";
|
||||
|
@ -339,9 +332,6 @@ const showUpdates = computed(defaultStore.makeGetterSetter("showUpdates"));
|
|||
const swipeOnDesktop = computed(
|
||||
defaultStore.makeGetterSetter("swipeOnDesktop")
|
||||
);
|
||||
const showAdminUpdates = computed(
|
||||
defaultStore.makeGetterSetter("showAdminUpdates")
|
||||
);
|
||||
const showTimelineReplies = computed(
|
||||
defaultStore.makeGetterSetter("showTimelineReplies")
|
||||
);
|
||||
|
@ -381,7 +371,6 @@ watch(
|
|||
showUpdates,
|
||||
swipeOnDesktop,
|
||||
seperateRenoteQuote,
|
||||
showAdminUpdates,
|
||||
advancedMfm,
|
||||
autoplayMfm,
|
||||
expandOnNoteClick,
|
||||
|
|
|
@ -67,8 +67,9 @@ import { unisonReload } from "@/scripts/unison-reload";
|
|||
import { stream } from "@/stream";
|
||||
import { $i } from "@/account";
|
||||
import { i18n } from "@/i18n";
|
||||
import { version, host } from "@/config";
|
||||
import { host, version } from "@/config";
|
||||
import { definePageMetadata } from "@/scripts/page-metadata";
|
||||
|
||||
const { t, ts } = i18n;
|
||||
|
||||
useCssModule();
|
||||
|
@ -111,7 +112,6 @@ const defaultStoreSaveKeys: (keyof (typeof defaultStore)["state"])[] = [
|
|||
"numberOfPageCache",
|
||||
"showUpdates",
|
||||
"swipeOnDesktop",
|
||||
"showAdminUpdates",
|
||||
"enableCustomKaTeXMacro",
|
||||
"enableEmojiReactions",
|
||||
"showEmojisInReactionNotifications",
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
import { markRaw, ref } from "vue";
|
||||
import { Storage } from "./pizzax";
|
||||
import { Theme } from "./scripts/theme";
|
||||
/**
|
||||
* 常にメモリにロードしておく必要がないような設定情報を保管するストレージ(非リアクティブ)
|
||||
*/
|
||||
import lightTheme from "@/themes/l-rosepinedawn.json5";
|
||||
import darkTheme from "@/themes/d-rosepine.json5";
|
||||
|
||||
export const postFormActions = [];
|
||||
export const userActions = [];
|
||||
|
@ -312,10 +316,6 @@ export const defaultStore = markRaw(
|
|||
where: "device",
|
||||
default: false,
|
||||
},
|
||||
showAdminUpdates: {
|
||||
where: "account",
|
||||
default: true,
|
||||
},
|
||||
woozyMode: {
|
||||
where: "device",
|
||||
default: false,
|
||||
|
@ -336,7 +336,7 @@ export const defaultStore = markRaw(
|
|||
where: "device",
|
||||
default: true,
|
||||
},
|
||||
}),
|
||||
})
|
||||
);
|
||||
|
||||
// TODO: 他のタブと永続化されたstateを同期
|
||||
|
@ -352,12 +352,6 @@ type Plugin = {
|
|||
ast: any[];
|
||||
};
|
||||
|
||||
/**
|
||||
* 常にメモリにロードしておく必要がないような設定情報を保管するストレージ(非リアクティブ)
|
||||
*/
|
||||
import lightTheme from "@/themes/l-rosepinedawn.json5";
|
||||
import darkTheme from "@/themes/d-rosepine.json5";
|
||||
|
||||
export class ColdDeviceStorage {
|
||||
public static default = {
|
||||
lightTheme,
|
||||
|
@ -378,8 +372,8 @@ export class ColdDeviceStorage {
|
|||
public static watchers = [];
|
||||
|
||||
public static get<T extends keyof typeof ColdDeviceStorage.default>(
|
||||
key: T,
|
||||
): typeof ColdDeviceStorage.default[T] {
|
||||
key: T
|
||||
): (typeof ColdDeviceStorage.default)[T] {
|
||||
// TODO: indexedDBにする
|
||||
// ただしその際はnullチェックではなくキー存在チェックにしないとダメ
|
||||
// (indexedDBはnullを保存できるため、ユーザーが意図してnullを格納した可能性がある)
|
||||
|
@ -393,7 +387,7 @@ export class ColdDeviceStorage {
|
|||
|
||||
public static set<T extends keyof typeof ColdDeviceStorage.default>(
|
||||
key: T,
|
||||
value: typeof ColdDeviceStorage.default[T],
|
||||
value: (typeof ColdDeviceStorage.default)[T]
|
||||
): void {
|
||||
// 呼び出し側のバグ等で undefined が来ることがある
|
||||
// undefined を文字列として localStorage に入れると参照する際の JSON.parse でコケて不具合の元になるため無視
|
||||
|
@ -414,7 +408,9 @@ export class ColdDeviceStorage {
|
|||
}
|
||||
|
||||
// TODO: VueのcustomRef使うと良い感じになるかも
|
||||
public static ref<T extends keyof typeof ColdDeviceStorage.default>(key: T) {
|
||||
public static ref<T extends keyof typeof ColdDeviceStorage.default>(
|
||||
key: T
|
||||
) {
|
||||
const v = ColdDeviceStorage.get(key);
|
||||
const r = ref(v);
|
||||
// TODO: このままではwatcherがリークするので開放する方法を考える
|
||||
|
@ -429,7 +425,7 @@ export class ColdDeviceStorage {
|
|||
* 主にvue場で設定コントロールのmodelとして使う用
|
||||
*/
|
||||
public static makeGetterSetter<
|
||||
K extends keyof typeof ColdDeviceStorage.default,
|
||||
K extends keyof typeof ColdDeviceStorage.default
|
||||
>(key: K) {
|
||||
// TODO: VueのcustomRef使うと良い感じになるかも
|
||||
const valueRef = ColdDeviceStorage.ref(key);
|
||||
|
|
|
@ -84,8 +84,7 @@
|
|||
thereIsUnresolvedAbuseReport ||
|
||||
noMaintainerInformation ||
|
||||
noBotProtection ||
|
||||
noEmailServer ||
|
||||
updateAvailable
|
||||
noEmailServer
|
||||
"
|
||||
class="indicator"
|
||||
></span
|
||||
|
@ -154,7 +153,6 @@ import { openHelpMenu_ } from "@/scripts/helpMenu";
|
|||
import { defaultStore } from "@/store";
|
||||
import { i18n } from "@/i18n";
|
||||
import { instance } from "@/instance";
|
||||
import { version } from "@/config";
|
||||
|
||||
const isEmpty = (x: string | null) => x == null || x === "";
|
||||
|
||||
|
@ -191,7 +189,6 @@ let noBotProtection =
|
|||
!instance.enableRecaptcha;
|
||||
let noEmailServer = !instance.enableEmail;
|
||||
let thereIsUnresolvedAbuseReport = $ref(false);
|
||||
let updateAvailable = $ref(false);
|
||||
|
||||
if ($i?.isAdmin) {
|
||||
os.api("admin/abuse-user-reports", {
|
||||
|
@ -202,16 +199,6 @@ if ($i?.isAdmin) {
|
|||
});
|
||||
}
|
||||
|
||||
if (defaultStore.state.showAdminUpdates) {
|
||||
os.api("latest-version").then((res) => {
|
||||
const cleanRes = parseInt(res?.tag_name.replace(/[^0-9]/g, ""));
|
||||
const cleanVersion = parseInt(version.replace(/[^0-9]/g, ""));
|
||||
if (cleanRes > cleanVersion) {
|
||||
updateAvailable = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function openAccountMenu(ev: MouseEvent) {
|
||||
openAccountMenu_(
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue