Apps are not allowed to read directly from the blobs table.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4410 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
d72ba81a67
commit
befff5c1e5
@ -118,17 +118,23 @@ class TfSneakerAppElement extends LitElement {
|
|||||||
zip.file(`message/classic/${this.sanitize(id)}.ndjson`, all_messages);
|
zip.file(`message/classic/${this.sanitize(id)}.ndjson`, all_messages);
|
||||||
|
|
||||||
let blobs = await tfrpc.rpc.query(
|
let blobs = await tfrpc.rpc.query(
|
||||||
`SELECT blobs.id
|
`SELECT messages_refs.ref AS id
|
||||||
FROM messages
|
FROM messages
|
||||||
JOIN messages_refs ON messages.id = messages_refs.message
|
JOIN messages_refs ON messages.id = messages_refs.message
|
||||||
JOIN blobs ON messages_refs.ref = blobs.id
|
WHERE messages.author = ? AND messages_refs.ref LIKE '&%.sha256'`,
|
||||||
WHERE messages.author = ?`,
|
|
||||||
[id]);
|
[id]);
|
||||||
let blobs_done = 0;
|
let blobs_done = 0;
|
||||||
for (let row of blobs) {
|
for (let row of blobs) {
|
||||||
this.progress = {name: 'blobs', value: blobs_done, max: blobs.length};
|
this.progress = {name: 'blobs', value: blobs_done, max: blobs.length};
|
||||||
let blob = await tfrpc.rpc.get_blob(row.id);
|
let blob;
|
||||||
|
try {
|
||||||
|
blob = await tfrpc.rpc.get_blob(row.id);
|
||||||
|
} catch (e) {
|
||||||
|
console.log(`Failed to get ${row.id}: ${e.message}`);
|
||||||
|
}
|
||||||
|
if (blob) {
|
||||||
zip.file(`blob/classic/${this.sanitize(row.id)}${this.guess_ext(blob)}`, new Uint8Array(blob));
|
zip.file(`blob/classic/${this.sanitize(row.id)}${this.guess_ext(blob)}`, new Uint8Array(blob));
|
||||||
|
}
|
||||||
blobs_done++;
|
blobs_done++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user