upd: apply suggestions

This commit is contained in:
Marie 2024-09-14 14:11:12 +02:00
parent 8b4c6e00b4
commit 5cd11cacdc
No known key found for this signature in database
GPG Key ID: 7ADF6C9CD9A28555
9 changed files with 37 additions and 29 deletions

View File

@ -2820,10 +2820,10 @@ _contextMenu:
native: "Native" native: "Native"
_stripeAgeCheck: _stripeAgeCheck:
startText: We require you to confirm your identity, Please press the start button to begin the process startText: "We require you to confirm your identity, Please press the start button to begin the process"
beginProcess: Press the open Stripe in new tab button to begin Identification through Stripe beginProcess: "Press the open Stripe in new tab button to begin Identification through Stripe"
endProcess: If you have completed the Stripe verification process, wait a few seconds and then click Confirm completion. endProcess: "If you have completed the Stripe verification process, wait a few seconds and then click Confirm completion."
_buttons: _buttons:
start: Start Verification start: "Start Verification"
openInNewTab: Open Stripe in new tab openInNewTab: "Open Stripe in new tab"
confirmFinish: Confirm completion confirmFinish: "Confirm completion"

View File

@ -2895,10 +2895,10 @@ _contextMenu:
native: "ブラウザのUI" native: "ブラウザのUI"
_stripeAgeCheck: _stripeAgeCheck:
startText: ご本人様確認をさせていただきますので、スタートボタンを押して手続きを開始してください。 startText: "ご本人様確認をさせていただきますので、スタートボタンを押して手続きを開始してください。"
beginProcess: 新しいタブでStripeを開くボタンを押すと、Stripeでの本人確認が開始されます。 beginProcess: "新しいタブでStripeを開くボタンを押すと、Stripeでの本人確認が開始されます。"
endProcess: Stripeでの本人確認手続きが完了した場合は、数秒待ってから完了をクリックしてください。 endProcess: "Stripeでの本人確認手続きが完了した場合は、数秒待ってから完了をクリックしてください。"
_buttons: _buttons:
start: 検証を開始する start: "検証を開始する"
openInNewTab: 新しいタブでStripeを開く openInNewTab: "新しいタブでStripeを開く"
confirmFinish: 完成を確認する confirmFinish: "完成を確認する"

View File

@ -278,7 +278,7 @@ export const packedMetaDetailedOnlySchema = {
properties: { properties: {
features: { features: {
type: 'object', type: 'object',
optional: false, nullable: false, optional: true, nullable: false,
properties: { properties: {
registration: { registration: {
type: 'boolean', type: 'boolean',

View File

@ -131,7 +131,9 @@ export class StripeHookServerService {
this.logger.succ(`${user.username} has failed ID Verification via Session ${verificationSession.id}`); this.logger.succ(`${user.username} has failed ID Verification via Session ${verificationSession.id}`);
await this.usersRepository.update(user.id, { idCheckRequired: false });
// If general instance then unset idCheckRequired as to prevent locking the user out forever admins/mods can see the mod note in case of the failure
if (!this.config.stripeAgeCheck.required) await this.usersRepository.update(user.id, { idCheckRequired: false });
await this.userProfilesRepository.update(user.id, { moderationNote: 'ADM/IDFAIL: Possibly underage' }); await this.userProfilesRepository.update(user.id, { moderationNote: 'ADM/IDFAIL: Possibly underage' });

View File

@ -21,7 +21,7 @@ export const version = _VERSION_;
export const instanceName = siteName === 'Sharkey' || siteName == null ? host : siteName; export const instanceName = siteName === 'Sharkey' || siteName == null ? host : siteName;
export const ui = miLocalStorage.getItem('ui'); export const ui = miLocalStorage.getItem('ui');
export const debug = miLocalStorage.getItem('debug') === 'true'; export const debug = miLocalStorage.getItem('debug') === 'true';
export const idRequired: any = document.querySelector<HTMLMetaElement>('meta[property="idRequired"]')?.content === 'true' ? true : false; export const idRequired = document.querySelector<HTMLMetaElement>('meta[property="idRequired"]')?.content === 'true' ? true : false;
export function updateLocale(newLocale): void { export function updateLocale(newLocale): void {
locale = newLocale; locale = newLocale;

View File

@ -187,14 +187,14 @@ export class Router extends EventEmitter<RouterEvent> implements IRouter {
public currentRoute: ShallowRef<RouteDef>; public currentRoute: ShallowRef<RouteDef>;
private currentPath: string; private currentPath: string;
private isLoggedIn: boolean; private isLoggedIn: boolean;
private isNotIdConfirmed: boolean; private isIdConfirmed: boolean;
private notFoundPageComponent: Component; private notFoundPageComponent: Component;
private currentKey = Date.now().toString(); private currentKey = Date.now().toString();
private redirectCount = 0; private redirectCount = 0;
public navHook: ((path: string, flag?: any) => boolean) | null = null; public navHook: ((path: string, flag?: any) => boolean) | null = null;
constructor(routes: Router['routes'], currentPath: Router['currentPath'], isLoggedIn: boolean, isNotIdConfirmed: boolean, notFoundPageComponent: Component) { constructor(routes: Router['routes'], currentPath: Router['currentPath'], isLoggedIn: boolean, isIdConfirmed: boolean, notFoundPageComponent: Component) {
super(); super();
this.routes = routes; this.routes = routes;
@ -203,7 +203,7 @@ export class Router extends EventEmitter<RouterEvent> implements IRouter {
this.currentRoute = shallowRef(this.current.route); this.currentRoute = shallowRef(this.current.route);
this.currentPath = currentPath; this.currentPath = currentPath;
this.isLoggedIn = isLoggedIn; this.isLoggedIn = isLoggedIn;
this.isNotIdConfirmed = isNotIdConfirmed; this.isIdConfirmed = isIdConfirmed;
this.notFoundPageComponent = notFoundPageComponent; this.notFoundPageComponent = notFoundPageComponent;
} }
@ -369,7 +369,7 @@ export class Router extends EventEmitter<RouterEvent> implements IRouter {
res.props.set('showLoginPopup', true); res.props.set('showLoginPopup', true);
} }
if (res.route.idRequired && this.isNotIdConfirmed) { if (res.route.idRequired && !this.isIdConfirmed) {
res.route.component = this.notFoundPageComponent; res.route.component = this.notFoundPageComponent;
res.props.set('showIdConfirm', true); res.props.set('showIdConfirm', true);
} }

View File

@ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<template> <template>
<div v-if="meta" class="rsqzvsbo"> <div v-if="meta" class="rsqzvsbo">
<MkFeaturedPhotos class="bg"/> <MkFeaturedPhotos class="bg"/>
<XTimeline v-if="!meta.features!.idRequired" class="tl"/> <XTimeline v-if="!meta.features?.idRequired" class="tl"/>
<div class="shape1"></div> <div class="shape1"></div>
<div class="shape2"></div> <div class="shape2"></div>
<div class="logo-wrapper"> <div class="logo-wrapper">

View File

@ -18,6 +18,10 @@ const page = (loader: AsyncComponentLoader<any>) => defineAsyncComponent({
errorComponent: MkError, errorComponent: MkError,
}); });
const userNeedsChecking = $i && $i.idCheckRequired ? true : false;
const noUserButCheckRequired = !$i && idRequired ? true : false;
const userNotVerifiedYet = $i && !$i.idVerified && idRequired ? true : false;
const routes: RouteDef[] = [{ const routes: RouteDef[] = [{
path: '/@:initUser/pages/:initPageName/view-source', path: '/@:initUser/pages/:initPageName/view-source',
component: page(() => import('@/pages/page-editor/page-editor.vue')), component: page(() => import('@/pages/page-editor/page-editor.vue')),
@ -53,7 +57,7 @@ const routes: RouteDef[] = [{
path: '/settings', path: '/settings',
component: page(() => import('@/pages/settings/index.vue')), component: page(() => import('@/pages/settings/index.vue')),
loginRequired: true, loginRequired: true,
idRequired: $i && $i.idCheckRequired ? true : false, idRequired: userNeedsChecking,
children: [{ children: [{
path: '/profile', path: '/profile',
name: 'profile', name: 'profile',
@ -337,11 +341,11 @@ const routes: RouteDef[] = [{
}, { }, {
path: '/channels/:channelId', path: '/channels/:channelId',
component: page(() => import('@/pages/channel.vue')), component: page(() => import('@/pages/channel.vue')),
idRequired: $i && $i.idCheckRequired || !$i && idRequired ? true : false, idRequired: userNeedsChecking || noUserButCheckRequired,
}, { }, {
path: '/channels', path: '/channels',
component: page(() => import('@/pages/channels.vue')), component: page(() => import('@/pages/channels.vue')),
idRequired: $i && $i.idCheckRequired || !$i && idRequired ? true : false, idRequired: userNeedsChecking || noUserButCheckRequired,
}, { }, {
path: '/custom-emojis-manager', path: '/custom-emojis-manager',
component: page(() => import('@/pages/custom-emojis-manager.vue')), component: page(() => import('@/pages/custom-emojis-manager.vue')),
@ -563,12 +567,12 @@ const routes: RouteDef[] = [{
path: '/timeline/list/:listId', path: '/timeline/list/:listId',
component: page(() => import('@/pages/user-list-timeline.vue')), component: page(() => import('@/pages/user-list-timeline.vue')),
loginRequired: true, loginRequired: true,
idRequired: $i && $i.idCheckRequired || !$i && idRequired ? true : false, idRequired: userNeedsChecking || noUserButCheckRequired,
}, { }, {
path: '/timeline/antenna/:antennaId', path: '/timeline/antenna/:antennaId',
component: page(() => import('@/pages/antenna-timeline.vue')), component: page(() => import('@/pages/antenna-timeline.vue')),
loginRequired: true, loginRequired: true,
idRequired: $i && $i.idCheckRequired || !$i && idRequired ? true : false, idRequired: userNeedsChecking || !noUserButCheckRequired,
}, { }, {
path: '/clicker', path: '/clicker',
component: page(() => import('@/pages/clicker.vue')), component: page(() => import('@/pages/clicker.vue')),
@ -592,13 +596,13 @@ const routes: RouteDef[] = [{
}, { }, {
path: '/timeline', path: '/timeline',
component: page(() => import('@/pages/timeline.vue')), component: page(() => import('@/pages/timeline.vue')),
idRequired: $i && $i.idCheckRequired || !$i && idRequired ? true : false, idRequired: userNeedsChecking || noUserButCheckRequired,
}, { }, {
name: 'index', name: 'index',
path: '/', path: '/',
component: $i ? page(() => import('@/pages/timeline.vue')) : page(() => import('@/pages/welcome.vue')), component: $i ? page(() => import('@/pages/timeline.vue')) : page(() => import('@/pages/welcome.vue')),
globalCacheKey: 'index', globalCacheKey: 'index',
idRequired: $i && $i.idCheckRequired || $i && !$i.idVerified && idRequired ? true : false, idRequired: userNeedsChecking || userNotVerifiedYet,
}, { }, {
// テスト用リダイレクト設定。ログイン中ユーザのプロフィールにリダイレクトする // テスト用リダイレクト設定。ログイン中ユーザのプロフィールにリダイレクトする
path: '/redirect-test', path: '/redirect-test',
@ -609,8 +613,10 @@ const routes: RouteDef[] = [{
component: page(() => import('@/pages/not-found.vue')), component: page(() => import('@/pages/not-found.vue')),
}]; }];
const isIdConfirmedCheck = userNeedsChecking ? false : true || noUserButCheckRequired ? false : true || userNotVerifiedYet ? false : true;
function createRouterImpl(path: string): IRouter { function createRouterImpl(path: string): IRouter {
return new Router(routes, path, !!$i, $i && $i.idCheckRequired || !$i && idRequired || $i && !$i.idVerified && idRequired, page(() => import('@/pages/not-found.vue'))); return new Router(routes, path, !!$i, isIdConfirmedCheck, page(() => import('@/pages/not-found.vue')));
} }
/** /**

View File

@ -5118,7 +5118,7 @@ export type components = {
noteSearchableScope: 'local' | 'global'; noteSearchableScope: 'local' | 'global';
}; };
MetaDetailedOnly: { MetaDetailedOnly: {
features: { features?: {
registration: boolean; registration: boolean;
emailRequiredForSignup: boolean; emailRequiredForSignup: boolean;
localTimeline: boolean; localTimeline: boolean;