Compare commits
9 Commits
ebcac1a8de
...
a7a39328cd
Author | SHA1 | Date |
---|---|---|
nullobsi | a7a39328cd | |
nullobsi | 9cf7dd62a5 | |
nullobsi | 64f5c9f466 | |
nullobsi | c9647d583e | |
nullobsi | aa3f4f49f1 | |
nullobsi | 05e6395906 | |
nullobsi | 8dd7caae74 | |
nullobsi | 0cc3a41aff | |
nullobsi | abe7f86eb7 |
|
@ -279,6 +279,7 @@ emptyDrive: "ドライブは空です"
|
||||||
emptyFolder: "フォルダーは空です"
|
emptyFolder: "フォルダーは空です"
|
||||||
unableToDelete: "削除できません"
|
unableToDelete: "削除できません"
|
||||||
inputNewFileName: "新しいファイル名を入力してください"
|
inputNewFileName: "新しいファイル名を入力してください"
|
||||||
|
inputNewDescription: "新しいキャプションを入力してください"
|
||||||
inputNewFolderName: "新しいフォルダ名を入力してください"
|
inputNewFolderName: "新しいフォルダ名を入力してください"
|
||||||
circularReferenceFolder: "移動先のフォルダーは、移動するフォルダーのサブフォルダーです。"
|
circularReferenceFolder: "移動先のフォルダーは、移動するフォルダーのサブフォルダーです。"
|
||||||
hasChildFilesOrFolders: "このフォルダは空でないため、削除できません。"
|
hasChildFilesOrFolders: "このフォルダは空でないため、削除できません。"
|
||||||
|
@ -546,6 +547,8 @@ disablePlayer: "プレイヤーを閉じる"
|
||||||
expandTweet: "ツイートを展開する"
|
expandTweet: "ツイートを展開する"
|
||||||
themeEditor: "テーマエディター"
|
themeEditor: "テーマエディター"
|
||||||
description: "説明"
|
description: "説明"
|
||||||
|
describeFile: "キャプションを付く"
|
||||||
|
enterFileDescription: "キャプションを入力"
|
||||||
author: "作者"
|
author: "作者"
|
||||||
leaveConfirm: "未保存の変更があります。破棄しますか?"
|
leaveConfirm: "未保存の変更があります。破棄しますか?"
|
||||||
manage: "管理"
|
manage: "管理"
|
||||||
|
|
|
@ -87,6 +87,10 @@ export default defineComponent({
|
||||||
text: this.file.isSensitive ? this.$ts.unmarkAsSensitive : this.$ts.markAsSensitive,
|
text: this.file.isSensitive ? this.$ts.unmarkAsSensitive : this.$ts.markAsSensitive,
|
||||||
icon: this.file.isSensitive ? 'fas fa-eye' : 'fas fa-eye-slash',
|
icon: this.file.isSensitive ? 'fas fa-eye' : 'fas fa-eye-slash',
|
||||||
action: this.toggleSensitive
|
action: this.toggleSensitive
|
||||||
|
}, {
|
||||||
|
text: this.$ts.describeFile,
|
||||||
|
icon: 'fas fa-i-cursor',
|
||||||
|
action: this.describe
|
||||||
}, null, {
|
}, null, {
|
||||||
text: this.$ts.copyUrl,
|
text: this.$ts.copyUrl,
|
||||||
icon: 'fas fa-link',
|
icon: 'fas fa-link',
|
||||||
|
@ -150,6 +154,23 @@ export default defineComponent({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
describe() {
|
||||||
|
os.dialog({
|
||||||
|
title: this.$ts.describeFile,
|
||||||
|
input: {
|
||||||
|
placeholder: this.$ts.inputNewDescription,
|
||||||
|
default: this.file.comment !== null ? this.file.comment : "",
|
||||||
|
allowEmpty: true
|
||||||
|
}
|
||||||
|
}).then(({ canceled, result: comment }) => {
|
||||||
|
if (canceled) return;
|
||||||
|
os.api('drive/files/update', {
|
||||||
|
fileId: this.file.id,
|
||||||
|
comment: comment.length == 0 ? null : comment
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
toggleSensitive() {
|
toggleSensitive() {
|
||||||
os.api('drive/files/update', {
|
os.api('drive/files/update', {
|
||||||
fileId: this.file.id,
|
fileId: this.file.id,
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<MkModal ref="modal" @click="$refs.modal.close()" @closed="$emit('closed')">
|
<MkModal ref="modal" @click="$refs.modal.close()" @closed="$emit('closed')">
|
||||||
<div class="xubzgfga">
|
<div class="xubzgfga">
|
||||||
<header>{{ image.name }}</header>
|
<header>{{ image.name }}</header>
|
||||||
<img :src="image.url" :alt="image.name" :title="image.name" @click="$refs.modal.close()"/>
|
<img :src="image.url" :alt="image.comment" :title="image.comment" @click="$refs.modal.close()"/>
|
||||||
<footer>
|
<footer>
|
||||||
<span>{{ image.type }}</span>
|
<span>{{ image.type }}</span>
|
||||||
<span>{{ bytes(image.size) }}</span>
|
<span>{{ bytes(image.size) }}</span>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="qjewsnkg" v-if="hide" @click="hide = false">
|
<div class="qjewsnkg" v-if="hide" @click="hide = false">
|
||||||
<ImgWithBlurhash class="bg" :hash="image.blurhash" :title="image.name"/>
|
<ImgWithBlurhash class="bg" :hash="image.blurhash" :title="image.comment" :alt="image.comment"/>
|
||||||
<div class="text">
|
<div class="text">
|
||||||
<div>
|
<div>
|
||||||
<b><i class="fas fa-exclamation-triangle"></i> {{ $ts.sensitive }}</b>
|
<b><i class="fas fa-exclamation-triangle"></i> {{ $ts.sensitive }}</b>
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
:title="image.name"
|
:title="image.name"
|
||||||
@click.prevent="onClick"
|
@click.prevent="onClick"
|
||||||
>
|
>
|
||||||
<ImgWithBlurhash :hash="image.blurhash" :src="url" :alt="image.name" :title="image.name" :cover="false"/>
|
<ImgWithBlurhash :hash="image.blurhash" :src="url" :alt="image.comment" :title="image.comment" :cover="false"/>
|
||||||
<div class="gif" v-if="image.type === 'image/gif'">GIF</div>
|
<div class="gif" v-if="image.type === 'image/gif'">GIF</div>
|
||||||
</a>
|
</a>
|
||||||
<i class="fas fa-eye-slash" @click="hide = true"></i>
|
<i class="fas fa-eye-slash" @click="hide = true"></i>
|
||||||
|
|
|
@ -89,6 +89,22 @@ export default defineComponent({
|
||||||
file.name = result;
|
file.name = result;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async describe(file) {
|
||||||
|
const { canceled, result } = await os.dialog({
|
||||||
|
title: this.$ts.enterFileDescription,
|
||||||
|
input: {
|
||||||
|
default: file.comment !== null ? file.comment : ""
|
||||||
|
},
|
||||||
|
allowEmpty: false
|
||||||
|
});
|
||||||
|
if (canceled) return;
|
||||||
|
os.api('drive/files/update', {
|
||||||
|
fileId: file.id,
|
||||||
|
comment: result.length == 0 ? null : result
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
showFileMenu(file, ev: MouseEvent) {
|
showFileMenu(file, ev: MouseEvent) {
|
||||||
if (this.menu) return;
|
if (this.menu) return;
|
||||||
this.menu = os.modalMenu([{
|
this.menu = os.modalMenu([{
|
||||||
|
@ -99,6 +115,10 @@ export default defineComponent({
|
||||||
text: file.isSensitive ? this.$ts.unmarkAsSensitive : this.$ts.markAsSensitive,
|
text: file.isSensitive ? this.$ts.unmarkAsSensitive : this.$ts.markAsSensitive,
|
||||||
icon: file.isSensitive ? 'fas fa-eye-slash' : 'fas fa-eye',
|
icon: file.isSensitive ? 'fas fa-eye-slash' : 'fas fa-eye',
|
||||||
action: () => { this.toggleSensitive(file) }
|
action: () => { this.toggleSensitive(file) }
|
||||||
|
},{
|
||||||
|
text: this.$ts.describeFile,
|
||||||
|
icon: 'fas fa-i-cursor',
|
||||||
|
action: () => { this.describe(file) }
|
||||||
}, {
|
}, {
|
||||||
text: this.$ts.attachCancel,
|
text: this.$ts.attachCancel,
|
||||||
icon: 'fas fa-times-circle',
|
icon: 'fas fa-times-circle',
|
||||||
|
|
|
@ -28,7 +28,7 @@ export async function createImage(actor: IRemoteUser, value: any): Promise<Drive
|
||||||
const instance = await fetchMeta();
|
const instance = await fetchMeta();
|
||||||
const cache = instance.cacheRemoteFiles;
|
const cache = instance.cacheRemoteFiles;
|
||||||
|
|
||||||
let file = await uploadFromUrl(image.url, actor, null, image.url, image.sensitive, false, !cache);
|
let file = await uploadFromUrl(image.url, actor, null, image.url, image.sensitive, false, !cache, image.name);
|
||||||
|
|
||||||
if (file.isLink) {
|
if (file.isLink) {
|
||||||
// URLが異なっている場合、同じ画像が以前に異なるURLで登録されていたということなので、
|
// URLが異なっている場合、同じ画像が以前に異なるURLで登録されていたということなので、
|
||||||
|
|
|
@ -4,5 +4,6 @@ import { DriveFiles } from '../../../models';
|
||||||
export default (file: DriveFile) => ({
|
export default (file: DriveFile) => ({
|
||||||
type: 'Document',
|
type: 'Document',
|
||||||
mediaType: file.type,
|
mediaType: file.type,
|
||||||
url: DriveFiles.getPublicUrl(file)
|
url: DriveFiles.getPublicUrl(file),
|
||||||
|
name: file.comment,
|
||||||
});
|
});
|
||||||
|
|
|
@ -49,6 +49,14 @@ export const meta = {
|
||||||
'ja-JP': 'このメディアが「閲覧注意」(NSFW)かどうか',
|
'ja-JP': 'このメディアが「閲覧注意」(NSFW)かどうか',
|
||||||
'en-US': 'Whether this media is NSFW'
|
'en-US': 'Whether this media is NSFW'
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
comment: {
|
||||||
|
validator: $.optional.nullable.str,
|
||||||
|
default: undefined as any,
|
||||||
|
desc: {
|
||||||
|
'ja-JP': 'コメント'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -92,6 +100,8 @@ export default define(meta, async (ps, user) => {
|
||||||
|
|
||||||
if (ps.name) file.name = ps.name;
|
if (ps.name) file.name = ps.name;
|
||||||
|
|
||||||
|
if (ps.comment !== undefined) file.comment = ps.comment;
|
||||||
|
|
||||||
if (ps.isSensitive !== undefined) file.isSensitive = ps.isSensitive;
|
if (ps.isSensitive !== undefined) file.isSensitive = ps.isSensitive;
|
||||||
|
|
||||||
if (ps.folderId !== undefined) {
|
if (ps.folderId !== undefined) {
|
||||||
|
@ -113,6 +123,7 @@ export default define(meta, async (ps, user) => {
|
||||||
|
|
||||||
await DriveFiles.update(file.id, {
|
await DriveFiles.update(file.id, {
|
||||||
name: file.name,
|
name: file.name,
|
||||||
|
comment: file.comment,
|
||||||
folderId: file.folderId,
|
folderId: file.folderId,
|
||||||
isSensitive: file.isSensitive
|
isSensitive: file.isSensitive
|
||||||
});
|
});
|
||||||
|
|
|
@ -25,6 +25,12 @@ export default async (
|
||||||
name = null;
|
name = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the comment is same as the name, skip comment
|
||||||
|
// (image.name is passed in when receiving attachment)
|
||||||
|
if (comment !== null && name == comment) {
|
||||||
|
comment = null;
|
||||||
|
}
|
||||||
|
|
||||||
// Create temp file
|
// Create temp file
|
||||||
const [path, cleanup] = await createTemp();
|
const [path, cleanup] = await createTemp();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue