hippofish/packages/backend/src/misc
Johann150 e27c6abaea
refactor: temporary files (#8713)
* simplify temporary files for thumbnails

Because only a single file will be written to the directory, creating a
separate directory seems unnecessary. If only a temporary file is created,
the code from `createTemp` can be reused here as well.

* refactor: deduplicate code for temporary files/directories

To follow the DRY principle, the same code should not be duplicated
across different files. Instead an already existing function is used.

Because temporary directories are also create in multiple locations,
a function for this is also newly added to reduce duplication.

* fix: clean up identicon temp files

The temporary files for identicons are not reused and can be deleted
after they are fully read. This condition is met when the stream is closed
and so the file can be cleaned up using the events API of the stream.

* fix: ensure cleanup is called when download fails

* fix: ensure cleanup is called in error conditions

This covers import/export queue jobs and is mostly just wrapping all
code in a try...finally statement where the finally runs the cleanup.

* fix: use correct type instead of `any`
2022-05-25 16:50:22 +09:00
..
id refactor: Use ESM (#8358) 2022-02-27 11:07:39 +09:00
acct.ts refactor: Use ESM (#8358) 2022-02-27 11:07:39 +09:00
antenna-cache.ts refactor: Use ESM (#8358) 2022-02-27 11:07:39 +09:00
api-permissions.ts refactoring 2021-11-12 02:02:25 +09:00
app-lock.ts refactor: Use ESM (#8358) 2022-02-27 11:07:39 +09:00
before-shutdown.ts refactor 2022-02-04 11:10:53 +09:00
cache.ts perf: fix caching (#8660) 2022-05-14 13:28:27 +09:00
captcha.ts fix types 2022-04-03 16:30:22 +09:00
check-hit-antenna.ts refactor: migrate to typeorm 3.0 (#8443) 2022-03-26 15:34:00 +09:00
check-word-mute.ts refactor: Use ESM (#8358) 2022-02-27 11:07:39 +09:00
content-disposition.ts refactor: Use ESM (#8358) 2022-02-27 11:07:39 +09:00
convert-host.ts refactor: Use ESM (#8358) 2022-02-27 11:07:39 +09:00
count-same-renotes.ts refactor: Use ESM (#8358) 2022-02-27 11:07:39 +09:00
create-temp.ts refactor: temporary files (#8713) 2022-05-25 16:50:22 +09:00
detect-url-mime.ts refactor: Use ESM (#8358) 2022-02-27 11:07:39 +09:00
download-text-file.ts refactor: Use ESM (#8358) 2022-02-27 11:07:39 +09:00
download-url.ts Fix bug : "IPCIDR is not a constructor" (#8400) 2022-03-12 19:23:57 +09:00
emoji-regex.ts fix 2022-02-27 14:10:31 +09:00
extract-custom-emojis-from-mfm.ts refactor: Use ESM (#8358) 2022-02-27 11:07:39 +09:00
extract-hashtags.ts refactor: Use ESM (#8358) 2022-02-27 11:07:39 +09:00
extract-mentions.ts refactoring 2021-11-12 02:02:25 +09:00
fetch-meta.ts test: e2eテストがCIで失敗していた問題をいくつか修正 (#8642) 2022-05-14 15:16:45 +09:00
fetch-proxy-account.ts refactor: migrate to typeorm 3.0 (#8443) 2022-03-26 15:34:00 +09:00
fetch.ts refactoe 2022-04-16 17:19:30 +09:00
gen-id.ts refactor: Use ESM (#8358) 2022-02-27 11:07:39 +09:00
gen-identicon.ts refactor: Use ESM (#8358) 2022-02-27 11:07:39 +09:00
gen-key-pair.ts refactor: Use ESM (#8358) 2022-02-27 11:07:39 +09:00
get-file-info.ts update deps 2022-03-07 23:51:34 +09:00
get-note-summary.ts chore: fix lint 2022-04-03 15:33:22 +09:00
get-reaction-emoji.ts refactoring 2021-11-12 02:02:25 +09:00
hard-limits.ts refactoring 2021-11-12 02:02:25 +09:00
i18n.ts refactoring 2021-11-12 02:02:25 +09:00
identifiable-error.ts refactoring 2021-11-12 02:02:25 +09:00
is-blocker-user-related.ts refactoring 2021-11-12 02:02:25 +09:00
is-duplicate-key-value-error.ts refactor 2022-02-03 02:41:22 +09:00
is-instance-muted.ts refactor: Use ESM (#8358) 2022-02-27 11:07:39 +09:00
is-muted-user-related.ts refactoring 2021-11-12 02:02:25 +09:00
is-quote.ts refactor: Use ESM (#8358) 2022-02-27 11:07:39 +09:00
keypair-store.ts refactor: migrate to typeorm 3.0 (#8443) 2022-03-26 15:34:00 +09:00
langmap.ts fix: better language settings 2022-02-26 15:13:44 +09:00
normalize-for-search.ts refactoring 2021-11-12 02:02:25 +09:00
nyaize.ts refactoring 2021-11-12 02:02:25 +09:00
populate-emojis.ts enhance: ドライブに画像ファイルをアップロードするときオリジナル画像を破棄してwebpublicのみ保持するオプション (#8216) 2022-04-28 11:14:03 +09:00
reaction-lib.ts refactor: migrate to typeorm 3.0 (#8443) 2022-03-26 15:34:00 +09:00
safe-for-sql.ts refactoring 2021-11-12 02:02:25 +09:00
schema.ts Fix #8535 Excessive stack ... 'SchemaTypeDef<?>' (#8547) 2022-04-27 10:49:00 +09:00
secure-rndstr.ts refactor: Use ESM (#8358) 2022-02-27 11:07:39 +09:00
show-machine-info.ts refactor: Use ESM (#8358) 2022-02-27 11:07:39 +09:00
truncate.ts refactoring 2021-11-12 02:02:25 +09:00
webhook-cache.ts feat: Webhook (#8457) 2022-04-02 15:28:49 +09:00