mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-07-07 20:44:34 +00:00
requested changes.
This commit is contained in:
parent
3884f2fa6a
commit
5545ddf9dd
7 changed files with 32 additions and 39 deletions
4
locales/index.d.ts
vendored
4
locales/index.d.ts
vendored
|
@ -13138,9 +13138,9 @@ export interface Locale extends ILocale {
|
||||||
*/
|
*/
|
||||||
"attributionDomainsDescription": string;
|
"attributionDomainsDescription": string;
|
||||||
/**
|
/**
|
||||||
* Written by
|
* Written by {user}
|
||||||
*/
|
*/
|
||||||
"writtenBy": string;
|
"writtenBy": ParameterizedString<"user">;
|
||||||
}
|
}
|
||||||
declare const locales: {
|
declare const locales: {
|
||||||
[lang: string]: Locale;
|
[lang: string]: Locale;
|
||||||
|
|
|
@ -237,7 +237,7 @@ export const packedUserLiteSchema = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
attributionDomains: {
|
attributionDomains: {
|
||||||
type: 'object',
|
type: 'array',
|
||||||
nullable: false, optional: false,
|
nullable: false, optional: false,
|
||||||
additionalProperties: {
|
additionalProperties: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
|
|
|
@ -28,7 +28,7 @@ import { ApNoteService } from '@/core/activitypub/models/ApNoteService.js';
|
||||||
import { AuthenticateService, AuthenticationError } from '@/server/api/AuthenticateService.js';
|
import { AuthenticateService, AuthenticationError } from '@/server/api/AuthenticateService.js';
|
||||||
import { SkRateLimiterService } from '@/server/SkRateLimiterService.js';
|
import { SkRateLimiterService } from '@/server/SkRateLimiterService.js';
|
||||||
import { BucketRateLimit, Keyed, sendRateLimitHeaders } from '@/misc/rate-limit-utils.js';
|
import { BucketRateLimit, Keyed, sendRateLimitHeaders } from '@/misc/rate-limit-utils.js';
|
||||||
import type { MiLocalUser } from '@/models/User.js';
|
import type { MiLocalUser, MiUser } from '@/models/User.js';
|
||||||
import { getIpHash } from '@/misc/get-ip-hash.js';
|
import { getIpHash } from '@/misc/get-ip-hash.js';
|
||||||
import { isRetryableError } from '@/misc/is-retryable-error.js';
|
import { isRetryableError } from '@/misc/is-retryable-error.js';
|
||||||
import type { FastifyRequest, FastifyReply } from 'fastify';
|
import type { FastifyRequest, FastifyReply } from 'fastify';
|
||||||
|
@ -36,10 +36,7 @@ import type { FastifyRequest, FastifyReply } from 'fastify';
|
||||||
export type LocalSummalyResult = SummalyResult & {
|
export type LocalSummalyResult = SummalyResult & {
|
||||||
haveNoteLocally?: boolean;
|
haveNoteLocally?: boolean;
|
||||||
linkAttribution?: {
|
linkAttribution?: {
|
||||||
name: string,
|
user: MiUser,
|
||||||
username: string,
|
|
||||||
avatarUrl: string,
|
|
||||||
avatarBlurhash: string,
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -448,6 +445,10 @@ export class UrlPreviewService {
|
||||||
}
|
}
|
||||||
|
|
||||||
const array = fediverseCreator.split('@');
|
const array = fediverseCreator.split('@');
|
||||||
|
|
||||||
|
// make sure we only have username@host.
|
||||||
|
if (array.length !== 2) return;
|
||||||
|
|
||||||
const username = array[0].toLowerCase();
|
const username = array[0].toLowerCase();
|
||||||
let host: string | null = array[1];
|
let host: string | null = array[1];
|
||||||
if (host.toLowerCase() === this.config.host) {
|
if (host.toLowerCase() === this.config.host) {
|
||||||
|
@ -459,14 +460,11 @@ export class UrlPreviewService {
|
||||||
const attributionDomains = user.attributionDomains;
|
const attributionDomains = user.attributionDomains;
|
||||||
if (attributionDomains.some(x => `.${url.host.toLowerCase()}`.endsWith(`.${x}`))) {
|
if (attributionDomains.some(x => `.${url.host.toLowerCase()}`.endsWith(`.${x}`))) {
|
||||||
summary.linkAttribution = {
|
summary.linkAttribution = {
|
||||||
name: user.name ?? user.username,
|
user: user,
|
||||||
username: fediverseCreator,
|
|
||||||
avatarUrl: user.avatarUrl ?? '',
|
|
||||||
avatarBlurhash: user.avatarBlurhash ?? '',
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
console.warn('user not found: ' + fediverseCreator);
|
this.logger.warn('user not found: ' + fediverseCreator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,13 +65,14 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
</footer>
|
</footer>
|
||||||
</article>
|
</article>
|
||||||
</component>
|
</component>
|
||||||
<footer v-if="linkAttribution" :class="$style.footer" style="text-align: right">
|
<I18n v-if="linkAttribution" :src="i18n.ts.writtenBy" :class="$style.linkAttribution" tag="p">
|
||||||
<a :href="'/@' + linkAttribution.username">
|
<template #user>
|
||||||
<p :class="$style.linkAttribution">{{ i18n.ts.writtenBy }}</p>
|
<MkA v-user-preview="linkAttribution.user.id" :to="userPage(linkAttribution.user)">
|
||||||
<MkImgWithBlurhash :class="$style.linkAttributionIcon" :src="linkAttribution.avatarUrl" :hash="linkAttribution.avatarBlurhash" :cover="true" :onlyAvgColor="true"/>
|
<MkAvatar :class="$style.linkAttributionIcon" :user="linkAttribution.user"/>
|
||||||
<b :class="$style.linkAttribution" style="color: var(--MI_THEME-accent)">{{ linkAttribution.name }}</b>
|
<MkUserName :user="linkAttribution.user" style="color: var(--MI_THEME-accent)"/>
|
||||||
</a>
|
</MkA>
|
||||||
</footer>
|
</template>
|
||||||
|
</I18n>
|
||||||
<template v-if="showActions">
|
<template v-if="showActions">
|
||||||
<div v-if="tweetId" :class="$style.action">
|
<div v-if="tweetId" :class="$style.action">
|
||||||
<MkButton :small="true" inline @click="tweetExpanded = true">
|
<MkButton :small="true" inline @click="tweetExpanded = true">
|
||||||
|
@ -114,6 +115,7 @@ import { misskeyApi } from '@/utility/misskey-api.js';
|
||||||
import { warningExternalWebsite } from '@/utility/warning-external-website.js';
|
import { warningExternalWebsite } from '@/utility/warning-external-website.js';
|
||||||
import DynamicNoteSimple from '@/components/DynamicNoteSimple.vue';
|
import DynamicNoteSimple from '@/components/DynamicNoteSimple.vue';
|
||||||
import { $i } from '@/i';
|
import { $i } from '@/i';
|
||||||
|
import { userPage } from '@/filters/user.js';
|
||||||
|
|
||||||
type SummalyResult = Awaited<ReturnType<typeof summaly>>;
|
type SummalyResult = Awaited<ReturnType<typeof summaly>>;
|
||||||
|
|
||||||
|
@ -155,10 +157,7 @@ const player = ref<SummalyResult['player']>({
|
||||||
allow: [],
|
allow: [],
|
||||||
});
|
});
|
||||||
const linkAttribution = ref<{
|
const linkAttribution = ref<{
|
||||||
name: string,
|
user: Misskey.entities.User,
|
||||||
username: string,
|
|
||||||
avatarUrl: string,
|
|
||||||
avatarBlurhash: string,
|
|
||||||
} | null>(null);
|
} | null>(null);
|
||||||
const playerEnabled = ref(false);
|
const playerEnabled = ref(false);
|
||||||
const tweetId = ref<string | null>(null);
|
const tweetId = ref<string | null>(null);
|
||||||
|
@ -238,10 +237,7 @@ function refresh(withFetch = false) {
|
||||||
.then(async (info: SummalyResult & {
|
.then(async (info: SummalyResult & {
|
||||||
haveNoteLocally?: boolean,
|
haveNoteLocally?: boolean,
|
||||||
linkAttribution?: {
|
linkAttribution?: {
|
||||||
name: string,
|
user: Misskey.entities.User
|
||||||
username: string,
|
|
||||||
avatarUrl: string,
|
|
||||||
avatarBlurhash: string,
|
|
||||||
}
|
}
|
||||||
} | null) => {
|
} | null) => {
|
||||||
unknownUrl.value = info == null;
|
unknownUrl.value = info == null;
|
||||||
|
@ -420,11 +416,11 @@ refresh();
|
||||||
|
|
||||||
.linkAttributionIcon {
|
.linkAttributionIcon {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 1em;
|
width: 16px;
|
||||||
height: 1em;
|
height: 16px;
|
||||||
margin-left: 0.5em;
|
margin-left: 0.25em;
|
||||||
margin-right: 0.25em;
|
margin-right: 0.25em;
|
||||||
vertical-align: top;
|
vertical-align: middle;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
* {
|
* {
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
|
@ -432,11 +428,12 @@ refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
.linkAttribution {
|
.linkAttribution {
|
||||||
|
width: 100%;
|
||||||
font-size: 0.8em;
|
font-size: 0.8em;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin: 0;
|
margin: auto;
|
||||||
line-height: 16px;
|
padding-top: 0.5em;
|
||||||
vertical-align: top;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.action {
|
.action {
|
||||||
|
|
|
@ -220,7 +220,6 @@ const profile = reactive({
|
||||||
isBot: $i.isBot ?? false,
|
isBot: $i.isBot ?? false,
|
||||||
isCat: $i.isCat ?? false,
|
isCat: $i.isCat ?? false,
|
||||||
speakAsCat: $i.speakAsCat ?? false,
|
speakAsCat: $i.speakAsCat ?? false,
|
||||||
attributionDomains: $i.attributionDomains,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(() => profile, () => {
|
watch(() => profile, () => {
|
||||||
|
@ -280,7 +279,6 @@ function save() {
|
||||||
isBot: !!profile.isBot,
|
isBot: !!profile.isBot,
|
||||||
isCat: !!profile.isCat,
|
isCat: !!profile.isCat,
|
||||||
speakAsCat: !!profile.speakAsCat,
|
speakAsCat: !!profile.speakAsCat,
|
||||||
attributionDomains: !!profile.attributionDomains,
|
|
||||||
}, undefined, {
|
}, undefined, {
|
||||||
'0b3f9f6a-2f4d-4b1f-9fb4-49d3a2fd7191': {
|
'0b3f9f6a-2f4d-4b1f-9fb4-49d3a2fd7191': {
|
||||||
title: i18n.ts.yourNameContainsProhibitedWords,
|
title: i18n.ts.yourNameContainsProhibitedWords,
|
||||||
|
|
|
@ -592,4 +592,4 @@ translationTimeoutCaption: "Timeout in milliseconds for translation API requests
|
||||||
|
|
||||||
attributionDomains: "Attribution Domains"
|
attributionDomains: "Attribution Domains"
|
||||||
attributionDomainsDescription: "A list of domains whose content can be attributed to you on link previews, separated by new-line. Any subdomain will also be valid. The following needs to be on the webpage:"
|
attributionDomainsDescription: "A list of domains whose content can be attributed to you on link previews, separated by new-line. Any subdomain will also be valid. The following needs to be on the webpage:"
|
||||||
writtenBy: "Written by"
|
writtenBy: "Written by {user}"
|
||||||
|
|
|
@ -9,4 +9,4 @@ pinnedOnly: "Fixado"
|
||||||
blockingYou: "Bloqueando você"
|
blockingYou: "Bloqueando você"
|
||||||
attributionDomains: "Domínios de Atribuição"
|
attributionDomains: "Domínios de Atribuição"
|
||||||
attributionDomainsDescription: "Uma lista de domínios cujo conteúdo pode ser atribuído a você em prévias de link, separadas por linha. Qualquer subdomínio também será válido. O código seguinte precisa estar presente na página:"
|
attributionDomainsDescription: "Uma lista de domínios cujo conteúdo pode ser atribuído a você em prévias de link, separadas por linha. Qualquer subdomínio também será válido. O código seguinte precisa estar presente na página:"
|
||||||
writtenBy: "Escrito por"
|
writtenBy: "Escrito por {user}"
|
||||||
|
|
Loading…
Add table
Reference in a new issue