Merge remote-tracking branch 'upstream/develop' into fix-12160

This commit is contained in:
yukineko 2023-11-13 16:42:10 +09:00
commit 2a299f9103
No known key found for this signature in database
GPG Key ID: E5BACB72109B7B90
3 changed files with 17 additions and 7 deletions

View File

@ -11,8 +11,8 @@ const siteName = document.querySelector<HTMLMetaElement>('meta[property="og:site
export const host = address.host; export const host = address.host;
export const hostname = address.hostname; export const hostname = address.hostname;
export const url = address.origin; export const url = address.origin;
export const apiUrl = url + '/api'; export const apiUrl = location.origin + '/api';
export const wsUrl = url.replace('http://', 'ws://').replace('https://', 'wss://') + '/streaming'; export const wsOrigin = location.origin;
export const lang = miLocalStorage.getItem('lang') ?? 'en-US'; export const lang = miLocalStorage.getItem('lang') ?? 'en-US';
export const langs = _LANGS_; export const langs = _LANGS_;
const preParseLocale = miLocalStorage.getItem('locale'); const preParseLocale = miLocalStorage.getItem('locale');

View File

@ -18,11 +18,19 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkSpacer v-else-if="tab === 'users'" :contentMax="1200"> <MkSpacer v-else-if="tab === 'users'" :contentMax="1200">
<div class="_gaps_s"> <div class="_gaps_s">
<div v-if="role">{{ role.description }}</div> <div v-if="role">{{ role.description }}</div>
<MkUserList :pagination="users" :extractor="(item) => item.user"/> <MkUserList v-if="visiable" :pagination="users" :extractor="(item) => item.user"/>
<div v-else-if="!visiable" class="_fullinfo">
<img :src="infoImageUrl" class="_ghost"/>
<div>{{ i18n.ts.nothing }}</div>
</div>
</div> </div>
</MkSpacer> </MkSpacer>
<MkSpacer v-else-if="tab === 'timeline'" :contentMax="700"> <MkSpacer v-else-if="tab === 'timeline'" :contentMax="700">
<MkTimeline ref="timeline" src="role" :role="props.role"/> <MkTimeline v-if="visiable" ref="timeline" src="role" :role="props.role"/>
<div v-else-if="!visiable" class="_fullinfo">
<img :src="infoImageUrl" class="_ghost"/>
<div>{{ i18n.ts.nothing }}</div>
</div>
</MkSpacer> </MkSpacer>
</MkStickyContainer> </MkStickyContainer>
</template> </template>
@ -35,7 +43,7 @@ import { definePageMetadata } from '@/scripts/page-metadata.js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import MkTimeline from '@/components/MkTimeline.vue'; import MkTimeline from '@/components/MkTimeline.vue';
import { instanceName } from '@/config.js'; import { instanceName } from '@/config.js';
import { serverErrorImageUrl } from '@/instance.js'; import { serverErrorImageUrl, infoImageUrl } from '@/instance.js';
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
role: string; role: string;
@ -47,6 +55,7 @@ const props = withDefaults(defineProps<{
let tab = $ref(props.initialTab); let tab = $ref(props.initialTab);
let role = $ref(); let role = $ref();
let error = $ref(); let error = $ref();
let visiable = $ref(false);
watch(() => props.role, () => { watch(() => props.role, () => {
os.api('roles/show', { os.api('roles/show', {
@ -54,6 +63,7 @@ watch(() => props.role, () => {
}).then(res => { }).then(res => {
role = res; role = res;
document.title = `${role?.name} | ${instanceName}`; document.title = `${role?.name} | ${instanceName}`;
visiable = res.isExplorable && res.isPublic;
}).catch((err) => { }).catch((err) => {
if (err.code === 'NO_SUCH_ROLE') { if (err.code === 'NO_SUCH_ROLE') {
error = i18n.ts.noRole; error = i18n.ts.noRole;

View File

@ -6,14 +6,14 @@
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import { markRaw } from 'vue'; import { markRaw } from 'vue';
import { $i } from '@/account.js'; import { $i } from '@/account.js';
import { url } from '@/config.js'; import { wsOrigin } from '@/config.js';
let stream: Misskey.Stream | null = null; let stream: Misskey.Stream | null = null;
export function useStream(): Misskey.Stream { export function useStream(): Misskey.Stream {
if (stream) return stream; if (stream) return stream;
stream = markRaw(new Misskey.Stream(url, $i ? { stream = markRaw(new Misskey.Stream(wsOrigin, $i ? {
token: $i.token, token: $i.token,
} : null)); } : null));