Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

システムユーザーのファイル一覧を追加 #595

Merged
merged 5 commits into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const paramDef = {
untilId: { type: 'string', format: 'misskey:id' },
userId: { type: 'string', format: 'misskey:id', nullable: true },
type: { type: 'string', nullable: true, pattern: /^[a-zA-Z0-9\/\-*]+$/.toString().slice(1, -1) },
origin: { type: 'string', enum: ['combined', 'local', 'remote'], default: 'local' },
origin: { type: 'string', enum: ['combined', 'local', 'remote', 'system'], default: 'local' },
hostname: {
type: 'string',
nullable: true,
Expand Down Expand Up @@ -66,6 +66,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
query.andWhere('file.userHost IS NULL');
} else if (ps.origin === 'remote') {
query.andWhere('file.userHost IS NOT NULL');
} else if (ps.origin === 'system') {
query.andWhere('file.userId IS NULL');
}

if (ps.hostname) {
Expand Down
2 changes: 1 addition & 1 deletion packages/cherrypick-js/src/autogen/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7550,7 +7550,7 @@ export type operations = {
* @default local
* @enum {string}
*/
origin?: 'combined' | 'local' | 'remote';
origin?: 'combined' | 'local' | 'remote' | 'system';
/**
* @description The local host is represented with `null`.
* @default null
Expand Down
60 changes: 60 additions & 0 deletions packages/frontend/src/components/MkFileListForAdmin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ SPDX-License-Identifier: AGPL-3.0-only
class="file _button"
>
<div v-if="file.isSensitive" class="sensitive-label">{{ i18n.ts.sensitive }}</div>
<div v-if="customEmojiUrls.includes(file.url)" class="label">
<img class="labelImg" src="/client-assets/label.svg"/>
<p class="labelText">{{ i18n.ts.emoji }}</p>
</div>
<MkDriveFileThumbnail class="thumbnail" :file="file" fit="contain" :highlightWhenSensitive="true"/>
<div v-if="viewMode === 'list'" class="body">
<div>
Expand All @@ -38,12 +42,18 @@ SPDX-License-Identifier: AGPL-3.0-only

<script lang="ts" setup>
import * as Misskey from 'cherrypick-js';
import { ref, watch } from 'vue';
import MkPagination from '@/components/MkPagination.vue';
import MkDriveFileThumbnail from '@/components/MkDriveFileThumbnail.vue';
import bytes from '@/filters/bytes.js';
import { i18n } from '@/i18n.js';
import { dateString } from '@/filters/date.js';
import { customEmojis, customEmojisMap } from '@/custom-emojis.js';

let customEmojiUrls = ref<string[]>([]);
watch(customEmojis, emojis => {
customEmojiUrls.value = emojis.map(emoji => emoji.url);
}, { immediate: true });
const props = defineProps<{
pagination: any;
viewMode: 'grid' | 'list';
Expand Down Expand Up @@ -114,5 +124,55 @@ const props = defineProps<{
}
}
}

.label {
position: absolute;
top: 0;
left: 0;
pointer-events: none;

&::before,
&::after {
content: "";
display: block;
position: absolute;
z-index: 1;
background: #0c7ac9;
}

&::before {
top: 0;
left: 57px;
width: 28px;
height: 8px;
}

&::after {
top: 57px;
left: 0;
width: 8px;
height: 28px;
}
}

.labelImg {
position: absolute;
z-index: 2;
top: 0;
left: 0;
}

.labelText {
position: absolute;
z-index: 3;
top: 19px;
left: -28px;
width: 120px;
margin: 0;
text-align: center;
line-height: 28px;
color: #fff;
transform: rotate(-45deg);
}
}
</style>
3 changes: 2 additions & 1 deletion packages/frontend/src/pages/admin/files.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<option value="combined">{{ i18n.ts.all }}</option>
<option value="local">{{ i18n.ts.local }}</option>
<option value="remote">{{ i18n.ts.remote }}</option>
<option value="system">{{ i18n.ts.system }}</option>
</MkSelect>
<MkInput v-model="searchHost" :debounce="true" type="search" style="margin: 0; flex: 1;" :disabled="pagination.params.origin === 'local'">
<template #label>{{ i18n.ts.host }}</template>
Expand Down Expand Up @@ -50,7 +51,7 @@ const origin = ref('local');
const type = ref<string | null>(null);
const searchHost = ref('');
const userId = ref('');
const viewMode = ref('grid');
const viewMode = ref<'grid'|'list'>('grid');
penginn-net marked this conversation as resolved.
Show resolved Hide resolved
const pagination = {
endpoint: 'admin/drive/files' as const,
limit: 10,
Expand Down
Loading