Compare commits
48 Commits
12.110.0-s
...
sim-dev-em
Author | SHA1 | Date | |
---|---|---|---|
8db8fc605f | |||
4c71d05f51 | |||
da8cb8fc73 | |||
aecc01fd8a | |||
ffeb109afd | |||
042d5f8c2d | |||
39f2ccf8a3 | |||
55f0e23a74 | |||
b4edc40fa8 | |||
562e4fd743 | |||
db7abd17fb | |||
fb1781ca53 | |||
17af085bef | |||
5d23cf8c58 | |||
e051b7719d | |||
522e148146 | |||
04c7dcd201 | |||
744310dc4e | |||
7d62342477 | |||
025dc3d6f9 | |||
98f412a172 | |||
970f373cae | |||
c8331b5822 | |||
a8337b0964 | |||
85cc716781 | |||
14990a1bd1 | |||
6b9f0d800e | |||
3e96cc2b6b | |||
5dad50767e | |||
b54e63f835 | |||
d59a072de7 | |||
5e3554d693 | |||
8b3e7bf04c | |||
15a1f1e585 | |||
8db5ec2919 | |||
c7e1bdf701 | |||
4d1b6b1c24 | |||
7a2c54cbd9 | |||
3a896e220a | |||
3499ba5456 | |||
641a565a86 | |||
300a84f3c4 | |||
545671818a | |||
22b647d97d | |||
3658f19d98 | |||
e213c2e844 | |||
dd86397e85 | |||
6d33b366f8 |
@ -10,6 +10,12 @@
|
|||||||
You should also include the user name that made the change.
|
You should also include the user name that made the change.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
## 12.110.1 (2022/04/23)
|
||||||
|
|
||||||
|
### Bugfixes
|
||||||
|
- Fix GOP rendering @syuilo
|
||||||
|
- Improve performance of antenna, clip, and list @xianon
|
||||||
|
|
||||||
## 12.110.0 (2022/04/11)
|
## 12.110.0 (2022/04/11)
|
||||||
|
|
||||||
### Improvements
|
### Improvements
|
||||||
|
@ -1,126 +0,0 @@
|
|||||||
---
|
|
||||||
ok: "Bone"
|
|
||||||
exportRequested: "Vi petis elporton. Ĝi povas bezoni longan tempon. Elportaĵo estos aldonita al disko post elportado."
|
|
||||||
importRequested: "Vi petis enportadon. Ĝi povas bezoni longan tempon. "
|
|
||||||
pageLoadError: "Fuŝiĝis enlegi paĝon."
|
|
||||||
pageLoadErrorDescription: "Ordinare tio okazas pro la retkondiĉo aŭ la staplo de retumilo.\nPurigu la staplon, aŭ refaru poste. "
|
|
||||||
youShouldUpgradeClient: "Por montri ĉi paĝon, bonvolu enlegi refoje kaj uzi klienton novversian."
|
|
||||||
flagAsCatDescription: "Flagu por montri ke la konton havas kato."
|
|
||||||
flagShowTimelineReplies: "Montri respondon de notoj en templinio."
|
|
||||||
intro: "Instalado de Misskey finiĝis! Kreu administran konton."
|
|
||||||
whenServerDisconnected: "Kiam vi malligiĝas de servilo"
|
|
||||||
caseSensitive: "Distingi usklecon"
|
|
||||||
markAsReadAllUnreadNotes: "Marki ĉiujn afiŝojn kiel legita"
|
|
||||||
checking: "kontrolante..."
|
|
||||||
signinFailed: "Fuŝiĝis ensaluti. Bonvolu kontroli uzantnomon kaj pasvorton."
|
|
||||||
promote: "Reklamata"
|
|
||||||
updateRemoteUser: "Aktualigi informon de foraj uzantoj"
|
|
||||||
yourAccountSuspendedTitle: "La konto estas frostigita."
|
|
||||||
tokenRequested: "Alirpermeso al konto"
|
|
||||||
abuseReports: "Raportoj"
|
|
||||||
reportAbuse: "Raportoj"
|
|
||||||
reportAbuseOf: "raporti {name}n"
|
|
||||||
reporter: "Informanto"
|
|
||||||
reporterOrigin: "Raportanto"
|
|
||||||
pollVotesCount: "Nombro de voĉdonado"
|
|
||||||
invalidValue: "Nevalida valoro"
|
|
||||||
notRecommended: "Evitindaj"
|
|
||||||
switchAccount: "Ŝanĝi konton"
|
|
||||||
configure: "Agordi"
|
|
||||||
popularPosts: "Populara noto"
|
|
||||||
expiration: "Limtempo"
|
|
||||||
priority: "Prioritato"
|
|
||||||
squareAvatars: "Montri bildsimbolon kiel kvadrata"
|
|
||||||
misskeyUpdated: "Misskey ĝisdatiĝis!"
|
|
||||||
whatIsNew: "Montri novaĵojn"
|
|
||||||
accountDeletionInProgress: "La konto estas forviŝanta."
|
|
||||||
resolved: "Solvita"
|
|
||||||
unresolved: "Nesolvita"
|
|
||||||
filter: "Filtrilo"
|
|
||||||
deleteAccountConfirm: "La konto estos forviŝita. Ĉu vi daŭrigas fari?"
|
|
||||||
voteConfirm: "Ĉu vi voĉdonas {choice}n?"
|
|
||||||
hide: "Kaŝi"
|
|
||||||
overridedDeviceKind: "tipo de aparato"
|
|
||||||
size: "Grandeco"
|
|
||||||
searchByGoogle: "Serĉi en Guglo-Serĉilo"
|
|
||||||
mutePeriod: "Daŭro de silentigo"
|
|
||||||
indefinitely: "Sen limdato"
|
|
||||||
tenMinutes: "Je 10 minutoj"
|
|
||||||
oneHour: "Je 1 horo"
|
|
||||||
oneDay: "Je 1 tago"
|
|
||||||
oneWeek: "Je 1 semajno"
|
|
||||||
failedToFetchAccountInformation: "Malsukcesas akiri informon de konto"
|
|
||||||
_emailUnavailable:
|
|
||||||
mx: "Ĉi retpoŝto-servilo ne estas uzebla."
|
|
||||||
_signup:
|
|
||||||
almostThere: "Preskaŭ plenumita"
|
|
||||||
_accountDelete:
|
|
||||||
requestAccountDelete: "Peti forviŝi konton"
|
|
||||||
started: "Forviŝado komenciĝis."
|
|
||||||
_gallery:
|
|
||||||
my: "Mia afiŝo"
|
|
||||||
_aboutMisskey:
|
|
||||||
donate: "Mondonaci al Misskey"
|
|
||||||
_channel:
|
|
||||||
notesCount: "{n} notoj"
|
|
||||||
_theme:
|
|
||||||
explore: "Serĉi koloraron"
|
|
||||||
install: "Instali koloraron"
|
|
||||||
installedThemes: "Instalita koloraro"
|
|
||||||
make: "Krei koloraron"
|
|
||||||
addConstant: "Aldoni konstanton"
|
|
||||||
constant: "Konstanto"
|
|
||||||
keys:
|
|
||||||
shadow: "Ombro"
|
|
||||||
infoBg: "Fono de informo"
|
|
||||||
_widgets:
|
|
||||||
photos: "Fotoj"
|
|
||||||
_cw:
|
|
||||||
chars: "{count} literoj"
|
|
||||||
_poll:
|
|
||||||
expiration: "Limtempo"
|
|
||||||
_pages:
|
|
||||||
script:
|
|
||||||
blocks:
|
|
||||||
_add:
|
|
||||||
arg1: "A"
|
|
||||||
arg2: "B"
|
|
||||||
_subtract:
|
|
||||||
arg1: "A"
|
|
||||||
arg2: "B"
|
|
||||||
_multiply:
|
|
||||||
arg1: "A"
|
|
||||||
arg2: "B"
|
|
||||||
_divide:
|
|
||||||
arg1: "A"
|
|
||||||
arg2: "B"
|
|
||||||
_mod:
|
|
||||||
arg1: "A"
|
|
||||||
arg2: "B"
|
|
||||||
_eq:
|
|
||||||
arg1: "A"
|
|
||||||
arg2: "B"
|
|
||||||
_notEq:
|
|
||||||
arg1: "A"
|
|
||||||
arg2: "B"
|
|
||||||
_and:
|
|
||||||
arg1: "A"
|
|
||||||
arg2: "B"
|
|
||||||
_or:
|
|
||||||
arg1: "A"
|
|
||||||
arg2: "B"
|
|
||||||
_lt:
|
|
||||||
arg1: "A"
|
|
||||||
arg2: "B"
|
|
||||||
_gt:
|
|
||||||
arg1: "A"
|
|
||||||
arg2: "B"
|
|
||||||
_ltEq:
|
|
||||||
arg1: "A"
|
|
||||||
arg2: "B"
|
|
||||||
_gtEq:
|
|
||||||
arg1: "A"
|
|
||||||
arg2: "B"
|
|
||||||
_notification:
|
|
||||||
_types:
|
|
||||||
pollEnded: "Enketo finiĝis"
|
|
@ -19,7 +19,6 @@ const languages = [
|
|||||||
'da-DK',
|
'da-DK',
|
||||||
'de-DE',
|
'de-DE',
|
||||||
'en-US',
|
'en-US',
|
||||||
'eo-UY',
|
|
||||||
'es-ES',
|
'es-ES',
|
||||||
'fr-FR',
|
'fr-FR',
|
||||||
'id-ID',
|
'id-ID',
|
||||||
|
@ -827,6 +827,14 @@ leaveGroupConfirm: "「{name}」から抜けるにゃ?"
|
|||||||
useDrawerReactionPickerForMobile: "モバイルデバイスのときドロワーで表示"
|
useDrawerReactionPickerForMobile: "モバイルデバイスのときドロワーで表示"
|
||||||
welcomeBackWithName: "おかえりにゃさいにゃ、{name}さん!"
|
welcomeBackWithName: "おかえりにゃさいにゃ、{name}さん!"
|
||||||
clickToFinishEmailVerification: "[{ok}]を押して、メールアドレスの確認を完了してくださいにゃ。"
|
clickToFinishEmailVerification: "[{ok}]を押して、メールアドレスの確認を完了してくださいにゃ。"
|
||||||
|
emojiGen: "絵文字を生成"
|
||||||
|
emojiAlign: "文字揃え"
|
||||||
|
emojiSizeSetting: "サイズ調整"
|
||||||
|
emojiSizeFixed: "文字サイズを固定する"
|
||||||
|
emojiStretch: "自動で伸縮しない"
|
||||||
|
emojiGenerate: "生成"
|
||||||
|
emojiColor: "カラーコード"
|
||||||
|
emojiApproval: "絵文字を登録"
|
||||||
|
|
||||||
_emailUnavailable:
|
_emailUnavailable:
|
||||||
used: "既に使用されているにゃ"
|
used: "既に使用されているにゃ"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "misskey",
|
"name": "misskey",
|
||||||
"version": "12.110.0-simkey-v1",
|
"version": "12.110.1-simkey-v1",
|
||||||
"codename": "indigo",
|
"codename": "indigo",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { Entity, Column, Index, OneToOne, JoinColumn, PrimaryColumn } from 'typeorm';
|
import { Entity, Column, Index, OneToOne, JoinColumn, PrimaryColumn } from 'typeorm';
|
||||||
import { DriveFile } from './drive-file.js';
|
|
||||||
import { id } from '../id.js';
|
import { id } from '../id.js';
|
||||||
|
import { DriveFile } from './drive-file.js';
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
@Index(['usernameLower', 'host'], { unique: true })
|
@Index(['usernameLower', 'host'], { unique: true })
|
||||||
@ -207,7 +207,7 @@ export class User {
|
|||||||
|
|
||||||
@Column('boolean', {
|
@Column('boolean', {
|
||||||
default: false,
|
default: false,
|
||||||
comment: 'Whether to show users replying to other users in the timeline'
|
comment: 'Whether to show users replying to other users in the timeline',
|
||||||
})
|
})
|
||||||
public showTimelineReplies: boolean;
|
public showTimelineReplies: boolean;
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import { EntityRepository, Repository, In, Not } from 'typeorm';
|
import { EntityRepository, Repository, In, Not } from 'typeorm';
|
||||||
import Ajv from 'ajv';
|
import Ajv from 'ajv';
|
||||||
import { User, ILocalUser, IRemoteUser } from '@/models/entities/user.js';
|
import { User, ILocalUser, IRemoteUser } from '@/models/entities/user.js';
|
||||||
import { Notes, NoteUnreads, FollowRequests, Notifications, MessagingMessages, UserNotePinings, Followings, Blockings, Mutings, UserProfiles, UserSecurityKeys, UserGroupJoinings, Pages, Announcements, AnnouncementReads, Antennas, AntennaNotes, ChannelFollowings, Instances, DriveFiles } from '../index.js';
|
|
||||||
import config from '@/config/index.js';
|
import config from '@/config/index.js';
|
||||||
import { Packed } from '@/misc/schema.js';
|
import { Packed } from '@/misc/schema.js';
|
||||||
import { awaitAll, Promiseable } from '@/prelude/await-all.js';
|
import { awaitAll, Promiseable } from '@/prelude/await-all.js';
|
||||||
@ -9,8 +8,9 @@ import { populateEmojis } from '@/misc/populate-emojis.js';
|
|||||||
import { getAntennas } from '@/misc/antenna-cache.js';
|
import { getAntennas } from '@/misc/antenna-cache.js';
|
||||||
import { USER_ACTIVE_THRESHOLD, USER_ONLINE_THRESHOLD } from '@/const.js';
|
import { USER_ACTIVE_THRESHOLD, USER_ONLINE_THRESHOLD } from '@/const.js';
|
||||||
import { Cache } from '@/misc/cache.js';
|
import { Cache } from '@/misc/cache.js';
|
||||||
import { Instance } from '../entities/instance.js';
|
|
||||||
import { db } from '@/db/postgre.js';
|
import { db } from '@/db/postgre.js';
|
||||||
|
import { Instance } from '../entities/instance.js';
|
||||||
|
import { Notes, NoteUnreads, FollowRequests, Notifications, MessagingMessages, UserNotePinings, Followings, Blockings, Mutings, UserProfiles, UserSecurityKeys, UserGroupJoinings, Pages, Announcements, AnnouncementReads, Antennas, AntennaNotes, ChannelFollowings, Instances, DriveFiles } from '../index.js';
|
||||||
|
|
||||||
const userInstanceCache = new Cache<Instance | null>(1000 * 60 * 60 * 3);
|
const userInstanceCache = new Cache<Instance | null>(1000 * 60 * 60 * 3);
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ export const UserRepository = db.getRepository(User).extend({
|
|||||||
const joinings = await UserGroupJoinings.findBy({ userId: userId });
|
const joinings = await UserGroupJoinings.findBy({ userId: userId });
|
||||||
|
|
||||||
const groupQs = Promise.all(joinings.map(j => MessagingMessages.createQueryBuilder('message')
|
const groupQs = Promise.all(joinings.map(j => MessagingMessages.createQueryBuilder('message')
|
||||||
.where(`message.groupId = :groupId`, { groupId: j.userGroupId })
|
.where('message.groupId = :groupId', { groupId: j.userGroupId })
|
||||||
.andWhere('message.userId != :userId', { userId: userId })
|
.andWhere('message.userId != :userId', { userId: userId })
|
||||||
.andWhere('NOT (:userId = ANY(message.reads))', { userId: userId })
|
.andWhere('NOT (:userId = ANY(message.reads))', { userId: userId })
|
||||||
.andWhere('message.createdAt > :joinedAt', { joinedAt: j.createdAt }) // 自分が加入する前の会話については、未読扱いしない
|
.andWhere('message.createdAt > :joinedAt', { joinedAt: j.createdAt }) // 自分が加入する前の会話については、未読扱いしない
|
||||||
@ -204,8 +204,18 @@ export const UserRepository = db.getRepository(User).extend({
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
getAvatarUrl(user: User): string {
|
async getAvatarUrl(user: User): Promise<string> {
|
||||||
// TODO: avatarIdがあるがavatarがない(JOINされてない)場合のハンドリング
|
if (user.avatar) {
|
||||||
|
return DriveFiles.getPublicUrl(user.avatar, true) || this.getIdenticonUrl(user.id);
|
||||||
|
} else if (user.avatarId) {
|
||||||
|
const avatar = await DriveFiles.findOneByOrFail({ id: user.avatarId });
|
||||||
|
return DriveFiles.getPublicUrl(avatar, true) || this.getIdenticonUrl(user.id);
|
||||||
|
} else {
|
||||||
|
return this.getIdenticonUrl(user.id);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
getAvatarUrlSync(user: User): string {
|
||||||
if (user.avatar) {
|
if (user.avatar) {
|
||||||
return DriveFiles.getPublicUrl(user.avatar, true) || this.getIdenticonUrl(user.id);
|
return DriveFiles.getPublicUrl(user.avatar, true) || this.getIdenticonUrl(user.id);
|
||||||
} else {
|
} else {
|
||||||
@ -223,7 +233,7 @@ export const UserRepository = db.getRepository(User).extend({
|
|||||||
options?: {
|
options?: {
|
||||||
detail?: D,
|
detail?: D,
|
||||||
includeSecrets?: boolean,
|
includeSecrets?: boolean,
|
||||||
}
|
},
|
||||||
): Promise<IsMeAndIsUserDetailed<ExpectsMe, D>> {
|
): Promise<IsMeAndIsUserDetailed<ExpectsMe, D>> {
|
||||||
const opts = Object.assign({
|
const opts = Object.assign({
|
||||||
detail: false,
|
detail: false,
|
||||||
@ -274,7 +284,7 @@ export const UserRepository = db.getRepository(User).extend({
|
|||||||
name: user.name,
|
name: user.name,
|
||||||
username: user.username,
|
username: user.username,
|
||||||
host: user.host,
|
host: user.host,
|
||||||
avatarUrl: this.getAvatarUrl(user),
|
avatarUrl: this.getAvatarUrlSync(user),
|
||||||
avatarBlurhash: user.avatar?.blurhash || null,
|
avatarBlurhash: user.avatar?.blurhash || null,
|
||||||
avatarColor: null, // 後方互換性のため
|
avatarColor: null, // 後方互換性のため
|
||||||
isAdmin: user.isAdmin || falsy,
|
isAdmin: user.isAdmin || falsy,
|
||||||
@ -283,7 +293,7 @@ export const UserRepository = db.getRepository(User).extend({
|
|||||||
isCat: user.isCat || falsy,
|
isCat: user.isCat || falsy,
|
||||||
instance: user.host ? userInstanceCache.fetch(user.host,
|
instance: user.host ? userInstanceCache.fetch(user.host,
|
||||||
() => Instances.findOneBy({ host: user.host! }),
|
() => Instances.findOneBy({ host: user.host! }),
|
||||||
v => v != null
|
v => v != null,
|
||||||
).then(instance => instance ? {
|
).then(instance => instance ? {
|
||||||
name: instance.name,
|
name: instance.name,
|
||||||
softwareName: instance.softwareName,
|
softwareName: instance.softwareName,
|
||||||
@ -403,7 +413,7 @@ export const UserRepository = db.getRepository(User).extend({
|
|||||||
options?: {
|
options?: {
|
||||||
detail?: D,
|
detail?: D,
|
||||||
includeSecrets?: boolean,
|
includeSecrets?: boolean,
|
||||||
}
|
},
|
||||||
): Promise<IsUserDetailed<D>[]> {
|
): Promise<IsUserDetailed<D>[]> {
|
||||||
return Promise.all(users.map(u => this.pack(u, me, options)));
|
return Promise.all(users.map(u => this.pack(u, me, options)));
|
||||||
},
|
},
|
||||||
|
@ -9,7 +9,7 @@ import { publishMainStream } from '@/services/stream.js';
|
|||||||
export default function(ctx: Koa.Context, user: ILocalUser, redirect = false) {
|
export default function(ctx: Koa.Context, user: ILocalUser, redirect = false) {
|
||||||
if (redirect) {
|
if (redirect) {
|
||||||
//#region Cookie
|
//#region Cookie
|
||||||
ctx.cookies.set('igi', user.token, {
|
ctx.cookies.set('igi', user.token!, {
|
||||||
path: '/',
|
path: '/',
|
||||||
// SEE: https://github.com/koajs/koa/issues/974
|
// SEE: https://github.com/koajs/koa/issues/974
|
||||||
// When using a SSL proxy it should be configured to add the "X-Forwarded-Proto: https" header
|
// When using a SSL proxy it should be configured to add the "X-Forwarded-Proto: https" header
|
||||||
|
@ -57,13 +57,9 @@ export default define(meta, paramDef, async (ps, user) => {
|
|||||||
throw new ApiError(meta.errors.noSuchAntenna);
|
throw new ApiError(meta.errors.noSuchAntenna);
|
||||||
}
|
}
|
||||||
|
|
||||||
const antennaQuery = AntennaNotes.createQueryBuilder('joining')
|
|
||||||
.select('joining.noteId')
|
|
||||||
.where('joining.antennaId = :antennaId', { antennaId: antenna.id });
|
|
||||||
|
|
||||||
const query = makePaginationQuery(Notes.createQueryBuilder('note'),
|
const query = makePaginationQuery(Notes.createQueryBuilder('note'),
|
||||||
ps.sinceId, ps.untilId, ps.sinceDate, ps.untilDate)
|
ps.sinceId, ps.untilId, ps.sinceDate, ps.untilDate)
|
||||||
.andWhere(`note.id IN (${ antennaQuery.getQuery() })`)
|
.innerJoin(AntennaNotes.metadata.targetName, 'antennaNote', 'antennaNote.noteId = note.id')
|
||||||
.innerJoinAndSelect('note.user', 'user')
|
.innerJoinAndSelect('note.user', 'user')
|
||||||
.leftJoinAndSelect('user.avatar', 'avatar')
|
.leftJoinAndSelect('user.avatar', 'avatar')
|
||||||
.leftJoinAndSelect('user.banner', 'banner')
|
.leftJoinAndSelect('user.banner', 'banner')
|
||||||
@ -75,7 +71,7 @@ export default define(meta, paramDef, async (ps, user) => {
|
|||||||
.leftJoinAndSelect('renote.user', 'renoteUser')
|
.leftJoinAndSelect('renote.user', 'renoteUser')
|
||||||
.leftJoinAndSelect('renoteUser.avatar', 'renoteUserAvatar')
|
.leftJoinAndSelect('renoteUser.avatar', 'renoteUserAvatar')
|
||||||
.leftJoinAndSelect('renoteUser.banner', 'renoteUserBanner')
|
.leftJoinAndSelect('renoteUser.banner', 'renoteUserBanner')
|
||||||
.setParameters(antennaQuery.getParameters());
|
.andWhere('antennaNote.antennaId = :antennaId', { antennaId: antenna.id });
|
||||||
|
|
||||||
generateVisibilityQuery(query, user);
|
generateVisibilityQuery(query, user);
|
||||||
generateMutedUserQuery(query, user);
|
generateMutedUserQuery(query, user);
|
||||||
|
@ -57,12 +57,8 @@ export default define(meta, paramDef, async (ps, user) => {
|
|||||||
throw new ApiError(meta.errors.noSuchClip);
|
throw new ApiError(meta.errors.noSuchClip);
|
||||||
}
|
}
|
||||||
|
|
||||||
const clipQuery = ClipNotes.createQueryBuilder('joining')
|
|
||||||
.select('joining.noteId')
|
|
||||||
.where('joining.clipId = :clipId', { clipId: clip.id });
|
|
||||||
|
|
||||||
const query = makePaginationQuery(Notes.createQueryBuilder('note'), ps.sinceId, ps.untilId)
|
const query = makePaginationQuery(Notes.createQueryBuilder('note'), ps.sinceId, ps.untilId)
|
||||||
.andWhere(`note.id IN (${ clipQuery.getQuery() })`)
|
.innerJoin(ClipNotes.metadata.targetName, 'clipNote', 'clipNote.noteId = note.id')
|
||||||
.innerJoinAndSelect('note.user', 'user')
|
.innerJoinAndSelect('note.user', 'user')
|
||||||
.leftJoinAndSelect('user.avatar', 'avatar')
|
.leftJoinAndSelect('user.avatar', 'avatar')
|
||||||
.leftJoinAndSelect('user.banner', 'banner')
|
.leftJoinAndSelect('user.banner', 'banner')
|
||||||
@ -74,7 +70,7 @@ export default define(meta, paramDef, async (ps, user) => {
|
|||||||
.leftJoinAndSelect('renote.user', 'renoteUser')
|
.leftJoinAndSelect('renote.user', 'renoteUser')
|
||||||
.leftJoinAndSelect('renoteUser.avatar', 'renoteUserAvatar')
|
.leftJoinAndSelect('renoteUser.avatar', 'renoteUserAvatar')
|
||||||
.leftJoinAndSelect('renoteUser.banner', 'renoteUserBanner')
|
.leftJoinAndSelect('renoteUser.banner', 'renoteUserBanner')
|
||||||
.setParameters(clipQuery.getParameters());
|
.andWhere('clipNote.clipId = :clipId', { clipId: clip.id });
|
||||||
|
|
||||||
if (user) {
|
if (user) {
|
||||||
generateVisibilityQuery(query, user);
|
generateVisibilityQuery(query, user);
|
||||||
|
@ -63,12 +63,8 @@ export default define(meta, paramDef, async (ps, user) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//#region Construct query
|
//#region Construct query
|
||||||
const listQuery = UserListJoinings.createQueryBuilder('joining')
|
|
||||||
.select('joining.userId')
|
|
||||||
.where('joining.userListId = :userListId', { userListId: list.id });
|
|
||||||
|
|
||||||
const query = makePaginationQuery(Notes.createQueryBuilder('note'), ps.sinceId, ps.untilId)
|
const query = makePaginationQuery(Notes.createQueryBuilder('note'), ps.sinceId, ps.untilId)
|
||||||
.andWhere(`note.userId IN (${ listQuery.getQuery() })`)
|
.innerJoin(UserListJoinings.metadata.targetName, 'userListJoining', 'userListJoining.userId = note.userId')
|
||||||
.innerJoinAndSelect('note.user', 'user')
|
.innerJoinAndSelect('note.user', 'user')
|
||||||
.leftJoinAndSelect('user.avatar', 'avatar')
|
.leftJoinAndSelect('user.avatar', 'avatar')
|
||||||
.leftJoinAndSelect('user.banner', 'banner')
|
.leftJoinAndSelect('user.banner', 'banner')
|
||||||
@ -80,7 +76,7 @@ export default define(meta, paramDef, async (ps, user) => {
|
|||||||
.leftJoinAndSelect('renote.user', 'renoteUser')
|
.leftJoinAndSelect('renote.user', 'renoteUser')
|
||||||
.leftJoinAndSelect('renoteUser.avatar', 'renoteUserAvatar')
|
.leftJoinAndSelect('renoteUser.avatar', 'renoteUserAvatar')
|
||||||
.leftJoinAndSelect('renoteUser.banner', 'renoteUserBanner')
|
.leftJoinAndSelect('renoteUser.banner', 'renoteUserBanner')
|
||||||
.setParameters(listQuery.getParameters());
|
.andWhere('userListJoining.userListId = :userListId', { userListId: list.id });
|
||||||
|
|
||||||
generateVisibilityQuery(query, user);
|
generateVisibilityQuery(query, user);
|
||||||
|
|
||||||
|
@ -10,23 +10,23 @@ import mount from 'koa-mount';
|
|||||||
import koaLogger from 'koa-logger';
|
import koaLogger from 'koa-logger';
|
||||||
import * as slow from 'koa-slow';
|
import * as slow from 'koa-slow';
|
||||||
|
|
||||||
import activityPub from './activitypub.js';
|
import { IsNull } from 'typeorm';
|
||||||
import nodeinfo from './nodeinfo.js';
|
|
||||||
import wellKnown from './well-known.js';
|
|
||||||
import config from '@/config/index.js';
|
import config from '@/config/index.js';
|
||||||
import apiServer from './api/index.js';
|
|
||||||
import fileServer from './file/index.js';
|
|
||||||
import proxyServer from './proxy/index.js';
|
|
||||||
import webServer from './web/index.js';
|
|
||||||
import Logger from '@/services/logger.js';
|
import Logger from '@/services/logger.js';
|
||||||
import { envOption } from '../env.js';
|
|
||||||
import { UserProfiles, Users } from '@/models/index.js';
|
import { UserProfiles, Users } from '@/models/index.js';
|
||||||
import { genIdenticon } from '@/misc/gen-identicon.js';
|
import { genIdenticon } from '@/misc/gen-identicon.js';
|
||||||
import { createTemp } from '@/misc/create-temp.js';
|
import { createTemp } from '@/misc/create-temp.js';
|
||||||
import { publishMainStream } from '@/services/stream.js';
|
import { publishMainStream } from '@/services/stream.js';
|
||||||
import * as Acct from '@/misc/acct.js';
|
import * as Acct from '@/misc/acct.js';
|
||||||
|
import { envOption } from '../env.js';
|
||||||
|
import activityPub from './activitypub.js';
|
||||||
|
import nodeinfo from './nodeinfo.js';
|
||||||
|
import wellKnown from './well-known.js';
|
||||||
|
import apiServer from './api/index.js';
|
||||||
|
import fileServer from './file/index.js';
|
||||||
|
import proxyServer from './proxy/index.js';
|
||||||
|
import webServer from './web/index.js';
|
||||||
import { initializeStreamingServer } from './api/streaming.js';
|
import { initializeStreamingServer } from './api/streaming.js';
|
||||||
import { IsNull } from 'typeorm';
|
|
||||||
|
|
||||||
export const serverLogger = new Logger('server', 'gray', false);
|
export const serverLogger = new Logger('server', 'gray', false);
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ router.get('/avatar/@:acct', async ctx => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (user) {
|
if (user) {
|
||||||
ctx.redirect(Users.getAvatarUrl(user));
|
ctx.redirect(Users.getAvatarUrlSync(user));
|
||||||
} else {
|
} else {
|
||||||
ctx.redirect('/static-assets/user-unknown.png');
|
ctx.redirect('/static-assets/user-unknown.png');
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { Feed } from 'feed';
|
import { Feed } from 'feed';
|
||||||
|
import { In, IsNull } from 'typeorm';
|
||||||
import config from '@/config/index.js';
|
import config from '@/config/index.js';
|
||||||
import { User } from '@/models/entities/user.js';
|
import { User } from '@/models/entities/user.js';
|
||||||
import { Notes, DriveFiles, UserProfiles } from '@/models/index.js';
|
import { Notes, DriveFiles, UserProfiles, Users } from '@/models/index.js';
|
||||||
import { In, IsNull } from 'typeorm';
|
|
||||||
|
|
||||||
export default async function(user: User) {
|
export default async function(user: User) {
|
||||||
const author = {
|
const author = {
|
||||||
@ -29,7 +29,7 @@ export default async function(user: User) {
|
|||||||
generator: 'Misskey',
|
generator: 'Misskey',
|
||||||
description: `${user.notesCount} Notes, ${profile.ffVisibility === 'public' ? user.followingCount : '?'} Following, ${profile.ffVisibility === 'public' ? user.followersCount : '?'} Followers${profile.description ? ` · ${profile.description}` : ''}`,
|
description: `${user.notesCount} Notes, ${profile.ffVisibility === 'public' ? user.followingCount : '?'} Following, ${profile.ffVisibility === 'public' ? user.followersCount : '?'} Followers${profile.description ? ` · ${profile.description}` : ''}`,
|
||||||
link: author.link,
|
link: author.link,
|
||||||
image: user.avatarUrl ? user.avatarUrl : undefined,
|
image: await Users.getAvatarUrl(user),
|
||||||
feedLinks: {
|
feedLinks: {
|
||||||
json: `${author.link}.json`,
|
json: `${author.link}.json`,
|
||||||
atom: `${author.link}.atom`,
|
atom: `${author.link}.atom`,
|
||||||
|
@ -14,17 +14,17 @@ import { createBullBoard } from '@bull-board/api';
|
|||||||
import { BullAdapter } from '@bull-board/api/bullAdapter.js';
|
import { BullAdapter } from '@bull-board/api/bullAdapter.js';
|
||||||
import { KoaAdapter } from '@bull-board/koa';
|
import { KoaAdapter } from '@bull-board/koa';
|
||||||
|
|
||||||
import packFeed from './feed.js';
|
import { IsNull } from 'typeorm';
|
||||||
import { fetchMeta } from '@/misc/fetch-meta.js';
|
import { fetchMeta } from '@/misc/fetch-meta.js';
|
||||||
import { genOpenapiSpec } from '../api/openapi/gen-spec.js';
|
|
||||||
import config from '@/config/index.js';
|
import config from '@/config/index.js';
|
||||||
import { Users, Notes, UserProfiles, Pages, Channels, Clips, GalleryPosts } from '@/models/index.js';
|
import { Users, Notes, UserProfiles, Pages, Channels, Clips, GalleryPosts } from '@/models/index.js';
|
||||||
import * as Acct from '@/misc/acct.js';
|
import * as Acct from '@/misc/acct.js';
|
||||||
import { getNoteSummary } from '@/misc/get-note-summary.js';
|
import { getNoteSummary } from '@/misc/get-note-summary.js';
|
||||||
|
import { queues } from '@/queue/queues.js';
|
||||||
|
import { genOpenapiSpec } from '../api/openapi/gen-spec.js';
|
||||||
import { urlPreviewHandler } from './url-preview.js';
|
import { urlPreviewHandler } from './url-preview.js';
|
||||||
import { manifestHandler } from './manifest.js';
|
import { manifestHandler } from './manifest.js';
|
||||||
import { queues } from '@/queue/queues.js';
|
import packFeed from './feed.js';
|
||||||
import { IsNull } from 'typeorm';
|
|
||||||
|
|
||||||
const _filename = fileURLToPath(import.meta.url);
|
const _filename = fileURLToPath(import.meta.url);
|
||||||
const _dirname = dirname(_filename);
|
const _dirname = dirname(_filename);
|
||||||
@ -127,7 +127,7 @@ router.get('/twemoji/(.*)', async ctx => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.set('Content-Security-Policy', `default-src 'none'; style-src 'unsafe-inline'`);
|
ctx.set('Content-Security-Policy', 'default-src \'none\'; style-src \'unsafe-inline\'');
|
||||||
|
|
||||||
await send(ctx as any, path, {
|
await send(ctx as any, path, {
|
||||||
root: `${_dirname}/../../../node_modules/@discordapp/twemoji/dist/svg/`,
|
root: `${_dirname}/../../../node_modules/@discordapp/twemoji/dist/svg/`,
|
||||||
@ -235,6 +235,7 @@ router.get(['/@:user', '/@:user/:sub'], async (ctx, next) => {
|
|||||||
|
|
||||||
await ctx.render('user', {
|
await ctx.render('user', {
|
||||||
user, profile, me,
|
user, profile, me,
|
||||||
|
avatarUrl: await Users.getAvatarUrl(user),
|
||||||
sub: ctx.params.sub,
|
sub: ctx.params.sub,
|
||||||
instanceName: meta.name || 'Misskey',
|
instanceName: meta.name || 'Misskey',
|
||||||
icon: meta.iconUrl,
|
icon: meta.iconUrl,
|
||||||
@ -274,6 +275,7 @@ router.get('/notes/:note', async (ctx, next) => {
|
|||||||
await ctx.render('note', {
|
await ctx.render('note', {
|
||||||
note: _note,
|
note: _note,
|
||||||
profile,
|
profile,
|
||||||
|
avatarUrl: await Users.getAvatarUrl(await Users.findOneByOrFail({ id: note.userId })),
|
||||||
// TODO: Let locale changeable by instance setting
|
// TODO: Let locale changeable by instance setting
|
||||||
summary: getNoteSummary(_note),
|
summary: getNoteSummary(_note),
|
||||||
instanceName: meta.name || 'Misskey',
|
instanceName: meta.name || 'Misskey',
|
||||||
@ -315,6 +317,7 @@ router.get('/@:user/pages/:page', async (ctx, next) => {
|
|||||||
await ctx.render('page', {
|
await ctx.render('page', {
|
||||||
page: _page,
|
page: _page,
|
||||||
profile,
|
profile,
|
||||||
|
avatarUrl: await Users.getAvatarUrl(await Users.findOneByOrFail({ id: page.userId })),
|
||||||
instanceName: meta.name || 'Misskey',
|
instanceName: meta.name || 'Misskey',
|
||||||
icon: meta.iconUrl,
|
icon: meta.iconUrl,
|
||||||
themeColor: meta.themeColor,
|
themeColor: meta.themeColor,
|
||||||
@ -346,6 +349,7 @@ router.get('/clips/:clip', async (ctx, next) => {
|
|||||||
await ctx.render('clip', {
|
await ctx.render('clip', {
|
||||||
clip: _clip,
|
clip: _clip,
|
||||||
profile,
|
profile,
|
||||||
|
avatarUrl: await Users.getAvatarUrl(await Users.findOneByOrFail({ id: clip.userId })),
|
||||||
instanceName: meta.name || 'Misskey',
|
instanceName: meta.name || 'Misskey',
|
||||||
icon: meta.iconUrl,
|
icon: meta.iconUrl,
|
||||||
themeColor: meta.themeColor,
|
themeColor: meta.themeColor,
|
||||||
@ -370,6 +374,7 @@ router.get('/gallery/:post', async (ctx, next) => {
|
|||||||
await ctx.render('gallery-post', {
|
await ctx.render('gallery-post', {
|
||||||
post: _post,
|
post: _post,
|
||||||
profile,
|
profile,
|
||||||
|
avatarUrl: await Users.getAvatarUrl(await Users.findOneByOrFail({ id: post.userId })),
|
||||||
instanceName: meta.name || 'Misskey',
|
instanceName: meta.name || 'Misskey',
|
||||||
icon: meta.iconUrl,
|
icon: meta.iconUrl,
|
||||||
themeColor: meta.themeColor,
|
themeColor: meta.themeColor,
|
||||||
@ -434,7 +439,7 @@ router.get('/cli', async ctx => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
const override = (source: string, target: string, depth: number = 0) =>
|
const override = (source: string, target: string, depth = 0) =>
|
||||||
[, ...target.split('/').filter(x => x), ...source.split('/').filter(x => x).splice(depth)].join('/');
|
[, ...target.split('/').filter(x => x), ...source.split('/').filter(x => x).splice(depth)].join('/');
|
||||||
|
|
||||||
router.get('/flush', async ctx => {
|
router.get('/flush', async ctx => {
|
||||||
|
@ -16,7 +16,7 @@ block og
|
|||||||
meta(property='og:title' content= title)
|
meta(property='og:title' content= title)
|
||||||
meta(property='og:description' content= clip.description)
|
meta(property='og:description' content= clip.description)
|
||||||
meta(property='og:url' content= url)
|
meta(property='og:url' content= url)
|
||||||
meta(property='og:image' content= user.avatarUrl)
|
meta(property='og:image' content= avatarUrl)
|
||||||
|
|
||||||
block meta
|
block meta
|
||||||
if profile.noCrawle
|
if profile.noCrawle
|
||||||
|
@ -17,7 +17,7 @@ block og
|
|||||||
meta(property='og:title' content= title)
|
meta(property='og:title' content= title)
|
||||||
meta(property='og:description' content= summary)
|
meta(property='og:description' content= summary)
|
||||||
meta(property='og:url' content= url)
|
meta(property='og:url' content= url)
|
||||||
meta(property='og:image' content= user.avatarUrl)
|
meta(property='og:image' content= avatarUrl)
|
||||||
|
|
||||||
block meta
|
block meta
|
||||||
if user.host || isRenote || profile.noCrawle
|
if user.host || isRenote || profile.noCrawle
|
||||||
|
@ -16,7 +16,7 @@ block og
|
|||||||
meta(property='og:title' content= title)
|
meta(property='og:title' content= title)
|
||||||
meta(property='og:description' content= page.summary)
|
meta(property='og:description' content= page.summary)
|
||||||
meta(property='og:url' content= url)
|
meta(property='og:url' content= url)
|
||||||
meta(property='og:image' content= page.eyeCatchingImage ? page.eyeCatchingImage.thumbnailUrl : user.avatarUrl)
|
meta(property='og:image' content= page.eyeCatchingImage ? page.eyeCatchingImage.thumbnailUrl : avatarUrl)
|
||||||
|
|
||||||
block meta
|
block meta
|
||||||
if profile.noCrawle
|
if profile.noCrawle
|
||||||
|
@ -3,7 +3,6 @@ extends ./base
|
|||||||
block vars
|
block vars
|
||||||
- const title = user.name ? `${user.name} (@${user.username})` : `@${user.username}`;
|
- const title = user.name ? `${user.name} (@${user.username})` : `@${user.username}`;
|
||||||
- const url = `${config.url}/@${(user.host ? `${user.username}@${user.host}` : user.username)}`;
|
- const url = `${config.url}/@${(user.host ? `${user.username}@${user.host}` : user.username)}`;
|
||||||
- const img = user.avatarUrl || null;
|
|
||||||
|
|
||||||
block title
|
block title
|
||||||
= `${title} | ${instanceName}`
|
= `${title} | ${instanceName}`
|
||||||
@ -16,7 +15,7 @@ block og
|
|||||||
meta(property='og:title' content= title)
|
meta(property='og:title' content= title)
|
||||||
meta(property='og:description' content= profile.description)
|
meta(property='og:description' content= profile.description)
|
||||||
meta(property='og:url' content= url)
|
meta(property='og:url' content= url)
|
||||||
meta(property='og:image' content= img)
|
meta(property='og:image' content= avatarUrl)
|
||||||
|
|
||||||
block meta
|
block meta
|
||||||
if user.host || profile.noCrawle
|
if user.host || profile.noCrawle
|
||||||
|
272
packages/client/src/pages/admin/emojigen.vue
Normal file
272
packages/client/src/pages/admin/emojigen.vue
Normal file
@ -0,0 +1,272 @@
|
|||||||
|
<template>
|
||||||
|
<MkSpacer :content-max="700" :margin-min="16" :margin-max="32">
|
||||||
|
<div class="cwepdizn _formRoot">
|
||||||
|
<FormInput v-model="emojiName" class="_formBlock">
|
||||||
|
<template #label>{{ $ts.emojiName }}</template>
|
||||||
|
</FormInput>
|
||||||
|
|
||||||
|
<FormTextarea v-model="text" class="_formBlock">
|
||||||
|
<template #label>{{ $ts.text }}</template>
|
||||||
|
</FormTextarea>
|
||||||
|
|
||||||
|
<FormRadios v-model="emojiAlign" class="_formBlock">
|
||||||
|
<template #label>{{ $ts.emojiAlign }}</template>
|
||||||
|
<option value="left"><i class="fas fa-align-left"/></option>
|
||||||
|
<option value="center"><i class="fas fa-align-center"></i></option>
|
||||||
|
<option value="right"><i class="fas fa-align-right"/></option>
|
||||||
|
</FormRadios>
|
||||||
|
|
||||||
|
<FormSection>
|
||||||
|
<template #label>{{ $ts.emojiSizeSetting }}</template>
|
||||||
|
<FormSwitch v-model="emojiSizeFixed" class="_formBlock">
|
||||||
|
<template #label>{{ $ts.emojiSizeFixed }}</template>
|
||||||
|
</FormSwitch>
|
||||||
|
|
||||||
|
<FormSwitch v-model="emojiStretch" class="_formBlock">
|
||||||
|
<template #label>{{ $ts.emojiStretch }}</template>
|
||||||
|
</FormSwitch>
|
||||||
|
</FormSection>
|
||||||
|
|
||||||
|
<FormRadios v-model="font" class="_formBlock">
|
||||||
|
<template #label>{{ $ts.font }}</template>
|
||||||
|
<option value="notosans-mono-bold">Noto Sans Mono CJK JP Bold</option>
|
||||||
|
<option value="mplus-1p-black">M+ 1p black</option>
|
||||||
|
<option value="rounded-x-mplus-1p-black">Rounded M+ 1p black</option>
|
||||||
|
<option value="ipamjm">IPAmj明朝</option>
|
||||||
|
<option value="aoyagireisyoshimo">青柳隷書しも</option>
|
||||||
|
<option value="LinLibertine_RBah">LinLibertine Bold</option>
|
||||||
|
</FormRadios>
|
||||||
|
|
||||||
|
<FormSection>
|
||||||
|
<template #label>{{ $ts.emojiColor }}</template>
|
||||||
|
<div class="cwepdizn-colors">
|
||||||
|
<div class="row">
|
||||||
|
<button v-for="color in accentColors" :key="color" class="color rounded _button" @click="setAccentColor(color)">
|
||||||
|
<div class="preview" :style="{ background: color }"></div>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<FormInput v-model="emojiColor" class="_formBlock" :style="{ color: '#' + emojiColor }">
|
||||||
|
<template #prefix><i class="fas fa-palette"></i></template>
|
||||||
|
<template #label>{{ $ts.emojiColor }}</template>
|
||||||
|
<template #caption>#RRGGBB</template>
|
||||||
|
</FormInput>
|
||||||
|
</FormSection>
|
||||||
|
|
||||||
|
<FormButton primary class="_formBlock" @click="emojiGenerate">{{ $ts.emojiGenerate }}</FormButton>
|
||||||
|
|
||||||
|
<FormSection>
|
||||||
|
<template #label>{{ $ts.preview }}</template>
|
||||||
|
<p><img :src="emojiUrl" class="img" :alt="emojiName"/></p>
|
||||||
|
<MkLink v-if="emojiUrl" :url="emojiUrl">{{ emojiUrl }}</MkLink>
|
||||||
|
</FormSection>
|
||||||
|
<FormButton primary class="_formBlock" @click="emojiApproval">{{ $ts.emojiApproval }}</FormButton>
|
||||||
|
</div>
|
||||||
|
</MkSpacer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import {defineComponent} from 'vue';
|
||||||
|
import FormSwitch from '@/components/form/switch.vue';
|
||||||
|
import FormInput from '@/components/form/input.vue';
|
||||||
|
import FormTextarea from '@/components/form/textarea.vue';
|
||||||
|
import FormRadios from '@/components/form/radios.vue';
|
||||||
|
import FormSection from '@/components/form/section.vue';
|
||||||
|
import FormButton from '@/components/ui/button.vue';
|
||||||
|
import MkLink from '@/components/link.vue';
|
||||||
|
import * as os from '@/os';
|
||||||
|
import * as symbols from '@/symbols';
|
||||||
|
import {defaultStore} from "@/store";
|
||||||
|
import {stream} from "@/stream";
|
||||||
|
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
components: {
|
||||||
|
FormInput,
|
||||||
|
FormTextarea,
|
||||||
|
FormRadios,
|
||||||
|
FormSection,
|
||||||
|
FormSwitch,
|
||||||
|
FormButton,
|
||||||
|
MkLink,
|
||||||
|
},
|
||||||
|
|
||||||
|
emits: ['info'],
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
[symbols.PAGE_INFO]: {
|
||||||
|
title: this.$ts.emojiGen,
|
||||||
|
icon: 'fas fa-laugh',
|
||||||
|
bg: 'var(--bg)',
|
||||||
|
},
|
||||||
|
emojiName: '',
|
||||||
|
text: '',
|
||||||
|
emojiAlign: 'center',
|
||||||
|
emojiSizeFixed: false,
|
||||||
|
emojiStretch: false,
|
||||||
|
font: 'notosans-mono-bold',
|
||||||
|
emojiColor: '38BA91',
|
||||||
|
emojiUrl: '',
|
||||||
|
accentColors: ['#e36749', '#f29924', '#98c934', '#34c9a9', '#34a1c9', '#606df7', '#8d34c9', '#e84d83']
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
async init() {
|
||||||
|
},
|
||||||
|
|
||||||
|
emojiGenerate() {
|
||||||
|
//https://emoji-gen.ninja/result?text=%E7%B5%B5%E6%96%87%0A%E5%AD%97%E3%80%82&color=EC71A1FF&back_color=00000000&font=notosans-mono-bold&size_fixed=false&align=center&stretch=true&public_fg=true&locale=ja
|
||||||
|
|
||||||
|
const apiUrl = `https://emoji-gen.ninja/emoji`
|
||||||
|
let query = {"text": encodeURI(this.text), "color": this.emojiColor.replace('#','') + "FF", "back_color": "00000000", "font": this.font, "size_fixed": this.emojiSizeFixed, "align": this.emojiAlign, "stretch": !this.emojiStretch, "public_fg": "false", "locale": "ja"}
|
||||||
|
|
||||||
|
this.emojiUrl = apiUrl + '?' + Object.entries(query).map((e) => `${e[0]}=${e[1]}`).join('&');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
emojiApproval: function () {
|
||||||
|
|
||||||
|
//emojiUploadでは、絵文字をdrive/files/upload-from-urlでアップロードしたあと、emojiAddでリネーム、登録をして、emojiAddの戻り値(絵文字のid)を返す
|
||||||
|
const emojiUpload = () => new Promise(async resolve => {
|
||||||
|
const marker = Math.random().toString(); // TODO: UUIDとか使う
|
||||||
|
|
||||||
|
//先にコネクションを貼って監視する
|
||||||
|
const connection = stream.useChannel('main');
|
||||||
|
connection.on('urlUploadFinished', async data => {
|
||||||
|
if (data.marker === marker) {
|
||||||
|
const fileId = await emojiAdd(data.file.id);
|
||||||
|
resolve(fileId);
|
||||||
|
connection.dispose();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
await os.api('drive/files/upload-from-url', {
|
||||||
|
url: this.emojiUrl,
|
||||||
|
folderId: defaultStore.state.uploadFolder,
|
||||||
|
marker
|
||||||
|
});
|
||||||
|
|
||||||
|
//リネーム→登録→登録されたIDを返す
|
||||||
|
const emojiAdd = (fileId) => new Promise<Record<string, any> | null>(async resolve => {
|
||||||
|
await os.api('drive/files/update', {
|
||||||
|
fileId,
|
||||||
|
name: this.emojiName + '.png',
|
||||||
|
});
|
||||||
|
|
||||||
|
const response = await os.api('admin/emoji/add', {
|
||||||
|
fileId,
|
||||||
|
})
|
||||||
|
|
||||||
|
resolve(response);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
//emoji関数 admin/emoji/listでは、idによる検索ができないため、自分のidをuntilIdに入れて1つ前のidを取得してからそれをsinceIdに指定して、絵文字情報をlist→objectで取得する
|
||||||
|
const emoji = (emojiId) => new Promise<Record<string, any> | null>(async resolve => {
|
||||||
|
const sinceId = await os.api('admin/emoji/list', {
|
||||||
|
limit: 1,
|
||||||
|
untilId: emojiId.id
|
||||||
|
})
|
||||||
|
|
||||||
|
if (!sinceId) {
|
||||||
|
resolve(null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const id = await os.api('admin/emoji/list', {
|
||||||
|
limit: 1,
|
||||||
|
sinceId: sinceId[0].id
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!id) {
|
||||||
|
resolve(null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
resolve(id[0]);
|
||||||
|
});
|
||||||
|
|
||||||
|
//edit関数には、emojiのobjectを渡す
|
||||||
|
const edit = (emoji) => {
|
||||||
|
os.popup(import('./emoji-edit-dialog.vue'), {
|
||||||
|
emoji: emoji
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
await this.emojiGenerate()
|
||||||
|
const emojiId = await emojiUpload();//emojiIdはファイルID emojiUploadはファイルIDを返す
|
||||||
|
const emojiObj = await emoji(emojiId);//emojiObjはemojiオブジェクト emoji関数はemojiIdを引数に受け取りemojiオブジェクトを返す
|
||||||
|
edit(emojiObj);
|
||||||
|
})();
|
||||||
|
},
|
||||||
|
|
||||||
|
setAccentColor(color){
|
||||||
|
this.emojiColor = color.replace('#', '');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.cwepdizn {
|
||||||
|
::v-deep(.cwepdizn-colors) {
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
> .row {
|
||||||
|
> .color {
|
||||||
|
display: inline-block;
|
||||||
|
position: relative;
|
||||||
|
width: 64px;
|
||||||
|
height: 64px;
|
||||||
|
border-radius: 8px;
|
||||||
|
|
||||||
|
> .preview {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
margin: auto;
|
||||||
|
width: 42px;
|
||||||
|
height: 42px;
|
||||||
|
border-radius: 4px;
|
||||||
|
box-shadow: 0 2px 4px rgb(0 0 0 / 30%);
|
||||||
|
transition: transform 0.15s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
> .preview {
|
||||||
|
transform: scale(1.1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
box-shadow: 0 0 0 2px var(--divider) inset;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.rounded {
|
||||||
|
border-radius: 999px;
|
||||||
|
|
||||||
|
> .preview {
|
||||||
|
border-radius: 999px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.char {
|
||||||
|
line-height: 42px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -120,6 +120,11 @@ export default defineComponent({
|
|||||||
text: i18n.ts.customEmojis,
|
text: i18n.ts.customEmojis,
|
||||||
to: '/admin/emojis',
|
to: '/admin/emojis',
|
||||||
active: page.value === 'emojis',
|
active: page.value === 'emojis',
|
||||||
|
},{
|
||||||
|
icon: 'fas fa-laugh',
|
||||||
|
text: i18n.ts.emojiGen,
|
||||||
|
to: '/admin/emojigen',
|
||||||
|
active: page.value === 'emojigen',
|
||||||
},{
|
},{
|
||||||
icon: 'fas fa-globe',
|
icon: 'fas fa-globe',
|
||||||
text: i18n.ts.federation,
|
text: i18n.ts.federation,
|
||||||
@ -214,6 +219,7 @@ export default defineComponent({
|
|||||||
case 'overview': return defineAsyncComponent(() => import('./overview.vue'));
|
case 'overview': return defineAsyncComponent(() => import('./overview.vue'));
|
||||||
case 'users': return defineAsyncComponent(() => import('./users.vue'));
|
case 'users': return defineAsyncComponent(() => import('./users.vue'));
|
||||||
case 'emojis': return defineAsyncComponent(() => import('./emojis.vue'));
|
case 'emojis': return defineAsyncComponent(() => import('./emojis.vue'));
|
||||||
|
case 'emojigen': return defineAsyncComponent(() => import('./emojigen.vue'));
|
||||||
case 'federation': return defineAsyncComponent(() => import('../federation.vue'));
|
case 'federation': return defineAsyncComponent(() => import('../federation.vue'));
|
||||||
case 'queue': return defineAsyncComponent(() => import('./queue.vue'));
|
case 'queue': return defineAsyncComponent(() => import('./queue.vue'));
|
||||||
case 'files': return defineAsyncComponent(() => import('./files.vue'));
|
case 'files': return defineAsyncComponent(() => import('./files.vue'));
|
||||||
|
Reference in New Issue
Block a user