Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
bb9ab31d5e | |||
9def80af8a | |||
9256bcdbe4 | |||
9b775022bc | |||
32371ed2bd | |||
8b98c08a81 | |||
7cf72f7447 | |||
913385b10d | |||
7306468d08 | |||
11e5667778 | |||
38cc02e261 |
@ -71,6 +71,7 @@ Please see [Contribution guide](./CONTRIBUTING.md).
|
||||
----------------------------------------------------------------
|
||||
<!-- PATREON_START -->
|
||||
<table><tr>
|
||||
<td><img src="https://c10.patreonusercontent.com/3/eyJ3IjoyMDB9/patreon-media/p/user/619786/32cf01444db24e578cd1982c197f6fc6/1?token-time=2145916800&token-hash=CXe9AqlZy9AsYfiWd3OBYVOzvODoN47Litz0Tu4BFpU%3D" alt="Gargron"></td>
|
||||
<td><img src="https://c10.patreonusercontent.com/3/eyJoIjoxMDAsInciOjEwMH0%3D/patreon-media/p/user/12731202/0995c46cdcb54153ab5f073f5869b70a/1?token-time=2145916800&token-hash=Yd60FK_SWfQO56SeiJpy1tDHOnCV4xdEywQe8gn5_Wo%3D" alt="negao"></td>
|
||||
<td><img src="https://c10.patreonusercontent.com/3/eyJoIjoxMDAsInciOjEwMH0%3D/patreon-media/p/user/13099460/43cecdbaa63a40d79bf50a96b9910b9d/1?token-time=2145916800&token-hash=d6P5MWHHsCMxUuBAEPAoVc5wLUR19mIhqAq7Ma9h9rI%3D" alt="ne_moni"></td>
|
||||
<td><img src="https://c10.patreonusercontent.com/3/eyJoIjoxMDAsInciOjEwMH0%3D/patreon-media/p/user/12913507/f7181eacafe8469a93033d85f5969c29/2?token-time=2145916800&token-hash=mgPdX9TqZxEg4TTPuc477dxhIgYk9246qafjWZEqZ7g%3D" alt="Melilot"></td>
|
||||
@ -80,6 +81,7 @@ Please see [Contribution guide](./CONTRIBUTING.md).
|
||||
<td><img src="https://c8.patreon.com/2/100/12718187" alt="Peter G."></td>
|
||||
<td><img src="https://c10.patreonusercontent.com/3/eyJoIjoxMDAsInciOjEwMH0%3D/patreon-media/p/user/13039004/509d0c412eb14ae08d6a812a3054f7d6/1?token-time=2145916800&token-hash=zwSu01tOtn5xTUucDZHuPsCxF2HBEMVs9ROJKTlEV_o%3D" alt="nemu"></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://www.patreon.com/mastodon">Gargron</a></td>
|
||||
<td><a href="https://www.patreon.com/negao">negao</a></td>
|
||||
<td><a href="https://www.patreon.com/user?u=13099460">ne_moni</a></td>
|
||||
<td><a href="https://www.patreon.com/user?u=12913507">Melilot</a></td>
|
||||
|
@ -1,8 +1,8 @@
|
||||
{
|
||||
"name": "misskey",
|
||||
"author": "syuilo <i@syuilo.com>",
|
||||
"version": "10.1.0",
|
||||
"clientVersion": "1.0.10352",
|
||||
"version": "10.2.0",
|
||||
"clientVersion": "1.0.10362",
|
||||
"codename": "nighthike",
|
||||
"main": "./built/index.js",
|
||||
"private": true,
|
||||
@ -96,7 +96,7 @@
|
||||
"crc-32": "1.2.0",
|
||||
"css-loader": "1.0.0",
|
||||
"dateformat": "3.0.3",
|
||||
"debug": "4.0.1",
|
||||
"debug": "4.1.0",
|
||||
"deep-equal": "1.0.1",
|
||||
"deepcopy": "0.6.3",
|
||||
"diskusage": "0.2.5",
|
||||
@ -204,7 +204,7 @@
|
||||
"ts-node": "7.0.1",
|
||||
"tslint": "5.10.0",
|
||||
"typescript": "2.9.2",
|
||||
"typescript-eslint-parser": "19.0.2",
|
||||
"typescript-eslint-parser": "20.0.0",
|
||||
"uglify-es": "3.3.9",
|
||||
"url-loader": "1.1.1",
|
||||
"uuid": "3.3.2",
|
||||
|
@ -26,12 +26,14 @@ export default Vue.extend({
|
||||
this.init();
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.connection.close();
|
||||
this.connection.dispose();
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
if (this.connection) this.connection.close();
|
||||
this.connection = new UserListStream((this as any).os, this.$store.state.i, this.list.id);
|
||||
if (this.connection) this.connection.dispose();
|
||||
this.connection = (this as any).os.stream.connectToChannel('userList', {
|
||||
listId: this.list.id
|
||||
});
|
||||
this.connection.on('note', this.onNote);
|
||||
this.connection.on('userAdded', this.onUserAdded);
|
||||
this.connection.on('userRemoved', this.onUserRemoved);
|
||||
|
@ -46,8 +46,10 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
mounted() {
|
||||
if (this.connection) this.connection.close();
|
||||
this.connection = new UserListStream((this as any).os, this.$store.state.i, this.list.id);
|
||||
if (this.connection) this.connection.dispose();
|
||||
this.connection = (this as any).os.stream.connectToChannel('userList', {
|
||||
listId: this.list.id
|
||||
});
|
||||
this.connection.on('note', this.onNote);
|
||||
this.connection.on('userAdded', this.onUserAdded);
|
||||
this.connection.on('userRemoved', this.onUserRemoved);
|
||||
@ -56,7 +58,7 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
this.connection.close();
|
||||
this.connection.dispose();
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
@ -36,13 +36,15 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
this.connection.close();
|
||||
this.connection.dispose();
|
||||
},
|
||||
|
||||
methods: {
|
||||
init() {
|
||||
if (this.connection) this.connection.close();
|
||||
this.connection = new UserListStream((this as any).os, this.$store.state.i, this.list.id);
|
||||
if (this.connection) this.connection.dispose();
|
||||
this.connection = (this as any).os.stream.connectToChannel('userList', {
|
||||
listId: this.list.id
|
||||
});
|
||||
this.connection.on('note', this.onNote);
|
||||
this.connection.on('userAdded', this.onUserAdded);
|
||||
this.connection.on('userRemoved', this.onUserRemoved);
|
||||
|
@ -44,6 +44,10 @@ module.exports = (server: http.Server) => {
|
||||
request.resourceURL.pathname === '/local-timeline' ? channels.localTimeline :
|
||||
request.resourceURL.pathname === '/hybrid-timeline' ? channels.hybridTimeline :
|
||||
request.resourceURL.pathname === '/global-timeline' ? channels.globalTimeline : null);
|
||||
|
||||
if (request.resourceURL.pathname === '/') {
|
||||
main.connectChannel(Math.random().toString(), null, channels.main);
|
||||
}
|
||||
}
|
||||
|
||||
connection.once('close', () => {
|
||||
|
64
src/tools/move-drive-files.ts
Normal file
64
src/tools/move-drive-files.ts
Normal file
@ -0,0 +1,64 @@
|
||||
import * as Minio from 'minio';
|
||||
import * as uuid from 'uuid';
|
||||
import DriveFile, { DriveFileChunk, getDriveFileBucket } from '../models/drive-file';
|
||||
import DriveFileThumbnail, { DriveFileThumbnailChunk } from '../models/drive-file-thumbnail';
|
||||
import config from '../config';
|
||||
|
||||
DriveFile.find({
|
||||
$or: [{
|
||||
withoutChunks: { $exists: false }
|
||||
}, {
|
||||
withoutChunks: false
|
||||
}]
|
||||
}).then(async files => {
|
||||
files.forEach(async file => {
|
||||
const minio = new Minio.Client(config.drive.config);
|
||||
|
||||
const keyDir = `${config.drive.prefix}/${uuid.v4()}`;
|
||||
const key = `${keyDir}/${name}`;
|
||||
const thumbnailKeyDir = `${config.drive.prefix}/${uuid.v4()}`;
|
||||
const thumbnailKey = `${thumbnailKeyDir}/${name}.thumbnail.jpg`;
|
||||
|
||||
const baseUrl = config.drive.baseUrl
|
||||
|| `${ config.drive.config.useSSL ? 'https' : 'http' }://${ config.drive.config.endPoint }${ config.drive.config.port ? `:${config.drive.config.port}` : '' }/${ config.drive.bucket }`;
|
||||
|
||||
const bucket = await getDriveFileBucket();
|
||||
const readable = bucket.openDownloadStream(file._id);
|
||||
|
||||
await minio.putObject(config.drive.bucket, key, readable, file.length, {
|
||||
'Content-Type': file.contentType,
|
||||
'Cache-Control': 'max-age=31536000, immutable'
|
||||
});
|
||||
|
||||
await DriveFile.findOneAndUpdate({ _id: file._id }, {
|
||||
$set: {
|
||||
'metadata.withoutChunks': true,
|
||||
'metadata.storage': 'minio',
|
||||
'metadata.storageProps': {
|
||||
key: key,
|
||||
thumbnailKey: thumbnailKey
|
||||
},
|
||||
'metadata.url': `${ baseUrl }/${ keyDir }/${ encodeURIComponent(name) }`,
|
||||
}
|
||||
});
|
||||
|
||||
// チャンクをすべて削除
|
||||
await DriveFileChunk.remove({
|
||||
files_id: file._id
|
||||
});
|
||||
|
||||
//#region サムネイルもあれば削除
|
||||
const thumbnail = await DriveFileThumbnail.findOne({
|
||||
'metadata.originalId': file._id
|
||||
});
|
||||
|
||||
if (thumbnail) {
|
||||
await DriveFileThumbnailChunk.remove({
|
||||
files_id: thumbnail._id
|
||||
});
|
||||
|
||||
await DriveFileThumbnail.remove({ _id: thumbnail._id });
|
||||
}
|
||||
//#endregion
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user