mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-13 13:37:31 -07:00
Fix remote drive expire (#7543)
This commit is contained in:
parent
dbad279b3a
commit
f41b24b555
3 changed files with 7 additions and 2 deletions
|
@ -59,6 +59,7 @@ export class DriveFileRepository extends Repository<DriveFile> {
|
||||||
const { sum } = await this
|
const { sum } = await this
|
||||||
.createQueryBuilder('file')
|
.createQueryBuilder('file')
|
||||||
.where('file.userId = :id', { id: id })
|
.where('file.userId = :id', { id: id })
|
||||||
|
.andWhere('file.isLink = FALSE')
|
||||||
.select('SUM(file.size)', 'sum')
|
.select('SUM(file.size)', 'sum')
|
||||||
.getRawOne();
|
.getRawOne();
|
||||||
|
|
||||||
|
@ -69,6 +70,7 @@ export class DriveFileRepository extends Repository<DriveFile> {
|
||||||
const { sum } = await this
|
const { sum } = await this
|
||||||
.createQueryBuilder('file')
|
.createQueryBuilder('file')
|
||||||
.where('file.userHost = :host', { host: toPuny(host) })
|
.where('file.userHost = :host', { host: toPuny(host) })
|
||||||
|
.andWhere('file.isLink = FALSE')
|
||||||
.select('SUM(file.size)', 'sum')
|
.select('SUM(file.size)', 'sum')
|
||||||
.getRawOne();
|
.getRawOne();
|
||||||
|
|
||||||
|
@ -79,6 +81,7 @@ export class DriveFileRepository extends Repository<DriveFile> {
|
||||||
const { sum } = await this
|
const { sum } = await this
|
||||||
.createQueryBuilder('file')
|
.createQueryBuilder('file')
|
||||||
.where('file.userHost IS NULL')
|
.where('file.userHost IS NULL')
|
||||||
|
.andWhere('file.isLink = FALSE')
|
||||||
.select('SUM(file.size)', 'sum')
|
.select('SUM(file.size)', 'sum')
|
||||||
.getRawOne();
|
.getRawOne();
|
||||||
|
|
||||||
|
@ -89,6 +92,7 @@ export class DriveFileRepository extends Repository<DriveFile> {
|
||||||
const { sum } = await this
|
const { sum } = await this
|
||||||
.createQueryBuilder('file')
|
.createQueryBuilder('file')
|
||||||
.where('file.userHost IS NOT NULL')
|
.where('file.userHost IS NOT NULL')
|
||||||
|
.andWhere('file.isLink = FALSE')
|
||||||
.select('SUM(file.size)', 'sum')
|
.select('SUM(file.size)', 'sum')
|
||||||
.getRawOne();
|
.getRawOne();
|
||||||
|
|
||||||
|
|
|
@ -267,7 +267,8 @@ async function upload(key: string, stream: fs.ReadStream | Buffer, type: string,
|
||||||
|
|
||||||
async function deleteOldFile(user: IRemoteUser) {
|
async function deleteOldFile(user: IRemoteUser) {
|
||||||
const q = DriveFiles.createQueryBuilder('file')
|
const q = DriveFiles.createQueryBuilder('file')
|
||||||
.where('file.userId = :userId', { userId: user.id });
|
.where('file.userId = :userId', { userId: user.id })
|
||||||
|
.andWhere('file.isLink = FALSE');
|
||||||
|
|
||||||
if (user.avatarId) {
|
if (user.avatarId) {
|
||||||
q.andWhere('file.id != :avatarId', { avatarId: user.avatarId });
|
q.andWhere('file.id != :avatarId', { avatarId: user.avatarId });
|
||||||
|
|
|
@ -79,7 +79,7 @@ async function postProcess(file: DriveFile, isExpired = false) {
|
||||||
url: file.uri,
|
url: file.uri,
|
||||||
thumbnailUrl: null,
|
thumbnailUrl: null,
|
||||||
webpublicUrl: null,
|
webpublicUrl: null,
|
||||||
size: 0,
|
storedInternal: false,
|
||||||
// ローカルプロキシ用
|
// ローカルプロキシ用
|
||||||
accessKey: uuid(),
|
accessKey: uuid(),
|
||||||
thumbnailAccessKey: 'thumbnail-' + uuid(),
|
thumbnailAccessKey: 'thumbnail-' + uuid(),
|
||||||
|
|
Loading…
Reference in a new issue