Compare commits

..

5 Commits

Author SHA1 Message Date
Derek a773fbfd40 Federate channels at a very basic and prob stupid level 2022-05-22 09:16:19 -04:00
Derek b58d9a3056 *sigh* bump again
i should test better locally
2022-05-21 17:17:18 -04:00
Derek 394c91d385 Allow big files in db 2022-05-21 17:16:48 -04:00
Derek db3940f354 Bump 2022-05-21 16:05:55 -04:00
Derek d4cd641f74 Do not read the ENTIRE file before
uploading 

No idea if this code is supposed to serve a purpose, but it breaks on 
files larger than 4GB in firefox and chrome, and the read file-as-buffer 
is never used
2022-05-21 16:05:33 -04:00
8 changed files with 74 additions and 66 deletions

View File

@ -1,6 +1,6 @@
{
"name": "misskey",
"version": "12.110.1+birb3",
"version": "12.110.1+birb3-2",
"codename": "indigo",
"repository": {
"type": "git",

View File

@ -0,0 +1,11 @@
export class largeFile1653167275806 {
name = 'largeFile1653167275806'
async up(queryRunner) {
await queryRunner.query(`ALTER TABLE "drive_file" ALTER COLUMN size TYPE bigint`);
}
async down(queryRunner) {
await queryRunner.query(`ALTER TABLE "drive_file" ALTER COLUMN size TYPE integer`);
}
}

View File

@ -56,7 +56,7 @@ export class DriveFile {
})
public type: string;
@Column('integer', {
@Column('bigint', {
comment: 'The file size (bytes) of the DriveFile.',
})
public size: number;

View File

@ -60,19 +60,25 @@ export default async function renderNote(note: Note, dive = true, isTalk = false
let to: string[] = [];
let cc: string[] = [];
if (note.visibility === 'public') {
to = ['https://www.w3.org/ns/activitystreams#Public'];
cc = [`${attributedTo}/followers`].concat(mentions);
} else if (note.visibility === 'home') {
to = [`${attributedTo}/followers`];
cc = ['https://www.w3.org/ns/activitystreams#Public'].concat(mentions);
} else if (note.visibility === 'followers') {
to = [`${attributedTo}/followers`];
cc = mentions;
if (note.channelId) {
to = [{ type: 'Group', name: note.channelId }];
cc = [`${attributedTo}/followers`, 'https://www.w3.org/ns/activitystreams#Public'].concat(mentions);
} else {
to = mentions;
if (note.visibility === 'public') {
to = ['https://www.w3.org/ns/activitystreams#Public'];
cc = [`${attributedTo}/followers`].concat(mentions);
} else if (note.visibility === 'home') {
to = [`${attributedTo}/followers`];
cc = ['https://www.w3.org/ns/activitystreams#Public'].concat(mentions);
} else if (note.visibility === 'followers') {
to = [`${attributedTo}/followers`];
cc = mentions;
} else {
to = mentions;
}
}
const mentionedUsers = note.mentions.length > 0 ? await Users.findBy({
id: In(note.mentions),
}) : [];

View File

@ -148,10 +148,9 @@ export default async (user: { id: User['id']; username: User['username']; host:
if (data.localOnly == null) data.localOnly = false;
if (data.channel != null) data.visibility = 'public';
if (data.channel != null) data.visibleUsers = [];
if (data.channel != null) data.localOnly = true;
// サイレンス
if (user.isSilenced && data.visibility === 'public' && data.channel == null) {
if (user.isSilenced && data.visibility === 'public') {
data.visibility = 'home';
}
@ -176,12 +175,12 @@ export default async (user: { id: User['id']; username: User['username']; host:
}
// ローカルのみをRenoteしたらローカルのみにする
if (data.renote && data.renote.localOnly && data.channel == null) {
if (data.renote && data.renote.localOnly) {
data.localOnly = true;
}
// ローカルのみにリプライしたらローカルのみにする
if (data.reply && data.reply.localOnly && data.channel == null) {
if (data.reply && data.reply.localOnly) {
data.localOnly = true;
}

View File

@ -255,7 +255,6 @@ if (props.reply && props.reply.text != null) {
if (props.channel) {
visibility = 'public';
localOnly = true; // TODO:
}
//

View File

@ -554,61 +554,55 @@ export function upload(file: File, folder?: any, name?: string, keepOriginal: bo
return new Promise((resolve, reject) => {
const id = Math.random().toString();
const reader = new FileReader();
reader.onload = (e) => {
const ctx = reactive({
id: id,
name: name || file.name || 'untitled',
progressMax: undefined,
progressValue: undefined,
img: window.URL.createObjectURL(file)
});
const ctx = reactive({
id: id,
name: name || file.name || 'untitled',
progressMax: undefined,
progressValue: undefined,
img: window.URL.createObjectURL(file)
});
uploads.value.push(ctx);
uploads.value.push(ctx);
console.log(keepOriginal);
const data = new FormData();
data.append('i', $i.token);
data.append('force', 'true');
data.append('file', file);
const data = new FormData();
data.append('i', $i.token);
data.append('force', 'true');
data.append('file', file);
if (folder) data.append('folderId', folder);
if (name) data.append('name', name);
const xhr = new XMLHttpRequest();
xhr.open('POST', apiUrl + '/drive/files/create', true);
xhr.onload = (ev) => {
if (xhr.status !== 200 || ev.target == null || ev.target.response == null) {
// TODO: 消すのではなくて再送できるようにしたい
uploads.value = uploads.value.filter(x => x.id != id);
alert({
type: 'error',
text: 'upload failed'
});
reject();
return;
}
const driveFile = JSON.parse(ev.target.response);
resolve(driveFile);
if (folder) data.append('folderId', folder);
if (name) data.append('name', name);
const xhr = new XMLHttpRequest();
xhr.open('POST', apiUrl + '/drive/files/create', true);
xhr.onload = (ev) => {
if (xhr.status !== 200 || ev.target == null || ev.target.response == null) {
// TODO: 消すのではなくて再送できるようにしたい
uploads.value = uploads.value.filter(x => x.id != id);
};
xhr.upload.onprogress = e => {
if (e.lengthComputable) {
ctx.progressMax = e.total;
ctx.progressValue = e.loaded;
}
};
alert({
type: 'error',
text: 'upload failed'
});
xhr.send(data);
reject();
return;
}
const driveFile = JSON.parse(ev.target.response);
resolve(driveFile);
uploads.value = uploads.value.filter(x => x.id != id);
};
reader.readAsArrayBuffer(file);
xhr.upload.onprogress = e => {
if (e.lengthComputable) {
ctx.progressMax = e.total;
ctx.progressValue = e.loaded;
}
};
xhr.send(data);
});
}

View File

@ -235,7 +235,6 @@ export default defineComponent({
if (this.channel) {
this.visibility = 'public';
this.localOnly = true; // TODO:
}
//