mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-23 04:13:07 +02:00
Compare commits
11 commits
84a3c85aa6
...
d8e29ae428
Author | SHA1 | Date | |
---|---|---|---|
|
d8e29ae428 | ||
|
bb7b4a8ea4 | ||
|
0690b9a429 | ||
|
e779c1e667 | ||
|
ecfaf7ff7a | ||
|
a69315a24b | ||
|
d991eccd3f | ||
|
0085305579 | ||
|
2071e72b2b | ||
|
3bb8a91124 | ||
|
84abe50f84 |
28 changed files with 249 additions and 24 deletions
|
@ -51,6 +51,12 @@ export const paramDef = {
|
||||||
sinceDate: { type: 'integer' },
|
sinceDate: { type: 'integer' },
|
||||||
untilDate: { type: 'integer' },
|
untilDate: { type: 'integer' },
|
||||||
allowPartial: { type: 'boolean', default: false }, // true is recommended but for compatibility false by default
|
allowPartial: { type: 'boolean', default: false }, // true is recommended but for compatibility false by default
|
||||||
|
withRenotes: { type: 'boolean', default: true },
|
||||||
|
withFiles: {
|
||||||
|
type: 'boolean',
|
||||||
|
default: false,
|
||||||
|
description: 'Only show notes that have attached files.',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
required: ['channelId'],
|
required: ['channelId'],
|
||||||
} as const;
|
} as const;
|
||||||
|
@ -89,7 +95,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
if (me) this.activeUsersChart.read(me);
|
if (me) this.activeUsersChart.read(me);
|
||||||
|
|
||||||
if (!serverSettings.enableFanoutTimeline) {
|
if (!serverSettings.enableFanoutTimeline) {
|
||||||
return await this.noteEntityService.packMany(await this.getFromDb({ untilId, sinceId, limit: ps.limit, channelId: channel.id }, me), me);
|
return await this.noteEntityService.packMany(await this.getFromDb({ untilId, sinceId, limit: ps.limit, channelId: channel.id, withFiles: ps.withFiles, withRenotes: ps.withRenotes }, me), me);
|
||||||
}
|
}
|
||||||
|
|
||||||
return await this.fanoutTimelineEndpointService.timeline({
|
return await this.fanoutTimelineEndpointService.timeline({
|
||||||
|
@ -100,9 +106,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
me,
|
me,
|
||||||
useDbFallback: true,
|
useDbFallback: true,
|
||||||
redisTimelines: [`channelTimeline:${channel.id}`],
|
redisTimelines: [`channelTimeline:${channel.id}`],
|
||||||
excludePureRenotes: false,
|
excludePureRenotes: !ps.withRenotes,
|
||||||
|
excludeNoFiles: ps.withFiles,
|
||||||
dbFallback: async (untilId, sinceId, limit) => {
|
dbFallback: async (untilId, sinceId, limit) => {
|
||||||
return await this.getFromDb({ untilId, sinceId, limit, channelId: channel.id }, me);
|
return await this.getFromDb({ untilId, sinceId, limit, channelId: channel.id, withFiles: ps.withFiles, withRenotes: ps.withRenotes }, me);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -112,7 +119,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
untilId: string | null,
|
untilId: string | null,
|
||||||
sinceId: string | null,
|
sinceId: string | null,
|
||||||
limit: number,
|
limit: number,
|
||||||
channelId: string
|
channelId: string,
|
||||||
|
withFiles: boolean,
|
||||||
|
withRenotes: boolean,
|
||||||
}, me: MiLocalUser | null) {
|
}, me: MiLocalUser | null) {
|
||||||
//#region fallback to database
|
//#region fallback to database
|
||||||
const query = this.queryService.makePaginationQuery(this.notesRepository.createQueryBuilder('note'), ps.sinceId, ps.untilId)
|
const query = this.queryService.makePaginationQuery(this.notesRepository.createQueryBuilder('note'), ps.sinceId, ps.untilId)
|
||||||
|
@ -128,6 +137,20 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
this.queryService.generateMutedUserQuery(query, me);
|
this.queryService.generateMutedUserQuery(query, me);
|
||||||
this.queryService.generateBlockedUserQuery(query, me);
|
this.queryService.generateBlockedUserQuery(query, me);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ps.withRenotes === false) {
|
||||||
|
query.andWhere(new Brackets(qb => {
|
||||||
|
qb.orWhere('note.renoteId IS NULL');
|
||||||
|
qb.orWhere(new Brackets(qb => {
|
||||||
|
qb.orWhere('note.text IS NOT NULL');
|
||||||
|
qb.orWhere('note.fileIds != \'{}\'');
|
||||||
|
}));
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ps.withFiles) {
|
||||||
|
query.andWhere('note.fileIds != \'{}\'');
|
||||||
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
return await query.limit(ps.limit).getMany();
|
return await query.limit(ps.limit).getMany();
|
||||||
|
|
|
@ -279,7 +279,8 @@ export class MastoConverters {
|
||||||
emoji_reactions: status.emoji_reactions,
|
emoji_reactions: status.emoji_reactions,
|
||||||
bookmarked: false,
|
bookmarked: false,
|
||||||
quote: isQuote ? await this.convertReblog(status.reblog) : false,
|
quote: isQuote ? await this.convertReblog(status.reblog) : false,
|
||||||
edited_at: note.updatedAt?.toISOString(),
|
// optional chaining cannot be used, as it evaluates to undefined, not null
|
||||||
|
edited_at: note.updatedAt ? note.updatedAt.toISOString() : null,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,8 @@ class ChannelChannel extends Channel {
|
||||||
public static shouldShare = false;
|
public static shouldShare = false;
|
||||||
public static requireCredential = false as const;
|
public static requireCredential = false as const;
|
||||||
private channelId: string;
|
private channelId: string;
|
||||||
|
private withFiles: boolean;
|
||||||
|
private withRenotes: boolean;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private noteEntityService: NoteEntityService,
|
private noteEntityService: NoteEntityService,
|
||||||
|
@ -29,6 +31,8 @@ class ChannelChannel extends Channel {
|
||||||
@bindThis
|
@bindThis
|
||||||
public async init(params: any) {
|
public async init(params: any) {
|
||||||
this.channelId = params.channelId as string;
|
this.channelId = params.channelId as string;
|
||||||
|
this.withFiles = params.withFiles ?? false;
|
||||||
|
this.withRenotes = params.withRenotes ?? true;
|
||||||
|
|
||||||
// Subscribe stream
|
// Subscribe stream
|
||||||
this.subscriber.on('notesStream', this.onNote);
|
this.subscriber.on('notesStream', this.onNote);
|
||||||
|
@ -38,6 +42,10 @@ class ChannelChannel extends Channel {
|
||||||
private async onNote(note: Packed<'Note'>) {
|
private async onNote(note: Packed<'Note'>) {
|
||||||
if (note.channelId !== this.channelId) return;
|
if (note.channelId !== this.channelId) return;
|
||||||
|
|
||||||
|
if (this.withFiles && (note.fileIds == null || note.fileIds.length === 0)) return;
|
||||||
|
|
||||||
|
if (note.renote && note.text == null && (note.fileIds == null || note.fileIds.length === 0) && !this.withRenotes) return;
|
||||||
|
|
||||||
// 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
|
// 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
|
||||||
if (isUserRelated(note, this.userIdsWhoMeMuting)) return;
|
if (isUserRelated(note, this.userIdsWhoMeMuting)) return;
|
||||||
// 流れてきたNoteがブロックされているユーザーが関わるものだったら無視する
|
// 流れてきたNoteがブロックされているユーザーが関わるものだったら無視する
|
||||||
|
|
|
@ -43,7 +43,6 @@ html
|
||||||
link(rel='stylesheet' href='/assets/phosphor-icons/bold/style.css')
|
link(rel='stylesheet' href='/assets/phosphor-icons/bold/style.css')
|
||||||
link(rel='stylesheet' href='/static-assets/fonts/sharkey-icons/style.css')
|
link(rel='stylesheet' href='/static-assets/fonts/sharkey-icons/style.css')
|
||||||
link(rel='modulepreload' href=`/vite/${clientEntry.file}`)
|
link(rel='modulepreload' href=`/vite/${clientEntry.file}`)
|
||||||
script(src='/client-assets/libopenmpt.js')
|
|
||||||
|
|
||||||
if !config.clientManifestExists
|
if !config.clientManifestExists
|
||||||
script(type="module" src="/vite/@vite/client")
|
script(type="module" src="/vite/@vite/client")
|
||||||
|
@ -73,7 +72,6 @@ html
|
||||||
script.
|
script.
|
||||||
var VERSION = "#{version}";
|
var VERSION = "#{version}";
|
||||||
var CLIENT_ENTRY = "#{clientEntry.file}";
|
var CLIENT_ENTRY = "#{clientEntry.file}";
|
||||||
window.libopenmpt = window.Module;
|
|
||||||
|
|
||||||
script(type='application/json' id='misskey_meta' data-generated-at=now)
|
script(type='application/json' id='misskey_meta' data-generated-at=now)
|
||||||
!= metaJson
|
!= metaJson
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -154,6 +154,8 @@ function connectChannel() {
|
||||||
} else if (props.src === 'channel') {
|
} else if (props.src === 'channel') {
|
||||||
if (props.channel == null) return;
|
if (props.channel == null) return;
|
||||||
connection = stream.useChannel('channel', {
|
connection = stream.useChannel('channel', {
|
||||||
|
withRenotes: props.withRenotes,
|
||||||
|
withFiles: props.onlyFiles ? true : undefined,
|
||||||
channelId: props.channel,
|
channelId: props.channel,
|
||||||
});
|
});
|
||||||
} else if (props.src === 'role') {
|
} else if (props.src === 'role') {
|
||||||
|
@ -234,6 +236,8 @@ function updatePaginationQuery() {
|
||||||
} else if (props.src === 'channel') {
|
} else if (props.src === 'channel') {
|
||||||
endpoint = 'channels/timeline';
|
endpoint = 'channels/timeline';
|
||||||
query = {
|
query = {
|
||||||
|
withRenotes: props.withRenotes,
|
||||||
|
withFiles: props.onlyFiles ? true : undefined,
|
||||||
channelId: props.channel,
|
channelId: props.channel,
|
||||||
};
|
};
|
||||||
} else if (props.src === 'role') {
|
} else if (props.src === 'role') {
|
||||||
|
|
|
@ -39,7 +39,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<!-- スマホ・タブレットの場合、キーボードが表示されると投稿が見づらくなるので、デスクトップ場合のみ自動でフォーカスを当てる -->
|
<!-- スマホ・タブレットの場合、キーボードが表示されると投稿が見づらくなるので、デスクトップ場合のみ自動でフォーカスを当てる -->
|
||||||
<MkPostForm v-if="$i && defaultStore.reactiveState.showFixedPostFormInChannel.value" :channel="channel" class="post-form _panel" fixed :autofocus="deviceKind === 'desktop'"/>
|
<MkPostForm v-if="$i && defaultStore.reactiveState.showFixedPostFormInChannel.value" :channel="channel" class="post-form _panel" fixed :autofocus="deviceKind === 'desktop'"/>
|
||||||
|
|
||||||
<MkTimeline :key="channelId" src="channel" :channel="channelId" @before="before" @after="after" @note="miLocalStorage.setItemAsJson(`channelLastReadedAt:${channel.id}`, Date.now())"/>
|
<MkTimeline :key="channelId + withRenotes + onlyFiles" src="channel" :channel="channelId" :withRenotes="withRenotes" :onlyFiles="onlyFiles" @before="before" @after="after" @note="miLocalStorage.setItemAsJson(`channelLastReadedAt:${channel.id}`, Date.now())"/>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="tab === 'featured'" key="featured">
|
<div v-else-if="tab === 'featured'" key="featured">
|
||||||
<MkNotes :pagination="featuredPagination"/>
|
<MkNotes :pagination="featuredPagination"/>
|
||||||
|
@ -95,6 +95,7 @@ import { isSupportShare } from '@/scripts/navigator.js';
|
||||||
import copyToClipboard from '@/scripts/copy-to-clipboard.js';
|
import copyToClipboard from '@/scripts/copy-to-clipboard.js';
|
||||||
import { miLocalStorage } from '@/local-storage.js';
|
import { miLocalStorage } from '@/local-storage.js';
|
||||||
import { useRouter } from '@/router/supplier.js';
|
import { useRouter } from '@/router/supplier.js';
|
||||||
|
import { deepMerge } from '@/scripts/merge.js';
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
|
@ -116,6 +117,15 @@ const featuredPagination = computed(() => ({
|
||||||
channelId: props.channelId,
|
channelId: props.channelId,
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
const withRenotes = computed<boolean>({
|
||||||
|
get: () => defaultStore.reactiveState.tl.value.filter.withRenotes,
|
||||||
|
set: (x) => saveTlFilter('withRenotes', x),
|
||||||
|
});
|
||||||
|
|
||||||
|
const onlyFiles = computed<boolean>({
|
||||||
|
get: () => defaultStore.reactiveState.tl.value.filter.onlyFiles,
|
||||||
|
set: (x) => saveTlFilter('onlyFiles', x),
|
||||||
|
});
|
||||||
|
|
||||||
watch(() => props.channelId, async () => {
|
watch(() => props.channelId, async () => {
|
||||||
channel.value = await misskeyApi('channels/show', {
|
channel.value = await misskeyApi('channels/show', {
|
||||||
|
@ -136,6 +146,13 @@ watch(() => props.channelId, async () => {
|
||||||
}
|
}
|
||||||
}, { immediate: true });
|
}, { immediate: true });
|
||||||
|
|
||||||
|
function saveTlFilter(key: keyof typeof defaultStore.state.tl.filter, newValue: boolean) {
|
||||||
|
if (key !== 'withReplies' || $i) {
|
||||||
|
const out = deepMerge({ filter: { [key]: newValue } }, defaultStore.state.tl);
|
||||||
|
defaultStore.set('tl', out);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function edit() {
|
function edit() {
|
||||||
router.push(`/channels/${channel.value?.id}/edit`);
|
router.push(`/channels/${channel.value?.id}/edit`);
|
||||||
}
|
}
|
||||||
|
@ -192,7 +209,21 @@ async function search() {
|
||||||
|
|
||||||
const headerActions = computed(() => {
|
const headerActions = computed(() => {
|
||||||
if (channel.value && channel.value.userId) {
|
if (channel.value && channel.value.userId) {
|
||||||
const headerItems: PageHeaderItem[] = [];
|
const headerItems: PageHeaderItem[] = [{
|
||||||
|
icon: 'ph-dots-three ph-bold ph-lg',
|
||||||
|
text: i18n.ts.options,
|
||||||
|
handler: (ev) => {
|
||||||
|
os.popupMenu([{
|
||||||
|
type: 'switch',
|
||||||
|
text: i18n.ts.showRenotes,
|
||||||
|
ref: withRenotes,
|
||||||
|
}, {
|
||||||
|
type: 'switch',
|
||||||
|
text: i18n.ts.fileAttachedOnly,
|
||||||
|
ref: onlyFiles,
|
||||||
|
}], ev.currentTarget ?? ev.target);
|
||||||
|
},
|
||||||
|
}];
|
||||||
|
|
||||||
headerItems.push({
|
headerItems.push({
|
||||||
icon: 'ph-share-network ph-bold ph-lg',
|
icon: 'ph-share-network ph-bold ph-lg',
|
||||||
|
|
|
@ -11,10 +11,12 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<div v-if="queue > 0" :class="$style.new"><button class="_buttonPrimary" :class="$style.newButton" @click="top()">{{ i18n.ts.newNoteRecived }}</button></div>
|
<div v-if="queue > 0" :class="$style.new"><button class="_buttonPrimary" :class="$style.newButton" @click="top()">{{ i18n.ts.newNoteRecived }}</button></div>
|
||||||
<div :class="$style.tl">
|
<div :class="$style.tl">
|
||||||
<MkTimeline
|
<MkTimeline
|
||||||
ref="tlEl" :key="listId"
|
ref="tlEl" :key="listId + withRenotes + onlyFiles"
|
||||||
src="list"
|
src="list"
|
||||||
:list="listId"
|
:list="listId"
|
||||||
:sound="true"
|
:sound="true"
|
||||||
|
:withRenotes="withRenotes"
|
||||||
|
:onlyFiles="onlyFiles"
|
||||||
@queue="queueUpdated"
|
@queue="queueUpdated"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -32,6 +34,9 @@ import { misskeyApi } from '@/scripts/misskey-api.js';
|
||||||
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
||||||
import { i18n } from '@/i18n.js';
|
import { i18n } from '@/i18n.js';
|
||||||
import { useRouter } from '@/router/supplier.js';
|
import { useRouter } from '@/router/supplier.js';
|
||||||
|
import { defaultStore } from '@/store.js';
|
||||||
|
import { deepMerge } from '@/scripts/merge.js';
|
||||||
|
import * as os from '@/os.js';
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
|
@ -43,6 +48,21 @@ const list = ref<Misskey.entities.UserList | null>(null);
|
||||||
const queue = ref(0);
|
const queue = ref(0);
|
||||||
const tlEl = shallowRef<InstanceType<typeof MkTimeline>>();
|
const tlEl = shallowRef<InstanceType<typeof MkTimeline>>();
|
||||||
const rootEl = shallowRef<HTMLElement>();
|
const rootEl = shallowRef<HTMLElement>();
|
||||||
|
const withRenotes = computed<boolean>({
|
||||||
|
get: () => defaultStore.reactiveState.tl.value.filter.withRenotes,
|
||||||
|
set: (x) => saveTlFilter('withRenotes', x),
|
||||||
|
});
|
||||||
|
const onlyFiles = computed<boolean>({
|
||||||
|
get: () => defaultStore.reactiveState.tl.value.filter.onlyFiles,
|
||||||
|
set: (x) => saveTlFilter('onlyFiles', x),
|
||||||
|
});
|
||||||
|
|
||||||
|
function saveTlFilter(key: keyof typeof defaultStore.state.tl.filter, newValue: boolean) {
|
||||||
|
if (key !== 'withReplies' || $i) {
|
||||||
|
const out = deepMerge({ filter: { [key]: newValue } }, defaultStore.state.tl);
|
||||||
|
defaultStore.set('tl', out);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
watch(() => props.listId, async () => {
|
watch(() => props.listId, async () => {
|
||||||
list.value = await misskeyApi('users/lists/show', {
|
list.value = await misskeyApi('users/lists/show', {
|
||||||
|
@ -63,6 +83,20 @@ function settings() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const headerActions = computed(() => list.value ? [{
|
const headerActions = computed(() => list.value ? [{
|
||||||
|
icon: 'ph-dots-three ph-bold ph-lg',
|
||||||
|
text: i18n.ts.options,
|
||||||
|
handler: (ev) => {
|
||||||
|
os.popupMenu([{
|
||||||
|
type: 'switch',
|
||||||
|
text: i18n.ts.showRenotes,
|
||||||
|
ref: withRenotes,
|
||||||
|
}, {
|
||||||
|
type: 'switch',
|
||||||
|
text: i18n.ts.fileAttachedOnly,
|
||||||
|
ref: onlyFiles,
|
||||||
|
}], ev.currentTarget ?? ev.target);
|
||||||
|
},
|
||||||
|
}, {
|
||||||
icon: 'ph-gear ph-bold ph-lg',
|
icon: 'ph-gear ph-bold ph-lg',
|
||||||
text: i18n.ts.settings,
|
text: i18n.ts.settings,
|
||||||
handler: settings,
|
handler: settings,
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
/* global libopenmpt UTF8ToString writeAsciiToMemory */
|
// @ts-nocheck
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
|
|
||||||
const ChiptuneAudioContext = window.AudioContext || window.webkitAudioContext;
|
const ChiptuneAudioContext = window.AudioContext || window.webkitAudioContext;
|
||||||
|
|
||||||
export function ChiptuneJsConfig (repeatCount: number, context: AudioContext) {
|
let libopenmpt
|
||||||
|
let libopenmptLoadPromise
|
||||||
|
|
||||||
|
export function ChiptuneJsConfig (repeatCount?: number, context?: AudioContext) {
|
||||||
this.repeatCount = repeatCount;
|
this.repeatCount = repeatCount;
|
||||||
this.context = context;
|
this.context = context;
|
||||||
}
|
}
|
||||||
|
@ -20,6 +23,28 @@ export function ChiptuneJsPlayer (config: object) {
|
||||||
this.volume = 1;
|
this.volume = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ChiptuneJsPlayer.prototype.initialize = function() {
|
||||||
|
if (libopenmptLoadPromise) return libopenmptLoadPromise;
|
||||||
|
if (libopenmpt) return Promise.resolve();
|
||||||
|
|
||||||
|
libopenmptLoadPromise = new Promise(async (resolve, reject) => {
|
||||||
|
try {
|
||||||
|
const { Module } = await import('./libopenmpt/libopenmpt.js');
|
||||||
|
await new Promise((resolve) => {
|
||||||
|
Module['onRuntimeInitialized'] = resolve;
|
||||||
|
})
|
||||||
|
libopenmpt = Module;
|
||||||
|
resolve()
|
||||||
|
} catch (e) {
|
||||||
|
reject(e)
|
||||||
|
} finally {
|
||||||
|
libopenmptLoadPromise = undefined;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
return libopenmptLoadPromise;
|
||||||
|
}
|
||||||
|
|
||||||
ChiptuneJsPlayer.prototype.constructor = ChiptuneJsPlayer;
|
ChiptuneJsPlayer.prototype.constructor = ChiptuneJsPlayer;
|
||||||
|
|
||||||
ChiptuneJsPlayer.prototype.fireEvent = function (eventName: string, response) {
|
ChiptuneJsPlayer.prototype.fireEvent = function (eventName: string, response) {
|
||||||
|
@ -61,12 +86,12 @@ ChiptuneJsPlayer.prototype.seek = function (position: number) {
|
||||||
|
|
||||||
ChiptuneJsPlayer.prototype.metadata = function () {
|
ChiptuneJsPlayer.prototype.metadata = function () {
|
||||||
const data = {};
|
const data = {};
|
||||||
const keys = UTF8ToString(libopenmpt._openmpt_module_get_metadata_keys(this.currentPlayingNode.modulePtr)).split(';');
|
const keys = libopenmpt.UTF8ToString(libopenmpt._openmpt_module_get_metadata_keys(this.currentPlayingNode.modulePtr)).split(';');
|
||||||
let keyNameBuffer = 0;
|
let keyNameBuffer = 0;
|
||||||
for (const key of keys) {
|
for (const key of keys) {
|
||||||
keyNameBuffer = libopenmpt._malloc(key.length + 1);
|
keyNameBuffer = libopenmpt._malloc(key.length + 1);
|
||||||
writeAsciiToMemory(key, keyNameBuffer);
|
libopenmpt.writeAsciiToMemory(key, keyNameBuffer);
|
||||||
data[key] = UTF8ToString(libopenmpt._openmpt_module_get_metadata(this.currentPlayingNode.modulePtr, keyNameBuffer));
|
data[key] = libopenmpt.UTF8ToString(libopenmpt._openmpt_module_get_metadata(this.currentPlayingNode.modulePtr, keyNameBuffer));
|
||||||
libopenmpt._free(keyNameBuffer);
|
libopenmpt._free(keyNameBuffer);
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
|
@ -84,7 +109,7 @@ ChiptuneJsPlayer.prototype.unlock = function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
ChiptuneJsPlayer.prototype.load = function (input) {
|
ChiptuneJsPlayer.prototype.load = function (input) {
|
||||||
return new Promise((resolve, reject) => {
|
return this.initialize().then(() => new Promise((resolve, reject) => {
|
||||||
if(this.touchLocked) {
|
if(this.touchLocked) {
|
||||||
this.unlock();
|
this.unlock();
|
||||||
}
|
}
|
||||||
|
@ -106,7 +131,7 @@ ChiptuneJsPlayer.prototype.load = function (input) {
|
||||||
reject(error);
|
reject(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
ChiptuneJsPlayer.prototype.play = function (buffer: ArrayBuffer) {
|
ChiptuneJsPlayer.prototype.play = function (buffer: ArrayBuffer) {
|
||||||
|
@ -180,7 +205,7 @@ ChiptuneJsPlayer.prototype.getPatternNumRows = function (pattern: number) {
|
||||||
|
|
||||||
ChiptuneJsPlayer.prototype.getPatternRowChannel = function (pattern: number, row: number, channel: number) {
|
ChiptuneJsPlayer.prototype.getPatternRowChannel = function (pattern: number, row: number, channel: number) {
|
||||||
if (this.currentPlayingNode && this.currentPlayingNode.modulePtr) {
|
if (this.currentPlayingNode && this.currentPlayingNode.modulePtr) {
|
||||||
return UTF8ToString(libopenmpt._openmpt_module_format_pattern_row_channel(this.currentPlayingNode.modulePtr, pattern, row, channel, 0, true));
|
return libopenmpt.UTF8ToString(libopenmpt._openmpt_module_format_pattern_row_channel(this.currentPlayingNode.modulePtr, pattern, row, channel, 0, true));
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
};
|
};
|
||||||
|
|
25
packages/frontend/src/scripts/libopenmpt/LICENSE
Normal file
25
packages/frontend/src/scripts/libopenmpt/LICENSE
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
Copyright (c) 2004-2024, OpenMPT Project Developers and Contributors
|
||||||
|
Copyright (c) 1997-2003, Olivier Lapicque
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of the OpenMPT project nor the
|
||||||
|
names of its contributors may be used to endorse or promote products
|
||||||
|
derived from this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
8
packages/frontend/src/scripts/libopenmpt/libopenmpt.js
Normal file
8
packages/frontend/src/scripts/libopenmpt/libopenmpt.js
Normal file
File diff suppressed because one or more lines are too long
23
packages/frontend/src/scripts/libopenmpt/readme.md
Normal file
23
packages/frontend/src/scripts/libopenmpt/readme.md
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
modifications made to `libopenmpt.js` (can be taken from https://lib.openmpt.org/libopenmpt/download/):
|
||||||
|
|
||||||
|
at the beginning of the file:
|
||||||
|
```js
|
||||||
|
// @ts-nocheck
|
||||||
|
/* eslint-disable */
|
||||||
|
```
|
||||||
|
|
||||||
|
at the end of the file:
|
||||||
|
```js
|
||||||
|
Module.UTF8ToString = UTF8ToString;
|
||||||
|
Module.writeAsciiToMemory = writeAsciiToMemory;
|
||||||
|
export { Module }
|
||||||
|
```
|
||||||
|
|
||||||
|
replace
|
||||||
|
```
|
||||||
|
wasmBinaryFile="libopenmpt.wasm"
|
||||||
|
```
|
||||||
|
with
|
||||||
|
```
|
||||||
|
wasmBinaryFile=new URL("./libopenmpt.wasm", import.meta.url).href
|
||||||
|
```
|
|
@ -13,13 +13,13 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<div style="padding: 8px; text-align: center;">
|
<div style="padding: 8px; text-align: center;">
|
||||||
<MkButton primary gradate rounded inline small @click="post"><i class="ph-pencil-simple ph-bold ph-lg"></i></MkButton>
|
<MkButton primary gradate rounded inline small @click="post"><i class="ph-pencil-simple ph-bold ph-lg"></i></MkButton>
|
||||||
</div>
|
</div>
|
||||||
<MkTimeline ref="timeline" src="channel" :channel="column.channelId"/>
|
<MkTimeline ref="timeline" src="channel" :channel="column.channelId" :key="column.channelId + column.withRenotes + column.onlyFiles" :withRenotes="withRenotes" :onlyFiles="onlyFiles"/>
|
||||||
</template>
|
</template>
|
||||||
</XColumn>
|
</XColumn>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { shallowRef } from 'vue';
|
import { watch, ref, shallowRef } from 'vue';
|
||||||
import * as Misskey from 'misskey-js';
|
import * as Misskey from 'misskey-js';
|
||||||
import XColumn from './column.vue';
|
import XColumn from './column.vue';
|
||||||
import { updateColumn, Column } from './deck-store.js';
|
import { updateColumn, Column } from './deck-store.js';
|
||||||
|
@ -36,6 +36,20 @@ const props = defineProps<{
|
||||||
|
|
||||||
const timeline = shallowRef<InstanceType<typeof MkTimeline>>();
|
const timeline = shallowRef<InstanceType<typeof MkTimeline>>();
|
||||||
const channel = shallowRef<Misskey.entities.Channel>();
|
const channel = shallowRef<Misskey.entities.Channel>();
|
||||||
|
const withRenotes = ref(props.column.withRenotes ?? true);
|
||||||
|
const onlyFiles = ref(props.column.onlyFiles ?? false);
|
||||||
|
|
||||||
|
watch(withRenotes, v => {
|
||||||
|
updateColumn(props.column.id, {
|
||||||
|
withRenotes: v,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
watch(onlyFiles, v => {
|
||||||
|
updateColumn(props.column.id, {
|
||||||
|
onlyFiles: v,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
if (props.column.channelId == null) {
|
if (props.column.channelId == null) {
|
||||||
setChannel();
|
setChannel();
|
||||||
|
@ -75,5 +89,13 @@ const menu = [{
|
||||||
icon: 'ph-pencil-simple ph-bold ph-lg',
|
icon: 'ph-pencil-simple ph-bold ph-lg',
|
||||||
text: i18n.ts.selectChannel,
|
text: i18n.ts.selectChannel,
|
||||||
action: setChannel,
|
action: setChannel,
|
||||||
|
}, {
|
||||||
|
type: 'switch',
|
||||||
|
text: i18n.ts.showRenotes,
|
||||||
|
ref: withRenotes,
|
||||||
|
}, {
|
||||||
|
type: 'switch',
|
||||||
|
text: i18n.ts.fileAttachedOnly,
|
||||||
|
ref: onlyFiles,
|
||||||
}];
|
}];
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -9,7 +9,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<i class="ph-list ph-bold ph-lg"></i><span style="margin-left: 8px;">{{ column.name }}</span>
|
<i class="ph-list ph-bold ph-lg"></i><span style="margin-left: 8px;">{{ column.name }}</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<MkTimeline v-if="column.listId" ref="timeline" src="list" :list="column.listId" :withRenotes="withRenotes"/>
|
<MkTimeline v-if="column.listId" ref="timeline" src="list" :list="column.listId" :key="column.listId + column.withRenotes + column.onlyFiles" :withRenotes="withRenotes" :onlyFiles="onlyFiles"/>
|
||||||
</XColumn>
|
</XColumn>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@ const props = defineProps<{
|
||||||
|
|
||||||
const timeline = shallowRef<InstanceType<typeof MkTimeline>>();
|
const timeline = shallowRef<InstanceType<typeof MkTimeline>>();
|
||||||
const withRenotes = ref(props.column.withRenotes ?? true);
|
const withRenotes = ref(props.column.withRenotes ?? true);
|
||||||
|
const onlyFiles = ref(props.column.onlyFiles ?? false);
|
||||||
|
|
||||||
if (props.column.listId == null) {
|
if (props.column.listId == null) {
|
||||||
setList();
|
setList();
|
||||||
|
@ -40,6 +41,12 @@ watch(withRenotes, v => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watch(onlyFiles, v => {
|
||||||
|
updateColumn(props.column.id, {
|
||||||
|
onlyFiles: v,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
async function setList() {
|
async function setList() {
|
||||||
const lists = await misskeyApi('users/lists/list');
|
const lists = await misskeyApi('users/lists/list');
|
||||||
const { canceled, result: list } = await os.select({
|
const { canceled, result: list } = await os.select({
|
||||||
|
@ -75,5 +82,10 @@ const menu = [
|
||||||
text: i18n.ts.showRenotes,
|
text: i18n.ts.showRenotes,
|
||||||
ref: withRenotes,
|
ref: withRenotes,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
type: 'switch',
|
||||||
|
text: i18n.ts.fileAttachedOnly,
|
||||||
|
ref: onlyFiles,
|
||||||
|
},
|
||||||
];
|
];
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -8,7 +8,7 @@ import meta from '../../package.json';
|
||||||
import pluginUnwindCssModuleClassName from './lib/rollup-plugin-unwind-css-module-class-name.js';
|
import pluginUnwindCssModuleClassName from './lib/rollup-plugin-unwind-css-module-class-name.js';
|
||||||
import pluginJson5 from './vite.json5.js';
|
import pluginJson5 from './vite.json5.js';
|
||||||
|
|
||||||
const extensions = ['.ts', '.tsx', '.js', '.jsx', '.mjs', '.json', '.json5', '.svg', '.sass', '.scss', '.css', '.vue'];
|
const extensions = ['.ts', '.tsx', '.js', '.jsx', '.mjs', '.json', '.json5', '.svg', '.sass', '.scss', '.css', '.vue', '.wasm'];
|
||||||
|
|
||||||
const hash = (str: string, seed = 0): number => {
|
const hash = (str: string, seed = 0): number => {
|
||||||
let h1 = 0xdeadbeef ^ seed,
|
let h1 = 0xdeadbeef ^ seed,
|
||||||
|
|
|
@ -19,6 +19,7 @@ namespace Entity {
|
||||||
content: string
|
content: string
|
||||||
plain_content?: string | null
|
plain_content?: string | null
|
||||||
created_at: string
|
created_at: string
|
||||||
|
edited_at: string | null
|
||||||
emojis: Emoji[]
|
emojis: Emoji[]
|
||||||
replies_count: number
|
replies_count: number
|
||||||
reblogs_count: number
|
reblogs_count: number
|
||||||
|
|
|
@ -725,6 +725,7 @@ namespace FriendicaAPI {
|
||||||
content: s.content,
|
content: s.content,
|
||||||
plain_content: null,
|
plain_content: null,
|
||||||
created_at: s.created_at,
|
created_at: s.created_at,
|
||||||
|
edited_at: s.edited_at || null,
|
||||||
emojis: Array.isArray(s.emojis) ? s.emojis.map(e => emoji(e)) : [],
|
emojis: Array.isArray(s.emojis) ? s.emojis.map(e => emoji(e)) : [],
|
||||||
replies_count: s.replies_count,
|
replies_count: s.replies_count,
|
||||||
reblogs_count: s.reblogs_count,
|
reblogs_count: s.reblogs_count,
|
||||||
|
|
|
@ -17,6 +17,7 @@ namespace FriendicaEntity {
|
||||||
reblog: Status | null
|
reblog: Status | null
|
||||||
content: string
|
content: string
|
||||||
created_at: string
|
created_at: string
|
||||||
|
edited_at?: string | null
|
||||||
emojis: Emoji[]
|
emojis: Emoji[]
|
||||||
replies_count: number
|
replies_count: number
|
||||||
reblogs_count: number
|
reblogs_count: number
|
||||||
|
|
|
@ -628,6 +628,7 @@ namespace MastodonAPI {
|
||||||
content: s.content,
|
content: s.content,
|
||||||
plain_content: null,
|
plain_content: null,
|
||||||
created_at: s.created_at,
|
created_at: s.created_at,
|
||||||
|
edited_at: s.edited_at || null,
|
||||||
emojis: Array.isArray(s.emojis) ? s.emojis.map(e => emoji(e)) : [],
|
emojis: Array.isArray(s.emojis) ? s.emojis.map(e => emoji(e)) : [],
|
||||||
replies_count: s.replies_count,
|
replies_count: s.replies_count,
|
||||||
reblogs_count: s.reblogs_count,
|
reblogs_count: s.reblogs_count,
|
||||||
|
|
|
@ -18,6 +18,7 @@ namespace MastodonEntity {
|
||||||
reblog: Status | null
|
reblog: Status | null
|
||||||
content: string
|
content: string
|
||||||
created_at: string
|
created_at: string
|
||||||
|
edited_at?: string | null
|
||||||
emojis: Emoji[]
|
emojis: Emoji[]
|
||||||
replies_count: number
|
replies_count: number
|
||||||
reblogs_count: number
|
reblogs_count: number
|
||||||
|
|
|
@ -283,6 +283,7 @@ namespace MisskeyAPI {
|
||||||
: '',
|
: '',
|
||||||
plain_content: n.text ? n.text : null,
|
plain_content: n.text ? n.text : null,
|
||||||
created_at: n.createdAt,
|
created_at: n.createdAt,
|
||||||
|
edited_at: n.updatedAt || null,
|
||||||
emojis: mapEmojis(n.emojis).concat(mapReactionEmojis(n.reactionEmojis)),
|
emojis: mapEmojis(n.emojis).concat(mapReactionEmojis(n.reactionEmojis)),
|
||||||
replies_count: n.repliesCount,
|
replies_count: n.repliesCount,
|
||||||
reblogs_count: n.renoteCount,
|
reblogs_count: n.renoteCount,
|
||||||
|
|
|
@ -7,6 +7,7 @@ namespace MisskeyEntity {
|
||||||
export type Note = {
|
export type Note = {
|
||||||
id: string
|
id: string
|
||||||
createdAt: string
|
createdAt: string
|
||||||
|
updatedAt?: string | null
|
||||||
userId: string
|
userId: string
|
||||||
user: User
|
user: User
|
||||||
text: string | null
|
text: string | null
|
||||||
|
|
|
@ -357,6 +357,7 @@ namespace PleromaAPI {
|
||||||
content: s.content,
|
content: s.content,
|
||||||
plain_content: s.pleroma.content?.['text/plain'] ? s.pleroma.content['text/plain'] : null,
|
plain_content: s.pleroma.content?.['text/plain'] ? s.pleroma.content['text/plain'] : null,
|
||||||
created_at: s.created_at,
|
created_at: s.created_at,
|
||||||
|
edited_at: s.edited_at || null,
|
||||||
emojis: Array.isArray(s.emojis) ? s.emojis.map(e => emoji(e)) : [],
|
emojis: Array.isArray(s.emojis) ? s.emojis.map(e => emoji(e)) : [],
|
||||||
replies_count: s.replies_count,
|
replies_count: s.replies_count,
|
||||||
reblogs_count: s.reblogs_count,
|
reblogs_count: s.reblogs_count,
|
||||||
|
|
|
@ -18,6 +18,7 @@ namespace PleromaEntity {
|
||||||
reblog: Status | null
|
reblog: Status | null
|
||||||
content: string
|
content: string
|
||||||
created_at: string
|
created_at: string
|
||||||
|
edited_at?: string | null
|
||||||
emojis: Emoji[]
|
emojis: Emoji[]
|
||||||
replies_count: number
|
replies_count: number
|
||||||
reblogs_count: number
|
reblogs_count: number
|
||||||
|
|
|
@ -49,6 +49,7 @@ const status: Entity.Status = {
|
||||||
content: 'hoge',
|
content: 'hoge',
|
||||||
plain_content: null,
|
plain_content: null,
|
||||||
created_at: '2019-03-26T21:40:32',
|
created_at: '2019-03-26T21:40:32',
|
||||||
|
edited_at: null,
|
||||||
emojis: [],
|
emojis: [],
|
||||||
replies_count: 0,
|
replies_count: 0,
|
||||||
reblogs_count: 0,
|
reblogs_count: 0,
|
||||||
|
|
|
@ -38,6 +38,7 @@ const status: Entity.Status = {
|
||||||
content: 'hoge',
|
content: 'hoge',
|
||||||
plain_content: 'hoge',
|
plain_content: 'hoge',
|
||||||
created_at: '2019-03-26T21:40:32',
|
created_at: '2019-03-26T21:40:32',
|
||||||
|
edited_at: null,
|
||||||
emojis: [],
|
emojis: [],
|
||||||
replies_count: 0,
|
replies_count: 0,
|
||||||
reblogs_count: 0,
|
reblogs_count: 0,
|
||||||
|
|
|
@ -37,6 +37,7 @@ const status: Entity.Status = {
|
||||||
content: 'hoge',
|
content: 'hoge',
|
||||||
plain_content: 'hoge',
|
plain_content: 'hoge',
|
||||||
created_at: '2019-03-26T21:40:32',
|
created_at: '2019-03-26T21:40:32',
|
||||||
|
edited_at: null,
|
||||||
emojis: [],
|
emojis: [],
|
||||||
replies_count: 0,
|
replies_count: 0,
|
||||||
reblogs_count: 0,
|
reblogs_count: 0,
|
||||||
|
|
Loading…
Reference in a new issue