Compare commits
7 Commits
11.0.0-alp
...
11.0.0-alp
Author | SHA1 | Date | |
---|---|---|---|
![]() |
96443384fe | ||
![]() |
69939f1edb | ||
![]() |
e3c0058942 | ||
![]() |
3dc2361654 | ||
![]() |
ec2f709018 | ||
![]() |
ea06665c51 | ||
![]() |
74a4bd704c |
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "misskey",
|
"name": "misskey",
|
||||||
"author": "syuilo <i@syuilo.com>",
|
"author": "syuilo <i@syuilo.com>",
|
||||||
"version": "11.0.0-alpha.5",
|
"version": "11.0.0-alpha.6",
|
||||||
"codename": "daybreak",
|
"codename": "daybreak",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
18
src/init.ts
18
src/init.ts
@@ -1,16 +1,10 @@
|
|||||||
import { initDb } from './db/postgre';
|
import { initDb } from './db/postgre';
|
||||||
|
|
||||||
async function main() {
|
console.log('Init database...');
|
||||||
try {
|
|
||||||
console.log('Connecting database...');
|
|
||||||
await initDb(false, true, true);
|
|
||||||
} catch (e) {
|
|
||||||
console.error('Cannot connect to database', null, true);
|
|
||||||
console.error(e);
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
initDb(false, true, true).then(() => {
|
||||||
console.log('Done :)');
|
console.log('Done :)');
|
||||||
}
|
}, e => {
|
||||||
|
console.error('Failed to init database');
|
||||||
main();
|
console.error(e);
|
||||||
|
});
|
||||||
|
@@ -171,9 +171,9 @@ async function main() {
|
|||||||
accessKey: file.metadata.storage.key,
|
accessKey: file.metadata.storage.key,
|
||||||
folderId: file.metadata.folderId ? file.metadata.folderId.toHexString() : null,
|
folderId: file.metadata.folderId ? file.metadata.folderId.toHexString() : null,
|
||||||
storedInternal: false,
|
storedInternal: false,
|
||||||
isRemote: false
|
isLink: false
|
||||||
});
|
});
|
||||||
} else if (!file.metadata.isRemote) {
|
} else if (!file.metadata.isLink) {
|
||||||
const [temp, clean] = await createTemp();
|
const [temp, clean] = await createTemp();
|
||||||
await new Promise(async (res, rej) => {
|
await new Promise(async (res, rej) => {
|
||||||
const bucket = await getDriveFileBucket();
|
const bucket = await getDriveFileBucket();
|
||||||
@@ -201,9 +201,9 @@ async function main() {
|
|||||||
url: url,
|
url: url,
|
||||||
uri: file.metadata.uri,
|
uri: file.metadata.uri,
|
||||||
accessKey: key,
|
accessKey: key,
|
||||||
folderId: file.metadata.folderId,
|
folderId: file.metadata.folderId ? file.metadata.folderId.toHexString() : null,
|
||||||
storedInternal: true,
|
storedInternal: true,
|
||||||
isRemote: false
|
isLink: false
|
||||||
});
|
});
|
||||||
clean();
|
clean();
|
||||||
} else {
|
} else {
|
||||||
@@ -220,9 +220,9 @@ async function main() {
|
|||||||
url: file.metadata.url,
|
url: file.metadata.url,
|
||||||
uri: file.metadata.uri,
|
uri: file.metadata.uri,
|
||||||
accessKey: null,
|
accessKey: null,
|
||||||
folderId: file.metadata.folderId,
|
folderId: file.metadata.folderId ? file.metadata.folderId.toHexString() : null,
|
||||||
storedInternal: false,
|
storedInternal: false,
|
||||||
isRemote: true
|
isLink: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -307,7 +307,7 @@ async function main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function migrateEmoji(emoji: any) {
|
async function migrateEmoji(emoji: any) {
|
||||||
await NoteReactions.save({
|
await Emojis.save({
|
||||||
id: emoji._id.toHexString(),
|
id: emoji._id.toHexString(),
|
||||||
updatedAt: emoji.createdAt,
|
updatedAt: emoji.createdAt,
|
||||||
aliases: emoji.aliases,
|
aliases: emoji.aliases,
|
||||||
@@ -462,6 +462,8 @@ async function main() {
|
|||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('DONE :)');
|
||||||
}
|
}
|
||||||
|
|
||||||
main();
|
main();
|
||||||
|
@@ -150,5 +150,5 @@ export class DriveFile {
|
|||||||
default: false,
|
default: false,
|
||||||
comment: 'Whether the DriveFile is direct link to remote server.'
|
comment: 'Whether the DriveFile is direct link to remote server.'
|
||||||
})
|
})
|
||||||
public isRemote: boolean;
|
public isLink: boolean;
|
||||||
}
|
}
|
||||||
|
@@ -40,7 +40,7 @@ export async function createImage(actor: IRemoteUser, value: any): Promise<Drive
|
|||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file.isRemote) {
|
if (file.isLink) {
|
||||||
// URLが異なっている場合、同じ画像が以前に異なるURLで登録されていたということなので、
|
// URLが異なっている場合、同じ画像が以前に異なるURLで登録されていたということなので、
|
||||||
// URLを更新する
|
// URLを更新する
|
||||||
if (file.url !== image.url) {
|
if (file.url !== image.url) {
|
||||||
|
@@ -375,7 +375,7 @@ export default async function(
|
|||||||
file.folderId = folder !== null ? folder.id : null;
|
file.folderId = folder !== null ? folder.id : null;
|
||||||
file.comment = comment;
|
file.comment = comment;
|
||||||
file.properties = properties;
|
file.properties = properties;
|
||||||
file.isRemote = isLink;
|
file.isLink = isLink;
|
||||||
file.isSensitive = Users.isLocalUser(user) && user.alwaysMarkNsfw ? true :
|
file.isSensitive = Users.isLocalUser(user) && user.alwaysMarkNsfw ? true :
|
||||||
(sensitive !== null && sensitive !== undefined)
|
(sensitive !== null && sensitive !== undefined)
|
||||||
? sensitive
|
? sensitive
|
||||||
|
@@ -16,7 +16,7 @@ export default async function(file: DriveFile, isExpired = false) {
|
|||||||
if (file.webpublicUrl) {
|
if (file.webpublicUrl) {
|
||||||
InternalStorage.del(file.webpublicAccessKey);
|
InternalStorage.del(file.webpublicAccessKey);
|
||||||
}
|
}
|
||||||
} else if (!file.isRemote) {
|
} else if (!file.isLink) {
|
||||||
const minio = new Minio.Client(config.drive.config);
|
const minio = new Minio.Client(config.drive.config);
|
||||||
|
|
||||||
await minio.removeObject(config.drive.bucket, file.accessKey);
|
await minio.removeObject(config.drive.bucket, file.accessKey);
|
||||||
@@ -33,7 +33,7 @@ export default async function(file: DriveFile, isExpired = false) {
|
|||||||
// リモートファイル期限切れ削除後は直リンクにする
|
// リモートファイル期限切れ削除後は直リンクにする
|
||||||
if (isExpired && file.userHost !== null) {
|
if (isExpired && file.userHost !== null) {
|
||||||
DriveFiles.update(file.id, {
|
DriveFiles.update(file.id, {
|
||||||
isRemote: true,
|
isLink: true,
|
||||||
url: file.uri,
|
url: file.uri,
|
||||||
thumbnailUrl: null,
|
thumbnailUrl: null,
|
||||||
webpublicUrl: null
|
webpublicUrl: null
|
||||||
|
Reference in New Issue
Block a user