Compare commits

...

111 Commits

Author SHA1 Message Date
naskya 2b7fb6bfca Merge branch 'refactor/push-notification' into 'develop'
refactor: port push notification sender to backend-rs


See merge request firefish/firefish!10760
2024-05-15 22:10:37 +00:00
naskya ebc5fa4cac
chore (backend-rs): fix redundant closure 2024-05-16 07:10:11 +09:00
naskya e2f31331ad
Merge branch 'develop' into refactor/push-notification 2024-05-16 06:27:03 +09:00
naskya fc375711f3
feat: use custom isahc http client 2024-05-16 06:23:17 +09:00
naskya 56be2f034e Merge branch 'renovate/syn-2.x' into 'develop'
chore(deps): update rust crate syn to 2.0.63

Co-authored-by: CI <project_7_bot_1bfaee5701aed20091a86249a967a6c1@noreply.firefish.dev>

See merge request firefish/firefish!10851
2024-05-15 21:22:39 +00:00
naskya e15bcee86c Merge branch 'renovate/aws-sdk-2.x' into 'develop'
fix(deps): update dependency aws-sdk to v2.1621.0

Co-authored-by: CI <project_7_bot_1bfaee5701aed20091a86249a967a6c1@noreply.firefish.dev>

See merge request firefish/firefish!10852
2024-05-15 21:19:48 +00:00
naskya 43326cdf8d Merge branch 'renovate/serde-monorepo' into 'develop'
chore(deps): update rust crate serde to 1.0.202

Co-authored-by: CI <project_7_bot_1bfaee5701aed20091a86249a967a6c1@noreply.firefish.dev>

See merge request firefish/firefish!10850
2024-05-15 21:16:55 +00:00
CI 7d1947792d fix(deps): update dependency aws-sdk to v2.1621.0 2024-05-15 21:05:33 +00:00
CI d28fe77d9f chore(deps): update rust crate syn to 2.0.63 2024-05-15 21:05:04 +00:00
CI acc13e9b10 chore(deps): update rust crate serde to 1.0.202 2024-05-15 21:04:59 +00:00
naskya 4e31e11f81
docs: use permalink 2024-05-16 05:04:47 +09:00
naskya dddd2779c0
chore: update auto-generated files 2024-05-16 04:57:48 +09:00
naskya 832fc7cd1d
docs: update changelog 2024-05-16 04:56:26 +09:00
naskya a18ad132be
fix: remove $[center] MFM function 2024-05-16 04:51:51 +09:00
naskya 4b96063c23
chore: format 2024-05-16 04:22:41 +09:00
naskya 0de54e02f8
chore (backend): use literals and consts 2024-05-16 04:22:23 +09:00
naskya 101e50926b
chore: remove import assertion 2024-05-16 04:12:10 +09:00
naskya 9cf88f0df6
chore: remove import assertion 2024-05-16 03:49:31 +09:00
naskya efb6cc9132 Merge branch 'renovate/execa-9.x' into 'develop'
chore(deps): update dependency execa to v9.1.0

Co-authored-by: CI <project_7_bot_1bfaee5701aed20091a86249a967a6c1@noreply.firefish.dev>

See merge request firefish/firefish!10848
2024-05-15 18:36:18 +00:00
Hosted Weblate 58f3eb4924
Merge branch 'origin/develop' into Weblate 2024-05-15 18:29:30 +00:00
Gary O'Regan Kelly 5adc0e581d
locale: update translations (French)
Currently translated at 100.0% (1932 of 1932 strings)

Translation: Firefish/locales
Translate-URL: https://hosted.weblate.org/projects/firefish/locales/fr/
2024-05-15 20:29:25 +02:00
naskya c0b760cda5 Merge branch 'develop' into 'renovate/execa-9.x'
# Conflicts:
#   package.json
2024-05-15 18:17:35 +00:00
naskya eb967564f9 Merge branch 'renovate/aws-sdk-2.x' into 'develop'
fix(deps): update dependency aws-sdk to v2.1620.0

Co-authored-by: CI <project_7_bot_1bfaee5701aed20091a86249a967a6c1@noreply.firefish.dev>

See merge request firefish/firefish!10849
2024-05-15 18:13:47 +00:00
naskya 0085105e72 Merge branch 'renovate/websocket-1.x' into 'develop'
fix(deps): update dependency websocket to v1.0.35

Co-authored-by: CI <project_7_bot_1bfaee5701aed20091a86249a967a6c1@noreply.firefish.dev>

See merge request firefish/firefish!10847
2024-05-15 18:09:16 +00:00
naskya 217b3ecf80 Merge branch 'renovate/is-svg-5.x' into 'develop'
fix(deps): update dependency is-svg to v5.0.1

Co-authored-by: CI <project_7_bot_1bfaee5701aed20091a86249a967a6c1@noreply.firefish.dev>

See merge request firefish/firefish!10846
2024-05-15 18:07:52 +00:00
naskya ffeeb3b444 Merge branch 'renovate/bull-4.x' into 'develop'
fix(deps): update dependency bull to v4.12.4

Co-authored-by: CI <project_7_bot_1bfaee5701aed20091a86249a967a6c1@noreply.firefish.dev>

See merge request firefish/firefish!10845
2024-05-15 18:06:29 +00:00
naskya 2f00947a24 Merge branch 'renovate/swc-monorepo' into 'develop'
chore(deps): update swc monorepo

Co-authored-by: CI <project_7_bot_1bfaee5701aed20091a86249a967a6c1@noreply.firefish.dev>

See merge request firefish/firefish!10844
2024-05-15 18:05:01 +00:00
naskya 5608129913 Merge branch 'renovate/syn-2.x-lockfile' into 'develop'
chore(deps): update rust crate syn to v2.0.63

Co-authored-by: CI <project_7_bot_1bfaee5701aed20091a86249a967a6c1@noreply.firefish.dev>

See merge request firefish/firefish!10843
2024-05-15 18:02:51 +00:00
naskya 8923e1f2a7 Merge branch 'renovate/serde-monorepo' into 'develop'
chore(deps): update rust crate serde to v1.0.202

Co-authored-by: CI <project_7_bot_1bfaee5701aed20091a86249a967a6c1@noreply.firefish.dev>

See merge request firefish/firefish!10842
2024-05-15 17:54:30 +00:00
naskya 8765e6ba54
ci: update renovate config 2024-05-16 02:42:59 +09:00
naskya 7c72738983 Merge branch 'renovate/pnpm-9.x' into 'develop'
chore(deps): update pnpm to v9.1.1

Co-authored-by: CI <project_7_bot_1bfaee5701aed20091a86249a967a6c1@noreply.firefish.dev>

See merge request firefish/firefish!10841
2024-05-15 17:40:54 +00:00
naskya ff446de7e8 Merge branch 'renovate/vue-tsc-2.x' into 'develop'
chore(deps): update dependency vue-tsc to v2.0.18

Co-authored-by: CI <project_7_bot_1bfaee5701aed20091a86249a967a6c1@noreply.firefish.dev>

See merge request firefish/firefish!10840
2024-05-15 17:36:25 +00:00
naskya 411d00a7af Merge branch 'renovate/vue-draggable-plus-0.x' into 'develop'
chore(deps): update dependency vue-draggable-plus to v0.4.1

Co-authored-by: CI <project_7_bot_1bfaee5701aed20091a86249a967a6c1@noreply.firefish.dev>

See merge request firefish/firefish!10839
2024-05-15 17:35:22 +00:00
CI 65a1fa870b fix(deps): update dependency aws-sdk to v2.1620.0 2024-05-15 17:29:54 +00:00
CI 1d25c78866 chore(deps): update dependency execa to v9.1.0 2024-05-15 17:29:35 +00:00
CI 6067eaef04 fix(deps): update dependency websocket to v1.0.35 2024-05-15 17:29:14 +00:00
CI 92299423a3 fix(deps): update dependency is-svg to v5.0.1 2024-05-15 17:28:54 +00:00
CI 65a8984c09 fix(deps): update dependency bull to v4.12.4 2024-05-15 17:28:34 +00:00
CI 99eb364778 chore(deps): update swc monorepo 2024-05-15 17:28:11 +00:00
CI 266c81df1e chore(deps): update rust crate syn to v2.0.63 2024-05-15 17:27:48 +00:00
CI 6a2e91efa1 chore(deps): update rust crate serde to v1.0.202 2024-05-15 17:27:42 +00:00
CI 17cbb9cd1e chore(deps): update pnpm to v9.1.1 2024-05-15 17:26:51 +00:00
CI d6ebb55556 chore(deps): update dependency vue-tsc to v2.0.18 2024-05-15 17:26:26 +00:00
CI 4dd1cff80b chore(deps): update dependency vue-draggable-plus to v0.4.1 2024-05-15 17:26:06 +00:00
naskya 752c6dc75b
ci: update renovate config 2024-05-16 02:24:06 +09:00
naskya cede0fdae2 Merge branch 'renovate/node-20.x' into 'develop'
chore(deps): update dependency @types/node to v20.12.12

Co-authored-by: CI <project_7_bot_1bfaee5701aed20091a86249a967a6c1@noreply.firefish.dev>

See merge request firefish/firefish!10837
2024-05-15 15:01:54 +00:00
naskya 35d706e45d Merge branch 'renovate/swiper-11.x' into 'develop'
chore(deps): update dependency swiper to v11.1.3

Co-authored-by: CI <project_7_bot_1bfaee5701aed20091a86249a967a6c1@noreply.firefish.dev>

See merge request firefish/firefish!10838
2024-05-15 15:01:26 +00:00
CI 9075050a67 chore(deps): update dependency swiper to v11.1.3 2024-05-15 10:05:12 +00:00
CI edc2a7d890 chore(deps): update dependency @types/node to v20.12.12 2024-05-15 10:04:53 +00:00
naskya 28e2a24585
chore (backend-rs): cleanup 2024-05-15 16:45:35 +09:00
naskya 2884b2fb42
chore (backend-rs): apply clippy fix 2024-05-15 16:36:26 +09:00
naskya d8e1ab63c0
refactor: port system information checker to backend-rs
network stat is removed because it might be inaccurate and/or
it should be monitored by other system tools, but it may be added back
later if it is wanted
2024-05-15 16:26:46 +09:00
Gary O'Regan Kelly c2d5859755
locale: update translations (French)
Currently translated at 100.0% (1932 of 1932 strings)

Translation: Firefish/locales
Translate-URL: https://hosted.weblate.org/projects/firefish/locales/fr/
2024-05-14 20:01:54 +02:00
naskya c8baadefd5
fix: add back Cargo.lock 2024-05-12 01:22:24 +09:00
naskya ff9b8a3e57
Merge branch 'develop' into refactor/push-notification 2024-05-12 01:13:52 +09:00
naskya 4fd66a132b
Merge branch 'develop' into refactor/push-notification 2024-05-11 20:44:45 +09:00
naskya 82c12eb9e2
Merge branch 'develop' into refactor/push-notification 2024-05-11 06:28:52 +09:00
naskya 1f43d5898a
Merge branch 'develop' into refactor/push-notification 2024-05-10 21:58:20 +09:00
naskya 93fc91a703
Merge branch 'develop' into refactor/push-notification 2024-05-10 02:29:26 +09:00
naskya c8efd168cf
Merge branch 'develop' into refactor/push-notification 2024-05-09 01:15:22 +09:00
naskya 4d9bec4e91
Merge branch 'develop' into refactor/push-notification 2024-05-08 08:28:33 +09:00
naskya 158bb805fc
Merge branch 'develop' into refactor/push-notification 2024-05-08 07:14:04 +09:00
naskya c3374b4914
Merge branch 'develop' into refactor/push-notification 2024-05-08 06:11:52 +09:00
naskya 7a31465b8a
Merge branch 'develop' into refactor/push-notification 2024-05-08 02:44:22 +09:00
naskya c6daa2fcf9
Merge branch 'develop' into refactor/push-notification 2024-05-07 02:16:13 +09:00
naskya e68fba0649
Merge branch 'develop' into refactor/push-notification 2024-05-06 08:30:28 +09:00
naskya af70150604
Merge branch 'develop' into refactor/push-notification 2024-05-06 03:15:59 +09:00
naskya fc1078f52c
Merge branch 'develop' into refactor/push-notification 2024-05-05 14:58:34 +09:00
naskya 66d59bd8ef
Merge branch 'develop' into refactor/push-notification 2024-05-04 13:22:34 +09:00
naskya 8dd4e5ed64
Merge branch 'develop' into refactor/push-notification 2024-05-02 22:43:30 +09:00
naskya cce45303a1
Merge branch 'develop' into refactor/push-notification 2024-05-02 19:33:59 +09:00
naskya 7449802409
Merge branch 'develop' into refactor/push-notification 2024-05-01 14:11:40 +09:00
naskya e26b75c5c8
refactor (backend-rs): remove duplicate code 2024-05-01 13:13:10 +09:00
naskya c13d6344e1
Merge branch 'develop' into refactor/push-notification 2024-04-30 06:53:29 +09:00
naskya a2ca239a00
chore: apply clippy fix 2024-04-29 11:52:49 +09:00
naskya 0189684fec
Merge branch 'develop' into refactor/push-notification 2024-04-29 10:53:42 +09:00
naskya 984896b380
Merge branch 'develop' into refactor/push-notification 2024-04-28 14:19:23 +09:00
naskya 34bf6f95d4
Merge branch 'develop' into refactor/push-notification 2024-04-27 21:32:52 +09:00
naskya 1f15d4382f
Merge branch 'develop' into refactor/push-notification 2024-04-27 18:54:22 +09:00
naskya 87c9c76117
Merge branch 'develop' into refactor/push-notification 2024-04-27 11:03:05 +09:00
naskya ff96c20893
Merge branch 'develop' into refactor/push-notification 2024-04-27 06:06:53 +09:00
naskya 56f06bae56
Merge branch 'develop' into refactor/push-notification 2024-04-26 13:59:24 +09:00
naskya a4e6964d2f
chore (backend-rs): static -> const 2024-04-26 06:34:09 +09:00
naskya d9028a786f
Merge branch 'develop' into refactor/push-notification 2024-04-26 04:06:29 +09:00
naskya c6d30f8026
Merge branch 'develop' into refactor/push-notification 2024-04-25 13:10:55 +09:00
naskya 2a34c005a3
Merge branch 'develop' into refactor/push-notification 2024-04-25 11:42:33 +09:00
naskya 62bc04fcc9
Merge branch 'develop' into refactor/push-notification 2024-04-25 11:09:00 +09:00
naskya 793007358a
Merge branch 'develop' into refactor/push-notification 2024-04-25 10:59:05 +09:00
naskya af20b6834f
chore (backend-rs): more error handlings for push notifications 2024-04-25 10:34:27 +09:00
naskya 831653ca54
chore: format 2024-04-25 10:34:04 +09:00
naskya 61fb36d041
Merge branch 'develop' into refactor/push-notification 2024-04-25 10:01:51 +09:00
naskya 320b1ecb83
Merge branch 'develop' into refactor/push-notification 2024-04-25 08:22:45 +09:00
naskya da12915448
Merge branch 'develop' into refactor/push-notification 2024-04-25 08:06:59 +09:00
naskya e71b587888
Merge branch 'develop' into refactor/push-notification 2024-04-25 02:29:22 +09:00
naskya 1e310101a3
Merge branch 'develop' into refactor/push-notification 2024-04-24 15:45:57 +09:00
naskya 854030db3b
Merge branch 'develop' into refactor/push-notification 2024-04-24 13:30:50 +09:00
naskya d8a6631f16
Merge branch 'develop' into refactor/push-notification 2024-04-24 04:22:22 +09:00
naskya bda7924672
Merge branch 'develop' into refactor/push-notification 2024-04-24 00:25:53 +09:00
naskya a14078283c
perf (backend-rs): reuse web push client 2024-04-24 00:00:11 +09:00
naskya 4b94af9944
fix (backend): fix push notification payload 2024-04-24 00:00:11 +09:00
naskya 3e96465569
feat (backend-rs): delete subscriptions on failed web push 2024-04-24 00:00:11 +09:00
naskya 01ce68ef60
fix (backend): fix push notification payload 2024-04-24 00:00:11 +09:00
naskya 5c6e0ef027
chore (backend): move stuff outside of a loop 2024-04-24 00:00:11 +09:00
naskya 4a6377f019
fix (backend): fix push notification payload 2024-04-24 00:00:11 +09:00
naskya fc2864b3a2
fix (backend-rs): set longer ttl for push notifications 2024-04-24 00:00:10 +09:00
naskya 3f399bc067
fix (backend-rs): convert base64 encoded keys into base64url 2024-04-24 00:00:10 +09:00
naskya 6442364341
fix (backend-rs): don't stop iteration on error 2024-04-24 00:00:10 +09:00
naskya 91901281cb
refactor (backend): replace pushNotification with the Rusty one 2024-04-24 00:00:10 +09:00
naskya f428fc7d9d
chore (backend-rs): push_notification -> send_push_notification 2024-04-24 00:00:10 +09:00
naskya b9e84113e2
chore (backend-rs): consider SendReadMessage setting in push notifications 2024-04-24 00:00:10 +09:00
naskya b66edf97b4
feat (backend-rs): implement push notifications 2024-04-24 00:00:09 +09:00
55 changed files with 1423 additions and 1020 deletions

575
Cargo.lock generated
View File

@ -103,7 +103,7 @@ checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.62",
"syn 2.0.63",
]
[[package]]
@ -154,7 +154,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.62",
"syn 2.0.63",
]
[[package]]
@ -165,7 +165,7 @@ checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.62",
"syn 2.0.63",
]
[[package]]
@ -236,12 +236,14 @@ dependencies = [
"serde_json",
"serde_yaml",
"strum 0.26.2",
"sysinfo",
"thiserror",
"tokio",
"tracing",
"tracing-subscriber",
"url",
"urlencoding",
"web-push",
]
[[package]]
@ -259,6 +261,18 @@ dependencies = [
"rustc-demangle",
]
[[package]]
name = "base16ct"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf"
[[package]]
name = "base64"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
[[package]]
name = "base64"
version = "0.21.7"
@ -307,6 +321,12 @@ dependencies = [
"num-traits",
]
[[package]]
name = "binstring"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e0d60973d9320722cb1206f412740e162a33b8547ea8d6be75d7cff237c7a85"
[[package]]
name = "bit_field"
version = "0.10.2"
@ -394,7 +414,7 @@ dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
"syn 2.0.62",
"syn 2.0.63",
"syn_derive",
]
@ -520,6 +540,17 @@ dependencies = [
"inout",
]
[[package]]
name = "coarsetime"
version = "0.1.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13b3839cf01bb7960114be3ccf2340f541b6d0c81f8690b007b2b39f750f7e5d"
dependencies = [
"libc",
"wasix",
"wasm-bindgen",
]
[[package]]
name = "color_quant"
version = "1.1.0"
@ -545,6 +576,12 @@ dependencies = [
"crossbeam-utils",
]
[[package]]
name = "const-oid"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d6f2aa4d0537bcc1c74df8755072bd31c1ef1a3a1b85a68e8404a8c353b7b8b"
[[package]]
name = "const-oid"
version = "0.9.6"
@ -639,6 +676,18 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
[[package]]
name = "crypto-bigint"
version = "0.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76"
dependencies = [
"generic-array",
"rand_core",
"subtle",
"zeroize",
]
[[package]]
name = "crypto-common"
version = "0.1.6"
@ -649,6 +698,12 @@ dependencies = [
"typenum",
]
[[package]]
name = "ct-codecs"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3b7eb4404b8195a9abb6356f4ac07d8ba267045c8d6d220ac4dc992e6cc75df"
[[package]]
name = "ctor"
version = "0.2.8"
@ -656,7 +711,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "edb49164822f3ee45b17acd4a208cfc1251410cf0cad9a833234c9890774dd9f"
dependencies = [
"quote",
"syn 2.0.62",
"syn 2.0.63",
]
[[package]]
@ -708,17 +763,50 @@ dependencies = [
"windows-sys 0.52.0",
]
[[package]]
name = "der"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79b71cca7d95d7681a4b3b9cdf63c8dbc3730d0584c2c74e31416d64a90493f4"
dependencies = [
"const-oid 0.6.2",
"der_derive",
]
[[package]]
name = "der"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de"
dependencies = [
"const-oid 0.9.6",
"pem-rfc7468 0.6.0",
"zeroize",
]
[[package]]
name = "der"
version = "0.7.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0"
dependencies = [
"const-oid",
"pem-rfc7468",
"const-oid 0.9.6",
"pem-rfc7468 0.7.0",
"zeroize",
]
[[package]]
name = "der_derive"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8aed3b3c608dc56cf36c45fe979d04eda51242e6703d8d0bb03426ef7c41db6a"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
"synstructure",
]
[[package]]
name = "deranged"
version = "0.3.11"
@ -753,7 +841,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
dependencies = [
"block-buffer",
"const-oid",
"const-oid 0.9.6",
"crypto-common",
"subtle",
]
@ -764,6 +852,48 @@ version = "0.15.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b"
[[package]]
name = "ecdsa"
version = "0.16.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca"
dependencies = [
"der 0.7.9",
"digest",
"elliptic-curve",
"rfc6979",
"signature 2.2.0",
"spki 0.7.3",
]
[[package]]
name = "ece"
version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2ea1d2f2cc974957a4e2575d8e5bb494549bab66338d6320c2789abcfff5746"
dependencies = [
"base64 0.21.7",
"byteorder",
"hex",
"hkdf",
"lazy_static",
"once_cell",
"openssl",
"serde",
"sha2",
"thiserror",
]
[[package]]
name = "ed25519-compact"
version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e9b3460f44bea8cd47f45a0c70892f1eff856d97cd55358b2f73f663789f6190"
dependencies = [
"ct-codecs",
"getrandom",
]
[[package]]
name = "either"
version = "1.11.0"
@ -773,6 +903,27 @@ dependencies = [
"serde",
]
[[package]]
name = "elliptic-curve"
version = "0.13.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47"
dependencies = [
"base16ct",
"crypto-bigint",
"digest",
"ff",
"generic-array",
"group",
"hkdf",
"pem-rfc7468 0.7.0",
"pkcs8 0.10.2",
"rand_core",
"sec1",
"subtle",
"zeroize",
]
[[package]]
name = "emojis"
version = "0.6.2"
@ -864,6 +1015,16 @@ dependencies = [
"simd-adler32",
]
[[package]]
name = "ff"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449"
dependencies = [
"rand_core",
"subtle",
]
[[package]]
name = "finl_unicode"
version = "1.2.0"
@ -1037,6 +1198,7 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
dependencies = [
"typenum",
"version_check",
"zeroize",
]
[[package]]
@ -1046,8 +1208,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
dependencies = [
"cfg-if",
"js-sys",
"libc",
"wasi",
"wasm-bindgen",
]
[[package]]
@ -1066,6 +1230,17 @@ version = "0.28.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253"
[[package]]
name = "group"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63"
dependencies = [
"ff",
"rand_core",
"subtle",
]
[[package]]
name = "half"
version = "2.4.1"
@ -1149,6 +1324,30 @@ dependencies = [
"digest",
]
[[package]]
name = "hmac-sha1-compact"
version = "1.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dff9d405ec732fa3fcde87264e54a32a84956a377b3e3107de96e59b798c84a7"
[[package]]
name = "hmac-sha256"
version = "1.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3688e69b38018fec1557254f64c8dc2cc8ec502890182f395dbb0aa997aa5735"
dependencies = [
"digest",
]
[[package]]
name = "hmac-sha512"
version = "1.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4ce1f4656bae589a3fab938f9f09bf58645b7ed01a2c5f8a3c238e01a4ef78a"
dependencies = [
"digest",
]
[[package]]
name = "home"
version = "0.5.9"
@ -1259,7 +1458,7 @@ checksum = "0122b7114117e64a63ac49f752a5ca4624d534c7b1c7de796ac196381cd2d947"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.62",
"syn 2.0.63",
]
[[package]]
@ -1288,7 +1487,7 @@ checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.62",
"syn 2.0.63",
]
[[package]]
@ -1357,6 +1556,46 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "jwt-simple"
version = "0.11.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "357892bb32159d763abdea50733fadcb9a8e1c319a9aa77592db8555d05af83e"
dependencies = [
"anyhow",
"binstring",
"coarsetime",
"ct-codecs",
"ed25519-compact",
"hmac-sha1-compact",
"hmac-sha256",
"hmac-sha512",
"k256",
"p256",
"p384",
"rand",
"rsa 0.7.2",
"serde",
"serde_json",
"spki 0.6.0",
"thiserror",
"zeroize",
]
[[package]]
name = "k256"
version = "0.13.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b"
dependencies = [
"cfg-if",
"ecdsa",
"elliptic-curve",
"once_cell",
"sha2",
"signature 2.2.0",
]
[[package]]
name = "keccak"
version = "0.1.5"
@ -1486,7 +1725,7 @@ dependencies = [
"napi",
"proc-macro2",
"quote",
"syn 2.0.62",
"syn 2.0.63",
"thiserror",
]
@ -1583,7 +1822,7 @@ dependencies = [
"napi-derive-backend",
"proc-macro2",
"quote",
"syn 2.0.62",
"syn 2.0.63",
]
[[package]]
@ -1598,7 +1837,7 @@ dependencies = [
"quote",
"regex",
"semver",
"syn 2.0.62",
"syn 2.0.63",
]
[[package]]
@ -1644,6 +1883,15 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8"
[[package]]
name = "ntapi"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8a3895c6391c39d7fe7ebc444a87eb2991b2a0bc718fdabd071eec617fc68e4"
dependencies = [
"winapi",
]
[[package]]
name = "nu-ansi-term"
version = "0.46.0"
@ -1718,7 +1966,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.62",
"syn 2.0.63",
]
[[package]]
@ -1810,7 +2058,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.62",
"syn 2.0.63",
]
[[package]]
@ -1871,7 +2119,7 @@ dependencies = [
"proc-macro-error",
"proc-macro2",
"quote",
"syn 2.0.62",
"syn 2.0.63",
]
[[package]]
@ -1880,6 +2128,30 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
[[package]]
name = "p256"
version = "0.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b"
dependencies = [
"ecdsa",
"elliptic-curve",
"primeorder",
"sha2",
]
[[package]]
name = "p384"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70786f51bcc69f6a4c0360e063a4cac5419ef7c5cd5b3c99ad70f3be5ba79209"
dependencies = [
"ecdsa",
"elliptic-curve",
"primeorder",
"sha2",
]
[[package]]
name = "parking"
version = "2.2.0"
@ -1926,6 +2198,35 @@ version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
[[package]]
name = "pem"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd56cbd21fea48d0c440b41cd69c589faacade08c992d9a54e471b79d0fd13eb"
dependencies = [
"base64 0.13.1",
"once_cell",
"regex",
]
[[package]]
name = "pem"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8835c273a76a90455d7344889b0964598e3316e2a79ede8e36f16bdcf2228b8"
dependencies = [
"base64 0.13.1",
]
[[package]]
name = "pem-rfc7468"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24d159833a9105500e0398934e205e0773f0b27529557134ecfc51c27646adac"
dependencies = [
"base64ct",
]
[[package]]
name = "pem-rfc7468"
version = "0.7.0"
@ -1976,7 +2277,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.62",
"syn 2.0.63",
]
[[package]]
@ -1991,15 +2292,37 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "pkcs1"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eff33bdbdfc54cc98a2eca766ebdec3e1b8fb7387523d5c9c9a2891da856f719"
dependencies = [
"der 0.6.1",
"pkcs8 0.9.0",
"spki 0.6.0",
"zeroize",
]
[[package]]
name = "pkcs1"
version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f"
dependencies = [
"der",
"pkcs8",
"spki",
"der 0.7.9",
"pkcs8 0.10.2",
"spki 0.7.3",
]
[[package]]
name = "pkcs8"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba"
dependencies = [
"der 0.6.1",
"spki 0.6.0",
]
[[package]]
@ -2008,8 +2331,8 @@ version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7"
dependencies = [
"der",
"spki",
"der 0.7.9",
"spki 0.7.3",
]
[[package]]
@ -2069,6 +2392,15 @@ dependencies = [
"yansi",
]
[[package]]
name = "primeorder"
version = "0.13.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6"
dependencies = [
"elliptic-curve",
]
[[package]]
name = "proc-macro-crate"
version = "3.1.0"
@ -2127,7 +2459,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8021cf59c8ec9c432cfc2526ac6b8aa508ecaf29cd415f271b8406c1b851c3fd"
dependencies = [
"quote",
"syn 2.0.62",
"syn 2.0.63",
]
[[package]]
@ -2351,6 +2683,16 @@ dependencies = [
"bytecheck",
]
[[package]]
name = "rfc6979"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2"
dependencies = [
"hmac",
"subtle",
]
[[package]]
name = "rgb"
version = "0.8.37"
@ -2426,22 +2768,43 @@ dependencies = [
"serde",
]
[[package]]
name = "rsa"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "094052d5470cbcef561cb848a7209968c9f12dfa6d668f4bca048ac5de51099c"
dependencies = [
"byteorder",
"digest",
"num-bigint-dig",
"num-integer",
"num-iter",
"num-traits",
"pkcs1 0.4.1",
"pkcs8 0.9.0",
"rand_core",
"signature 1.6.4",
"smallvec",
"subtle",
"zeroize",
]
[[package]]
name = "rsa"
version = "0.9.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d0e5124fcb30e76a7e79bfee683a2746db83784b86289f6251b54b7950a0dfc"
dependencies = [
"const-oid",
"const-oid 0.9.6",
"digest",
"num-bigint-dig",
"num-integer",
"num-traits",
"pkcs1",
"pkcs8",
"pkcs1 0.7.5",
"pkcs8 0.10.2",
"rand_core",
"signature",
"spki",
"signature 2.2.0",
"spki 0.7.3",
"subtle",
"zeroize",
]
@ -2558,7 +2921,7 @@ dependencies = [
"proc-macro-error",
"proc-macro2",
"quote",
"syn 2.0.62",
"syn 2.0.63",
]
[[package]]
@ -2599,7 +2962,7 @@ dependencies = [
"proc-macro2",
"quote",
"sea-bae",
"syn 2.0.62",
"syn 2.0.63",
"unicode-ident",
]
@ -2642,6 +3005,31 @@ version = "4.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b"
[[package]]
name = "sec1"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc"
dependencies = [
"base16ct",
"der 0.7.9",
"generic-array",
"pkcs8 0.10.2",
"subtle",
"zeroize",
]
[[package]]
name = "sec1_decode"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6326ddc956378a0739200b2c30892dccaf198992dfd7323274690b9e188af23"
dependencies = [
"der 0.4.5",
"pem 0.8.3",
"thiserror",
]
[[package]]
name = "semver"
version = "1.0.23"
@ -2650,22 +3038,22 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b"
[[package]]
name = "serde"
version = "1.0.201"
version = "1.0.202"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "780f1cebed1629e4753a1a38a3c72d30b97ec044f0aef68cb26650a3c5cf363c"
checksum = "226b61a0d411b2ba5ff6d7f73a476ac4f8bb900373459cd00fab8512828ba395"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.201"
version = "1.0.202"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c5e405930b9796f1c00bee880d03fc7e0bb4b9a11afc776885ffe84320da2865"
checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.62",
"syn 2.0.63",
]
[[package]]
@ -2757,6 +3145,16 @@ dependencies = [
"libc",
]
[[package]]
name = "signature"
version = "1.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c"
dependencies = [
"digest",
"rand_core",
]
[[package]]
name = "signature"
version = "2.2.0"
@ -2845,6 +3243,16 @@ dependencies = [
"lock_api",
]
[[package]]
name = "spki"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b"
dependencies = [
"base64ct",
"der 0.6.1",
]
[[package]]
name = "spki"
version = "0.7.3"
@ -2852,7 +3260,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d"
dependencies = [
"base64ct",
"der",
"der 0.7.9",
]
[[package]]
@ -2997,7 +3405,7 @@ dependencies = [
"once_cell",
"percent-encoding",
"rand",
"rsa",
"rsa 0.9.6",
"rust_decimal",
"serde",
"sha1",
@ -3124,7 +3532,7 @@ dependencies = [
"proc-macro2",
"quote",
"rustversion",
"syn 2.0.62",
"syn 2.0.63",
]
[[package]]
@ -3146,9 +3554,9 @@ dependencies = [
[[package]]
name = "syn"
version = "2.0.62"
version = "2.0.63"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f660c3bfcefb88c538776b6685a0c472e3128b51e74d48793dc2a488196e8eb"
checksum = "bf5be731623ca1a1fb7d8be6f261a3be6d3e2337b8a1f97be944d020c8fcb704"
dependencies = [
"proc-macro2",
"quote",
@ -3164,7 +3572,34 @@ dependencies = [
"proc-macro-error",
"proc-macro2",
"quote",
"syn 2.0.62",
"syn 2.0.63",
]
[[package]]
name = "synstructure"
version = "0.12.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
"unicode-xid",
]
[[package]]
name = "sysinfo"
version = "0.30.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "732ffa00f53e6b2af46208fba5718d9662a421049204e156328b66791ffa15ae"
dependencies = [
"cfg-if",
"core-foundation-sys",
"libc",
"ntapi",
"once_cell",
"rayon",
"windows",
]
[[package]]
@ -3221,7 +3656,7 @@ checksum = "e2470041c06ec3ac1ab38d0356a6119054dedaea53e12fbefc0de730a1c08524"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.62",
"syn 2.0.63",
]
[[package]]
@ -3318,7 +3753,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.62",
"syn 2.0.63",
]
[[package]]
@ -3397,7 +3832,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.62",
"syn 2.0.63",
]
[[package]]
@ -3478,6 +3913,12 @@ version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202"
[[package]]
name = "unicode-xid"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
[[package]]
name = "unicode_categories"
version = "0.1.1"
@ -3575,6 +4016,15 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b"
[[package]]
name = "wasix"
version = "0.12.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1fbb4ef9bbca0c1170e0b00dd28abc9e3b68669821600cad1caaed606583c6d"
dependencies = [
"wasi",
]
[[package]]
name = "wasm-bindgen"
version = "0.2.92"
@ -3596,7 +4046,7 @@ dependencies = [
"once_cell",
"proc-macro2",
"quote",
"syn 2.0.62",
"syn 2.0.63",
"wasm-bindgen-shared",
]
@ -3618,7 +4068,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.62",
"syn 2.0.63",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
@ -3629,6 +4079,27 @@ version = "0.2.92"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96"
[[package]]
name = "web-push"
version = "0.10.1"
source = "git+https://github.com/pimeys/rust-web-push?rev=40febe4085e3cef9cdfd539c315e3e945aba0656#40febe4085e3cef9cdfd539c315e3e945aba0656"
dependencies = [
"async-trait",
"base64 0.13.1",
"chrono",
"ece",
"futures-lite",
"http",
"isahc",
"jwt-simple",
"log",
"pem 1.1.1",
"sec1_decode",
"serde",
"serde_derive",
"serde_json",
]
[[package]]
name = "webpki-roots"
version = "0.25.4"
@ -3673,6 +4144,16 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be"
dependencies = [
"windows-core",
"windows-targets 0.52.5",
]
[[package]]
name = "windows-core"
version = "0.52.0"
@ -3871,7 +4352,7 @@ checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.62",
"syn 2.0.63",
]
[[package]]

View File

@ -30,17 +30,19 @@ redis = "0.25.3"
regex = "1.10.4"
rmp-serde = "1.3.0"
sea-orm = "0.12.15"
serde = "1.0.201"
serde = "1.0.202"
serde_json = "1.0.117"
serde_yaml = "0.9.34"
strum = "0.26.2"
syn = "2.0.62"
syn = "2.0.63"
sysinfo = "0.30.12"
thiserror = "1.0.60"
tokio = "1.37.0"
tracing = "0.1.40"
tracing-subscriber = "0.3.18"
url = "2.5.0"
urlencoding = "2.1.3"
web-push = { git = "https://github.com/pimeys/rust-web-push", rev = "40febe4085e3cef9cdfd539c315e3e945aba0656" }
[profile.release]
lto = true

View File

@ -4,6 +4,8 @@ Breaking changes are indicated by the :warning: icon.
## Unreleased
- :warning: `server-info` (an endpoint to get server hardware information) now requires credentials.
- :warning: `net` (server's default network interface) has been removed from `admin/server-info`.
- Adding `lang` to the response of `i` and the request parameter of `i/update`.
## v20240504

View File

@ -7,7 +7,9 @@ Critical security updates are indicated by the :warning: icon.
## Unreleased
- Improve timeline UX
- Improve timeline UX (you can restore the original appearance by settings)
- Remove `$[center]` MFM function
- This function was suddenly added last year (https://firefish.dev/firefish/firefish/-/commit/1a971efa689323d54eebb4d3646e102fb4d1d95a), but according to the [MFM spec](https://github.com/misskey-dev/mfm.js/blob/6aaf68089023c6adebe44123eebbc4dcd75955e0/docs/syntax.md#fn), `$[something]` must be an inline element (while `center` is a block element), so such a syntax is not expected by MFM renderers. Please use `<center></center>` instead.
- Fix bugs
## [v20240504](https://firefish.dev/firefish/firefish/-/merge_requests/10790/commits)

View File

@ -2,6 +2,10 @@
You can skip intermediate versions when upgrading from an old version, but please read the notices and follow the instructions for each intermediate version before [upgrading](./upgrade.md).
## Unreleased
Firefish is now compatible with [Node v22](https://nodejs.org/en/blog/announcements/v22-release-announce).
## v20240430
### For all users

View File

@ -1142,8 +1142,8 @@ _wordMute:
mutedNotes: "Publications masquées"
muteLangsDescription2: Utiliser les codes de langue (i.e en, fr, ja, zh).
lang: Langue
langDescription: Cacher du fil de publication les publications qui correspondent
à ces langues.
langDescription: Cachez les publications qui correspondent à la langue définie dans
le fil d'actualité.
muteLangs: Langues filtrées
muteLangsDescription: Séparer avec des espaces ou des retours à la ligne pour une
condition OU (OR).
@ -1260,7 +1260,7 @@ _tutorial:
step2_2: "En fournissant quelques informations sur qui vous êtes, il sera plus facile
pour les autres de savoir s'ils veulent voir vos publcations ou s'abonner à vous."
step3_1: "Maintenant il est temps de vous abonner à des gens!"
step3_2: "Vos fils d'actualités Principal et Social sont basés sur les personnes
step3_2: "Vos fils d'actualité Principal et Social sont basés sur les personnes
que vous êtes abonné, alors essayez de vous abonner à quelques comptes pour commencer.\n
Cliquez sur le cercle « plus » en haut à droite d'un profil pour vous abonner."
step4_1: "On y va."
@ -2332,3 +2332,9 @@ inputAccountId: Veuillez saisir votre compte (par exemple, @firefish@info.firefi
remoteFollow: Abonnement à distance
copyRemoteFollowUrl: Copier l'URL d'abonnement à distance
slashQuote: Citation enchaînée
i18nServerInfo: Les nouveaux clients seront en {language} par défaut.
i18nServerChange: Utilisez {language} à la place.
i18nServerSet: Utilisez {language} pour les nouveaux clients.
mergeThreadInTimeline: Fusionner plusieurs publications dans le même fil dans les
fils d'actualité
mergeRenotesInTimeline: Regrouper plusieurs boosts du même publication

View File

@ -5,7 +5,7 @@
"type": "git",
"url": "https://firefish.dev/firefish/firefish.git"
},
"packageManager": "pnpm@9.1.0",
"packageManager": "pnpm@9.1.1",
"private": true,
"scripts": {
"rebuild": "pnpm run clean && pnpm run build",
@ -46,9 +46,9 @@
"@biomejs/cli-darwin-x64": "1.7.3",
"@biomejs/cli-linux-arm64": "1.7.3",
"@biomejs/cli-linux-x64": "1.7.3",
"@types/node": "20.12.11",
"execa": "9.0.2",
"pnpm": "9.1.0",
"@types/node": "20.12.12",
"execa": "9.1.0",
"pnpm": "9.1.1",
"typescript": "5.4.5"
}
}

View File

@ -39,12 +39,14 @@ serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
serde_yaml = { workspace = true }
strum = { workspace = true, features = ["derive"] }
sysinfo = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true, features = ["full"] }
tracing = { workspace = true }
tracing-subscriber = { workspace = true }
url = { workspace = true }
urlencoding = { workspace = true }
web-push = { workspace = true }
[dev-dependencies]
pretty_assertions = { workspace = true }

View File

@ -41,7 +41,6 @@ export interface ServerConfig {
proxySmtp?: string
proxyBypassHosts?: Array<string>
allowedPrivateNetworks?: Array<string>
/** `NapiValue` is not implemented for `u64` */
maxFileSize?: number
accessLog?: string
clusterLimits?: WorkerConfigInternal
@ -212,6 +211,8 @@ export interface Acct {
}
export function stringToAcct(acct: string): Acct
export function acctToString(acct: Acct): string
export function showServerInfo(): void
export function initializeRustLogger(): void
export function addNoteToAntenna(antennaId: string, note: Note): void
/**
* Checks if a server is blocked.
@ -235,7 +236,6 @@ export function isSilencedServer(host: string): Promise<boolean>
* `host` - punycoded instance host
*/
export function isAllowedServer(host: string): Promise<boolean>
/** TODO: handle name collisions better */
export interface NoteLikeForCheckWordMute {
fileIds: Array<string>
userId: string | null
@ -260,7 +260,6 @@ export interface ImageSize {
height: number
}
export function getImageSizeFromUrl(url: string): Promise<ImageSize>
/** TODO: handle name collisions better */
export interface NoteLikeForGetNoteSummary {
fileIds: Array<string>
text: string | null
@ -268,6 +267,28 @@ export interface NoteLikeForGetNoteSummary {
hasPoll: boolean
}
export function getNoteSummary(note: NoteLikeForGetNoteSummary): string
export interface Cpu {
model: string
cores: number
}
export interface Memory {
/** Total memory amount in bytes */
total: number
/** Used memory amount in bytes */
used: number
/** Available (for (re)use) memory amount in bytes */
available: number
}
export interface Storage {
/** Total storage space in bytes */
total: number
/** Used storage space in bytes */
used: number
}
export function cpuInfo(): Cpu
export function cpuUsage(): number
export function memoryUsage(): Memory
export function storageUsage(): Storage | null
export function isSafeUrl(url: string): boolean
export function latestVersion(): Promise<string>
export function toMastodonId(firefishId: string): string | null
@ -1156,7 +1177,6 @@ export interface Webhook {
latestSentAt: Date | null
latestStatus: number | null
}
export function initializeRustLogger(): void
export function fetchNodeinfo(host: string): Promise<Nodeinfo>
export function nodeinfo_2_1(): Promise<any>
export function nodeinfo_2_0(): Promise<any>
@ -1259,6 +1279,15 @@ export interface Users {
}
export function watchNote(watcherId: string, noteAuthorId: string, noteId: string): Promise<void>
export function unwatchNote(watcherId: string, noteId: string): Promise<void>
export enum PushNotificationKind {
Generic = 'generic',
Chat = 'chat',
ReadAllChats = 'readAllChats',
ReadAllChatsInTheRoom = 'readAllChatsInTheRoom',
ReadNotifications = 'readNotifications',
ReadAllNotifications = 'readAllNotifications'
}
export function sendPushNotification(receiverUserId: string, kind: PushNotificationKind, content: any): Promise<void>
export function publishToChannelStream(channelId: string, userId: string): void
export enum ChatEvent {
Message = 'message',

View File

@ -310,7 +310,7 @@ if (!nativeBinding) {
throw new Error(`Failed to load native binding`)
}
const { SECOND, MINUTE, HOUR, DAY, USER_ONLINE_THRESHOLD, USER_ACTIVE_THRESHOLD, FILE_TYPE_BROWSERSAFE, loadEnv, loadConfig, stringToAcct, acctToString, addNoteToAntenna, isBlockedServer, isSilencedServer, isAllowedServer, checkWordMute, getFullApAccount, isSelfHost, isSameOrigin, extractHost, toPuny, isUnicodeEmoji, sqlLikeEscape, safeForSql, formatMilliseconds, getImageSizeFromUrl, getNoteSummary, isSafeUrl, latestVersion, toMastodonId, fromMastodonId, fetchMeta, metaToPugArgs, nyaify, hashPassword, verifyPassword, isOldPasswordAlgorithm, decodeReaction, countReactions, toDbReaction, removeOldAttestationChallenges, AntennaSrcEnum, DriveFileUsageHintEnum, MutedNoteReasonEnum, NoteVisibilityEnum, NotificationTypeEnum, PageVisibilityEnum, PollNotevisibilityEnum, RelayStatusEnum, UserEmojimodpermEnum, UserProfileFfvisibilityEnum, UserProfileMutingnotificationtypesEnum, initializeRustLogger, fetchNodeinfo, nodeinfo_2_1, nodeinfo_2_0, Protocol, Inbound, Outbound, watchNote, unwatchNote, publishToChannelStream, ChatEvent, publishToChatStream, ChatIndexEvent, publishToChatIndexStream, publishToBroadcastStream, publishToGroupChatStream, publishToModerationStream, getTimestamp, genId, genIdAt, generateSecureRandomString, generateUserToken } = nativeBinding
const { SECOND, MINUTE, HOUR, DAY, USER_ONLINE_THRESHOLD, USER_ACTIVE_THRESHOLD, FILE_TYPE_BROWSERSAFE, loadEnv, loadConfig, stringToAcct, acctToString, showServerInfo, initializeRustLogger, addNoteToAntenna, isBlockedServer, isSilencedServer, isAllowedServer, checkWordMute, getFullApAccount, isSelfHost, isSameOrigin, extractHost, toPuny, isUnicodeEmoji, sqlLikeEscape, safeForSql, formatMilliseconds, getImageSizeFromUrl, getNoteSummary, cpuInfo, cpuUsage, memoryUsage, storageUsage, isSafeUrl, latestVersion, toMastodonId, fromMastodonId, fetchMeta, metaToPugArgs, nyaify, hashPassword, verifyPassword, isOldPasswordAlgorithm, decodeReaction, countReactions, toDbReaction, removeOldAttestationChallenges, AntennaSrcEnum, DriveFileUsageHintEnum, MutedNoteReasonEnum, NoteVisibilityEnum, NotificationTypeEnum, PageVisibilityEnum, PollNotevisibilityEnum, RelayStatusEnum, UserEmojimodpermEnum, UserProfileFfvisibilityEnum, UserProfileMutingnotificationtypesEnum, fetchNodeinfo, nodeinfo_2_1, nodeinfo_2_0, Protocol, Inbound, Outbound, watchNote, unwatchNote, PushNotificationKind, sendPushNotification, publishToChannelStream, ChatEvent, publishToChatStream, ChatIndexEvent, publishToChatIndexStream, publishToBroadcastStream, publishToGroupChatStream, publishToModerationStream, getTimestamp, genId, genIdAt, generateSecureRandomString, generateUserToken } = nativeBinding
module.exports.SECOND = SECOND
module.exports.MINUTE = MINUTE
@ -323,6 +323,8 @@ module.exports.loadEnv = loadEnv
module.exports.loadConfig = loadConfig
module.exports.stringToAcct = stringToAcct
module.exports.acctToString = acctToString
module.exports.showServerInfo = showServerInfo
module.exports.initializeRustLogger = initializeRustLogger
module.exports.addNoteToAntenna = addNoteToAntenna
module.exports.isBlockedServer = isBlockedServer
module.exports.isSilencedServer = isSilencedServer
@ -339,6 +341,10 @@ module.exports.safeForSql = safeForSql
module.exports.formatMilliseconds = formatMilliseconds
module.exports.getImageSizeFromUrl = getImageSizeFromUrl
module.exports.getNoteSummary = getNoteSummary
module.exports.cpuInfo = cpuInfo
module.exports.cpuUsage = cpuUsage
module.exports.memoryUsage = memoryUsage
module.exports.storageUsage = storageUsage
module.exports.isSafeUrl = isSafeUrl
module.exports.latestVersion = latestVersion
module.exports.toMastodonId = toMastodonId
@ -364,7 +370,6 @@ module.exports.RelayStatusEnum = RelayStatusEnum
module.exports.UserEmojimodpermEnum = UserEmojimodpermEnum
module.exports.UserProfileFfvisibilityEnum = UserProfileFfvisibilityEnum
module.exports.UserProfileMutingnotificationtypesEnum = UserProfileMutingnotificationtypesEnum
module.exports.initializeRustLogger = initializeRustLogger
module.exports.fetchNodeinfo = fetchNodeinfo
module.exports.nodeinfo_2_1 = nodeinfo_2_1
module.exports.nodeinfo_2_0 = nodeinfo_2_0
@ -373,6 +378,8 @@ module.exports.Inbound = Inbound
module.exports.Outbound = Outbound
module.exports.watchNote = watchNote
module.exports.unwatchNote = unwatchNote
module.exports.PushNotificationKind = PushNotificationKind
module.exports.sendPushNotification = sendPushNotification
module.exports.publishToChannelStream = publishToChannelStream
module.exports.ChatEvent = ChatEvent
module.exports.publishToChatStream = publishToChatStream

View File

@ -22,7 +22,7 @@ struct ServerConfig {
pub proxy_bypass_hosts: Option<Vec<String>>,
pub allowed_private_networks: Option<Vec<String>>,
/// `NapiValue` is not implemented for `u64`
// TODO: i64 -> u64 (NapiValue is not implemented for u64)
pub max_file_size: Option<i64>,
pub access_log: Option<String>,
pub cluster_limits: Option<WorkerConfigInternal>,
@ -298,7 +298,7 @@ fn read_manifest() -> Manifest {
}
#[crate::export]
fn load_config() -> Config {
pub fn load_config() -> Config {
let server_config = read_config_file();
let version = read_meta().version;
let manifest = read_manifest();

View File

@ -1,8 +1,9 @@
use crate::config::CONFIG;
use once_cell::sync::OnceCell;
use sea_orm::{ConnectOptions, Database, DbConn, DbErr};
use tracing::log::LevelFilter;
static DB_CONN: once_cell::sync::OnceCell<DbConn> = once_cell::sync::OnceCell::new();
static DB_CONN: OnceCell<DbConn> = OnceCell::new();
async fn init_database() -> Result<&'static DbConn, DbErr> {
let database_uri = format!(

View File

@ -1,7 +1,8 @@
use crate::config::CONFIG;
use once_cell::sync::OnceCell;
use redis::{Client, Connection, RedisError};
static REDIS_CLIENT: once_cell::sync::OnceCell<Client> = once_cell::sync::OnceCell::new();
static REDIS_CLIENT: OnceCell<Client> = OnceCell::new();
fn init_redis() -> Result<Client, RedisError> {
let redis_url = {
@ -26,7 +27,7 @@ fn init_redis() -> Result<Client, RedisError> {
params.concat()
};
tracing::info!("Initializing Redis connection");
tracing::info!("Initializing Redis client");
Client::open(redis_url)
}
@ -38,8 +39,8 @@ pub fn redis_conn() -> Result<Connection, RedisError> {
}
}
#[inline]
/// prefix redis key
#[inline]
pub fn key(key: impl ToString) -> String {
format!("{}:{}", CONFIG.redis_key_prefix, key.to_string())
}

View File

@ -0,0 +1,39 @@
use std::sync::{Mutex, MutexGuard, OnceLock, PoisonError};
use sysinfo::System;
pub type SystemMutexError = PoisonError<MutexGuard<'static, System>>;
// TODO: handle this in a more proper way when we move the entry point to backend-rs
pub fn system() -> Result<MutexGuard<'static, System>, SystemMutexError> {
pub static SYSTEM: OnceLock<Mutex<System>> = OnceLock::new();
SYSTEM.get_or_init(|| Mutex::new(System::new_all())).lock()
}
#[crate::export]
pub fn show_server_info() -> Result<(), SystemMutexError> {
let system_info = system()?;
tracing::info!(
"Hostname: {}",
System::host_name().unwrap_or("unknown".to_string())
);
tracing::info!(
"OS: {}",
System::long_os_version().unwrap_or("unknown".to_string())
);
tracing::info!(
"Kernel: {}",
System::kernel_version().unwrap_or("unknown".to_string())
);
tracing::info!(
"CPU architecture: {}",
System::cpu_arch().unwrap_or("unknown".to_string())
);
tracing::info!("CPU threads: {}", system_info.cpus().len());
tracing::info!("Total memory: {} MiB", system_info.total_memory() / 1048576);
tracing::info!("Free memory: {} MiB", system_info.free_memory() / 1048576);
tracing::info!("Total swap: {} MiB", system_info.total_swap() / 1048576);
tracing::info!("Free swap: {} MiB", system_info.free_swap() / 1048576);
Ok(())
}

View File

@ -0,0 +1,2 @@
pub mod hardware_stats;
pub mod log;

View File

@ -3,6 +3,7 @@ pub use macro_rs::{export, ts_only_warn};
pub mod config;
pub mod database;
pub mod federation;
pub mod init;
pub mod misc;
pub mod model;
pub mod service;

View File

@ -4,7 +4,7 @@ use once_cell::sync::Lazy;
use regex::Regex;
use sea_orm::{prelude::*, QuerySelect};
/// TODO: handle name collisions better
// TODO: handle name collisions in a better way
#[crate::export(object, js_name = "NoteLikeForCheckWordMute")]
pub struct NoteLike {
pub file_ids: Vec<String>,

View File

@ -1,4 +1,7 @@
/// TODO: handle name collisions better
use serde::{Deserialize, Serialize};
// TODO: handle name collisions in a better way
#[derive(Debug, Deserialize, Serialize)]
#[crate::export(object, js_name = "NoteLikeForGetNoteSummary")]
pub struct NoteLike {
pub file_ids: Vec<String>,

View File

@ -0,0 +1,90 @@
use crate::init::hardware_stats::{system, SystemMutexError};
use sysinfo::{Disks, MemoryRefreshKind};
// TODO: i64 -> u64 (we can't export u64 to Node.js)
#[crate::export(object)]
pub struct Cpu {
pub model: String,
// TODO: u16 -> usize (we can't export usize to Node.js)
pub cores: u16,
}
#[crate::export(object)]
pub struct Memory {
/// Total memory amount in bytes
pub total: i64,
/// Used memory amount in bytes
pub used: i64,
/// Available (for (re)use) memory amount in bytes
pub available: i64,
}
#[crate::export(object)]
pub struct Storage {
/// Total storage space in bytes
pub total: i64,
/// Used storage space in bytes
pub used: i64,
}
#[crate::export]
pub fn cpu_info() -> Result<Cpu, SystemMutexError> {
let system_info = system()?;
Ok(Cpu {
model: match system_info.cpus() {
[] => {
tracing::debug!("failed to get CPU info");
"unknown".to_string()
}
cpus => cpus[0].brand().to_string(),
},
cores: system_info.cpus().len() as u16,
})
}
#[crate::export]
pub fn cpu_usage() -> Result<f32, SystemMutexError> {
let mut system_info = system()?;
system_info.refresh_cpu_usage();
let total_cpu_usage: f32 = system_info.cpus().iter().map(|cpu| cpu.cpu_usage()).sum();
let cpu_threads = system_info.cpus().len();
Ok(total_cpu_usage / (cpu_threads as f32))
}
#[crate::export]
pub fn memory_usage() -> Result<Memory, SystemMutexError> {
let mut system_info = system()?;
system_info.refresh_memory_specifics(MemoryRefreshKind::new().with_ram());
Ok(Memory {
total: system_info.total_memory() as i64,
used: system_info.used_memory() as i64,
available: system_info.available_memory() as i64,
})
}
#[crate::export]
pub fn storage_usage() -> Option<Storage> {
// Get the first disk that is actualy used.
let disks = Disks::new_with_refreshed_list();
let disk = disks
.iter()
.find(|disk| disk.available_space() > 0 && disk.total_space() > disk.available_space());
if let Some(disk) = disk {
let total = disk.total_space() as i64;
let available = disk.available_space() as i64;
return Some(Storage {
total,
used: total - available,
});
}
tracing::debug!("failed to get stats");
None
}

View File

@ -7,6 +7,7 @@ pub mod escape_sql;
pub mod format_milliseconds;
pub mod get_image_size;
pub mod get_note_summary;
pub mod hardware_stats;
pub mod is_safe_url;
pub mod latest_version;
pub mod mastodon_id;

View File

@ -1,4 +1,4 @@
pub mod log;
pub mod nodeinfo;
pub mod note;
pub mod push_notification;
pub mod stream;

View File

@ -0,0 +1,232 @@
use crate::database::db_conn;
use crate::misc::get_note_summary::{get_note_summary, NoteLike};
use crate::misc::meta::fetch_meta;
use crate::model::entity::sw_subscription;
use crate::util::http_client;
use once_cell::sync::OnceCell;
use sea_orm::{prelude::*, DbErr};
use web_push::{
ContentEncoding, IsahcWebPushClient, SubscriptionInfo, SubscriptionKeys, VapidSignatureBuilder,
WebPushClient, WebPushError, WebPushMessageBuilder,
};
#[derive(thiserror::Error, Debug)]
pub enum Error {
#[error("Database error: {0}")]
DbErr(#[from] DbErr),
#[error("Web Push error: {0}")]
WebPushErr(#[from] WebPushError),
#[error("Failed to (de)serialize an object: {0}")]
SerializeErr(#[from] serde_json::Error),
#[error("Invalid content: {0}")]
InvalidContentErr(String),
#[error("HTTP client aquisition error: {0}")]
HttpClientErr(#[from] http_client::Error),
}
static CLIENT: OnceCell<IsahcWebPushClient> = OnceCell::new();
fn get_client() -> Result<IsahcWebPushClient, Error> {
Ok(CLIENT
.get_or_try_init(|| http_client::client().map(IsahcWebPushClient::from))
.cloned()?)
}
#[derive(strum::Display, PartialEq)]
#[crate::export(string_enum = "camelCase")]
pub enum PushNotificationKind {
#[strum(serialize = "notification")]
Generic,
#[strum(serialize = "unreadMessagingMessage")]
Chat,
#[strum(serialize = "readAllMessagingMessages")]
ReadAllChats,
#[strum(serialize = "readAllMessagingMessagesOfARoom")]
ReadAllChatsInTheRoom,
#[strum(serialize = "readNotifications")]
ReadNotifications,
#[strum(serialize = "readAllNotifications")]
ReadAllNotifications,
}
fn compact_content(
kind: &PushNotificationKind,
mut content: serde_json::Value,
) -> Result<serde_json::Value, Error> {
if kind != &PushNotificationKind::Generic {
return Ok(content);
}
if !content.is_object() {
return Err(Error::InvalidContentErr("not a JSON object".to_string()));
}
let object = content.as_object_mut().unwrap();
if !object.contains_key("note") {
return Ok(content);
}
let mut note = if object.contains_key("type") && object.get("type").unwrap() == "renote" {
object
.get("note")
.unwrap()
.get("renote")
.ok_or(Error::InvalidContentErr(
"renote object is missing".to_string(),
))?
} else {
object.get("note").unwrap()
}
.clone();
if !note.is_object() {
return Err(Error::InvalidContentErr(
"(re)note is not an object".to_string(),
));
}
let note_like: NoteLike = serde_json::from_value(note.clone())?;
let text = get_note_summary(note_like);
let note_object = note.as_object_mut().unwrap();
note_object.remove("reply");
note_object.remove("renote");
note_object.remove("user");
note_object.insert("text".to_string(), text.into());
object.insert("note".to_string(), note);
Ok(serde_json::from_value(Json::Object(object.clone()))?)
}
async fn handle_web_push_failure(
db: &DatabaseConnection,
err: WebPushError,
subscription_id: &str,
error_message: &str,
) -> Result<(), DbErr> {
match err {
WebPushError::BadRequest(_)
| WebPushError::ServerError(_)
| WebPushError::InvalidUri
| WebPushError::EndpointNotValid
| WebPushError::EndpointNotFound
| WebPushError::TlsError
| WebPushError::SslError
| WebPushError::InvalidPackageName
| WebPushError::MissingCryptoKeys
| WebPushError::InvalidCryptoKeys
| WebPushError::InvalidResponse => {
sw_subscription::Entity::delete_by_id(subscription_id)
.exec(db)
.await?;
tracing::info!("{}; {} was unsubscribed", error_message, subscription_id);
tracing::debug!("reason: {:#?}", err);
}
_ => {
tracing::warn!("{}; subscription id: {}", error_message, subscription_id);
tracing::info!("reason: {:#?}", err);
}
};
Ok(())
}
#[crate::export]
pub async fn send_push_notification(
receiver_user_id: &str,
kind: PushNotificationKind,
content: &serde_json::Value,
) -> Result<(), Error> {
let meta = fetch_meta(true).await?;
if !meta.enable_service_worker || meta.sw_public_key.is_none() || meta.sw_private_key.is_none()
{
return Ok(());
}
let db = db_conn().await?;
let signature_builder = VapidSignatureBuilder::from_base64_no_sub(
meta.sw_private_key.unwrap().as_str(),
web_push::URL_SAFE_NO_PAD,
)?;
let subscriptions = sw_subscription::Entity::find()
.filter(sw_subscription::Column::UserId.eq(receiver_user_id))
.all(db)
.await?;
let payload = format!(
"{{\"type\":\"{}\",\"userId\":\"{}\",\"dateTime\":{},\"body\":{}}}",
kind,
receiver_user_id,
chrono::Utc::now().timestamp_millis(),
serde_json::to_string(&compact_content(&kind, content.clone())?)?
);
tracing::trace!("payload: {:#?}", payload);
for subscription in subscriptions.iter() {
if !subscription.send_read_message
&& [
PushNotificationKind::ReadAllChats,
PushNotificationKind::ReadAllChatsInTheRoom,
PushNotificationKind::ReadAllNotifications,
PushNotificationKind::ReadNotifications,
]
.contains(&kind)
{
continue;
}
let subscription_info = SubscriptionInfo {
endpoint: subscription.endpoint.to_owned(),
keys: SubscriptionKeys {
// convert standard base64 into base64url
// https://en.wikipedia.org/wiki/Base64#Variants_summary_table
p256dh: subscription
.publickey
.replace('+', "-")
.replace('/', "_")
.to_owned(),
auth: subscription
.auth
.replace('+', "-")
.replace('/', "_")
.to_owned(),
},
};
let signature = signature_builder
.clone()
.add_sub_info(&subscription_info)
.build();
if let Err(err) = signature {
handle_web_push_failure(db, err, &subscription.id, "failed to build a signature")
.await?;
continue;
}
let mut message_builder = WebPushMessageBuilder::new(&subscription_info);
message_builder.set_ttl(1000);
message_builder.set_payload(ContentEncoding::Aes128Gcm, payload.as_bytes());
message_builder.set_vapid_signature(signature.unwrap());
let message = message_builder.build();
if let Err(err) = message {
handle_web_push_failure(db, err, &subscription.id, "failed to build a payload").await?;
continue;
}
if let Err(err) = get_client()?.send(message.unwrap()).await {
handle_web_push_failure(db, err, &subscription.id, "failed to send").await?;
continue;
}
tracing::debug!("success; subscription id: {}", subscription.id);
}
Ok(())
}

View File

@ -36,11 +36,11 @@
"adm-zip": "0.5.10",
"ajv": "8.13.0",
"archiver": "7.0.1",
"aws-sdk": "2.1618.0",
"aws-sdk": "2.1621.0",
"axios": "1.6.8",
"backend-rs": "workspace:*",
"blurhash": "2.0.5",
"bull": "4.12.3",
"bull": "4.12.4",
"cacheable-lookup": "TheEssem/cacheable-lookup",
"cbor-x": "1.5.9",
"chalk": "5.3.0",
@ -62,7 +62,7 @@
"hpagent": "1.2.0",
"ioredis": "5.4.1",
"ip-cidr": "4.0.0",
"is-svg": "5.0.0",
"is-svg": "5.0.1",
"jsdom": "24.0.0",
"json5": "2.2.3",
"jsonld": "8.3.2",
@ -87,7 +87,6 @@
"node-fetch": "3.3.2",
"nodemailer": "6.9.13",
"opencc-js": "1.0.5",
"os-utils": "0.0.14",
"otpauth": "9.2.4",
"parse5": "7.1.2",
"pg": "8.11.5",
@ -111,7 +110,6 @@
"stringz": "2.1.0",
"summaly": "2.7.0",
"syslog-pro": "1.0.0",
"systeminformation": "5.22.8",
"tar-stream": "3.1.7",
"tesseract.js": "5.1.0",
"tinycolor2": "1.6.0",
@ -119,13 +117,12 @@
"typeorm": "0.3.20",
"ulid": "2.3.0",
"uuid": "9.0.1",
"web-push": "3.6.7",
"websocket": "1.0.34",
"websocket": "1.0.35",
"xev": "3.0.2"
},
"devDependencies": {
"@swc/cli": "0.3.12",
"@swc/core": "1.5.5",
"@swc/core": "1.5.7",
"@types/adm-zip": "0.5.5",
"@types/color-convert": "2.0.3",
"@types/content-disposition": "0.5.8",
@ -146,7 +143,7 @@
"@types/koa__multer": "2.0.7",
"@types/koa__router": "12.0.4",
"@types/mocha": "10.0.6",
"@types/node": "20.12.11",
"@types/node": "20.12.12",
"@types/node-fetch": "2.6.11",
"@types/nodemailer": "6.4.15",
"@types/oauth": "0.9.4",

View File

@ -1,33 +0,0 @@
declare module "os-utils" {
type FreeCommandCallback = (usedmem: number) => void;
type HarddriveCallback = (total: number, free: number, used: number) => void;
type GetProcessesCallback = (result: string) => void;
type CPUCallback = (perc: number) => void;
export function platform(): NodeJS.Platform;
export function cpuCount(): number;
export function sysUptime(): number;
export function processUptime(): number;
export function freemem(): number;
export function totalmem(): number;
export function freememPercentage(): number;
export function freeCommand(callback: FreeCommandCallback): void;
export function harddrive(callback: HarddriveCallback): void;
export function getProcesses(callback: GetProcessesCallback): void;
export function getProcesses(
nProcess: number,
callback: GetProcessesCallback,
): void;
export function allLoadavg(): string;
export function loadavg(_time?: number): number;
export function cpuFree(callback: CPUCallback): void;
export function cpuUsage(callback: CPUCallback): void;
}

View File

@ -12,10 +12,10 @@ import {
fetchMeta,
initializeRustLogger,
removeOldAttestationChallenges,
showServerInfo,
type Config,
} from "backend-rs";
import { config, envOption } from "@/config.js";
import { showMachineInfo } from "@/misc/show-machine-info.js";
import { db, initDb } from "@/db/postgre.js";
import { inspect } from "node:util";
@ -93,12 +93,12 @@ function greet() {
export async function masterMain() {
// initialize app
try {
initializeRustLogger();
greet();
showEnvironment();
await showMachineInfo(bootLogger);
showServerInfo();
showNodejsVersion();
await connectDb();
initializeRustLogger();
} catch (e) {
bootLogger.error(
`Fatal error occurred during initialization:\n${inspect(e)}`,

View File

@ -1,15 +1,8 @@
import si from "systeminformation";
import Xev from "xev";
import * as osUtils from "os-utils";
import { fetchMeta } from "backend-rs";
import { fetchMeta, cpuUsage, memoryUsage } from "backend-rs";
const ev = new Xev();
const interval = 2000;
const roundCpu = (num: number) => Math.round(num * 1000) / 1000;
const round = (num: number) => Math.round(num * 10) / 10;
/**
* Report server stats regularly
*/
@ -24,26 +17,9 @@ export default async function () {
if (!meta.enableServerMachineStats) return;
async function tick() {
const cpu = await cpuUsage();
const memStats = await mem();
const netStats = await net();
const fsStats = await fs();
const stats = {
cpu: roundCpu(cpu),
mem: {
used: round(memStats.used - memStats.buffers - memStats.cached),
active: round(memStats.active),
total: round(memStats.total),
},
net: {
rx: round(Math.max(0, netStats.rx_sec)),
tx: round(Math.max(0, netStats.tx_sec)),
},
fs: {
r: round(Math.max(0, fsStats.rIO_sec ?? 0)),
w: round(Math.max(0, fsStats.wIO_sec ?? 0)),
},
cpu: cpuUsage(),
mem: memoryUsage(),
};
ev.emit("serverStats", stats);
log.unshift(stats);
@ -52,33 +28,5 @@ export default async function () {
tick();
setInterval(tick, interval);
}
// CPU STAT
function cpuUsage(): Promise<number> {
return new Promise((res, rej) => {
osUtils.cpuUsage((cpuUsage) => {
res(cpuUsage);
});
});
}
// MEMORY STAT
async function mem() {
const data = await si.mem();
return data;
}
// NETWORK STAT
async function net() {
const iface = await si.networkInterfaceDefault();
const data = await si.networkStats(iface);
return data[0];
}
// FS STAT
async function fs() {
const data = await si.disksIO().catch(() => ({ rIO_sec: 0, wIO_sec: 0 }));
return data || { rIO_sec: 0, wIO_sec: 0 };
setInterval(tick, 3000);
}

View File

@ -1,17 +0,0 @@
import * as os from "node:os";
import sysUtils from "systeminformation";
import type Logger from "@/services/logger.js";
export async function showMachineInfo(parentLogger: Logger) {
const logger = parentLogger.createSubLogger("machine");
logger.debug(`Hostname: ${os.hostname()}`);
logger.debug(`Platform: ${process.platform} Arch: ${process.arch}`);
const mem = await sysUtils.mem();
const totalmem = (mem.total / 1024 / 1024 / 1024).toFixed(1);
const availmem = (mem.available / 1024 / 1024 / 1024).toFixed(1);
logger.debug(
`CPU: ${
os.cpus().length
} core MEM: ${totalmem}GB (available: ${availmem}GB)`,
);
}

View File

@ -3,10 +3,11 @@ import {
publishToChatStream,
publishToGroupChatStream,
publishToChatIndexStream,
sendPushNotification,
ChatEvent,
ChatIndexEvent,
PushNotificationKind,
} from "backend-rs";
import { pushNotification } from "@/services/push-notification.js";
import type { User, IRemoteUser } from "@/models/entities/user.js";
import type { MessagingMessage } from "@/models/entities/messaging-message.js";
import { MessagingMessages, UserGroupJoinings, Users } from "@/models/index.js";
@ -62,20 +63,19 @@ export async function readUserMessagingMessage(
if (!(await Users.getHasUnreadMessagingMessage(userId))) {
// 全ての(いままで未読だった)自分宛てのメッセージを(これで)読みましたよというイベントを発行
publishMainStream(userId, "readAllMessagingMessages");
pushNotification(userId, "readAllMessagingMessages", undefined);
sendPushNotification(userId, PushNotificationKind.ReadAllChats, {});
} else {
// そのユーザーとのメッセージで未読がなければイベント発行
const count = await MessagingMessages.count({
const hasUnread = await MessagingMessages.exists({
where: {
userId: otherpartyId,
recipientId: userId,
isRead: false,
},
take: 1,
});
if (!count) {
pushNotification(userId, "readAllMessagingMessagesOfARoom", {
if (!hasUnread) {
sendPushNotification(userId, PushNotificationKind.ReadAllChatsInTheRoom, {
userId: otherpartyId,
});
}
@ -137,10 +137,10 @@ export async function readGroupMessagingMessage(
if (!(await Users.getHasUnreadMessagingMessage(userId))) {
// 全ての(いままで未読だった)自分宛てのメッセージを(これで)読みましたよというイベントを発行
publishMainStream(userId, "readAllMessagingMessages");
pushNotification(userId, "readAllMessagingMessages", undefined);
sendPushNotification(userId, PushNotificationKind.ReadAllChats, {});
} else {
// そのグループにおいて未読がなければイベント発行
const unreadExist = await MessagingMessages.createQueryBuilder("message")
const hasUnread = await MessagingMessages.createQueryBuilder("message")
.where("message.groupId = :groupId", { groupId: groupId })
.andWhere("message.userId != :userId", { userId: userId })
.andWhere("NOT (:userId = ANY(message.reads))", { userId: userId })
@ -150,8 +150,10 @@ export async function readGroupMessagingMessage(
.getOne()
.then((x) => x != null);
if (!unreadExist) {
pushNotification(userId, "readAllMessagingMessagesOfARoom", { groupId });
if (!hasUnread) {
sendPushNotification(userId, PushNotificationKind.ReadAllChatsInTheRoom, {
groupId,
});
}
}
}

View File

@ -1,6 +1,6 @@
import { In } from "typeorm";
import { publishMainStream } from "@/services/stream.js";
import { pushNotification } from "@/services/push-notification.js";
import { sendPushNotification, PushNotificationKind } from "backend-rs";
import type { User } from "@/models/entities/user.js";
import type { Notification } from "@/models/entities/notification.js";
import { Notifications, Users } from "@/models/index.js";
@ -47,7 +47,11 @@ export async function readNotificationByQuery(
function postReadAllNotifications(userId: User["id"]) {
publishMainStream(userId, "readAllNotifications");
return pushNotification(userId, "readAllNotifications", undefined);
return sendPushNotification(
userId,
PushNotificationKind.ReadAllNotifications,
{},
);
}
function postReadNotifications(
@ -55,5 +59,7 @@ function postReadNotifications(
notificationIds: Notification["id"][],
) {
publishMainStream(userId, "readNotifications", notificationIds);
return pushNotification(userId, "readNotifications", { notificationIds });
return sendPushNotification(userId, PushNotificationKind.ReadNotifications, {
notificationIds,
});
}

View File

@ -1,8 +1,8 @@
import * as os from "node:os";
import si from "systeminformation";
import define from "@/server/api/define.js";
import { redisClient } from "@/db/redis.js";
import { db } from "@/db/postgre.js";
import { cpuInfo, memoryUsage, storageUsage } from "backend-rs";
export const meta = {
requireCredential: true,
@ -85,19 +85,6 @@ export const meta = {
},
},
},
net: {
type: "object",
optional: false,
nullable: false,
properties: {
interface: {
type: "string",
optional: false,
nullable: false,
example: "eth0",
},
},
},
},
},
} as const;
@ -109,13 +96,10 @@ export const paramDef = {
} as const;
export default define(meta, paramDef, async () => {
const memStats = await si.mem();
const fsStats = await si.fsSize();
const netInterface = await si.networkInterfaceDefault();
const redisServerInfo = await redisClient.info("Server");
const m = redisServerInfo.match(new RegExp("^redis_version:(.*)", "m"));
const m = redisServerInfo.match(/^redis_version:(.*)/m);
const redis_version = m?.[1];
const storage = storageUsage();
return {
machine: os.hostname(),
@ -125,19 +109,13 @@ export default define(meta, paramDef, async () => {
.query("SHOW server_version")
.then((x) => x[0].server_version),
redis: redis_version,
cpu: {
model: os.cpus()[0].model,
cores: os.cpus().length,
},
cpu: cpuInfo(),
mem: {
total: memStats.total,
total: memoryUsage().total,
},
fs: {
total: fsStats[0].size,
used: fsStats[0].used,
},
net: {
interface: netInterface,
total: storage?.total ?? 0,
used: storage?.used ?? 0,
},
};
});

View File

@ -1,5 +1,5 @@
import { publishMainStream } from "@/services/stream.js";
import { pushNotification } from "@/services/push-notification.js";
import { sendPushNotification, PushNotificationKind } from "backend-rs";
import { Notifications } from "@/models/index.js";
import define from "@/server/api/define.js";
@ -17,7 +17,7 @@ export const paramDef = {
required: [],
} as const;
export default define(meta, paramDef, async (ps, user) => {
export default define(meta, paramDef, async (_, user) => {
// Update documents
await Notifications.update(
{
@ -31,5 +31,5 @@ export default define(meta, paramDef, async (ps, user) => {
// 全ての通知を読みましたよというイベントを発行
publishMainStream(user.id, "readAllNotifications");
pushNotification(user.id, "readAllNotifications", undefined);
sendPushNotification(user.id, PushNotificationKind.ReadAllNotifications, {});
});

View File

@ -1,10 +1,9 @@
import * as os from "node:os";
import si from "systeminformation";
import define from "@/server/api/define.js";
import { fetchMeta } from "backend-rs";
import { fetchMeta, cpuInfo, memoryUsage, storageUsage } from "backend-rs";
export const meta = {
requireCredential: false,
requireCredential: true,
requireCredentialPrivateMode: true,
allowGet: true,
cacheSec: 30,
@ -18,19 +17,8 @@ export const paramDef = {
} as const;
export default define(meta, paramDef, async () => {
const memStats = await si.mem();
const fsStats = await si.fsSize();
let fsIndex = 0;
// Get the first index of fs sizes that are actualy used.
for (const [i, stat] of fsStats.entries()) {
if (stat.rw === true && stat.used > 0) {
fsIndex = i;
break;
}
}
const instanceMeta = await fetchMeta(true);
if (!instanceMeta.enableServerMachineStats) {
return {
machine: "Not specified",
@ -47,18 +35,19 @@ export default define(meta, paramDef, async () => {
},
};
}
const memory = memoryUsage();
const storage = storageUsage();
return {
machine: os.hostname(),
cpu: {
model: os.cpus()[0].model,
cores: os.cpus().length,
},
cpu: cpuInfo(),
mem: {
total: memStats.total,
total: memory.total,
},
fs: {
total: fsStats[fsIndex].size,
used: fsStats[fsIndex].used,
total: storage?.total ?? 0,
used: storage?.used ?? 0,
},
};
});

View File

@ -149,7 +149,9 @@ router.get<{ Params: { path: string } }>("/emoji/:path(.*)", async (ctx) => {
return;
}
let url = new URL(`${config.mediaProxy || config.url + "/proxy"}/emoji.webp`);
const url = new URL(
`${config.mediaProxy || `${config.url}/proxy`}/emoji.webp`,
);
// || emoji.originalUrl してるのは後方互換性のため
url.searchParams.append("url", emoji.publicUrl || emoji.originalUrl);
url.searchParams.append("emoji", "1");
@ -370,9 +372,8 @@ const getFeed = async (
};
// As the /@user[.json|.rss|.atom]/sub endpoint is complicated, we will use a regex to switch between them.
const reUser = new RegExp(
"^/@(?<user>[^/]+?)(?:.(?<feed>json|rss|atom)(?:\\?[^/]*)?)?(?:/(?<sub>[^/]+))?$",
);
const reUser =
/^\/@(?<user>[^\/]+?)(?:.(?<feed>json|rss|atom)(?:\?[^\/]*)?)?(?:\/(?<sub>[^\/]+))?$/;
router.get(reUser, async (ctx, next) => {
const groups = reUser.exec(ctx.originalUrl)?.groups;
if (!groups) {

View File

@ -1,73 +0,0 @@
{
"short_name": "Firefish",
"name": "Firefish",
"description": "An open source, decentralized social media platform that's free forever!",
"start_url": "/",
"scope": "/",
"display": "standalone",
"background_color": "#1f1d2e",
"theme_color": "#31748f",
"orientation": "natural",
"icons": [
{
"src": "/static-assets/icons/192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "any"
},
{
"src": "/static-assets/icons/512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "any"
},
{
"src": "/static-assets/icons/maskable.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable"
},
{
"src": "/static-assets/icons/monochrome.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "monochrome"
}
],
"share_target": {
"action": "/share/",
"params": {
"title": "title",
"text": "text",
"url": "url"
}
},
"screenshots": [
{
"src": "/static-assets/screenshots/1.webp",
"sizes": "1080x2340",
"type": "image/webp",
"platform": "narrow",
"label": "Profile page"
},
{
"src": "/static-assets/screenshots/2.webp",
"sizes": "1080x2340",
"type": "image/webp",
"platform": "narrow",
"label": "Posts"
}
],
"shortcuts": [
{
"name": "Notifications",
"short_name": "Notifs",
"url": "/my/notifications"
},
{
"name": "Chats",
"url": "/my/messaging"
}
],
"categories": ["social"]
}

View File

@ -1,27 +1,97 @@
import type Koa from "koa";
import { fetchMeta } from "backend-rs";
import { config } from "@/config.js";
import manifest from "./manifest.json" assert { type: "json" };
const manifest = {
short_name: "Firefish",
name: "Firefish",
description:
"An open source, decentralized social media platform that's free forever!",
start_url: "/",
scope: "/",
display: "standalone",
background_color: "#1f1d2e",
theme_color: "#31748f",
orientation: "natural",
icons: [
{
src: "/static-assets/icons/192.png",
sizes: "192x192",
type: "image/png",
purpose: "any",
},
{
src: "/static-assets/icons/512.png",
sizes: "512x512",
type: "image/png",
purpose: "any",
},
{
src: "/static-assets/icons/maskable.png",
sizes: "512x512",
type: "image/png",
purpose: "maskable",
},
{
src: "/static-assets/icons/monochrome.png",
sizes: "512x512",
type: "image/png",
purpose: "monochrome",
},
],
share_target: {
action: "/share/",
params: {
title: "title",
text: "text",
url: "url",
},
},
screenshots: [
{
src: "/static-assets/screenshots/1.webp",
sizes: "1080x2340",
type: "image/webp",
platform: "narrow",
label: "Profile page",
},
{
src: "/static-assets/screenshots/2.webp",
sizes: "1080x2340",
type: "image/webp",
platform: "narrow",
label: "Posts",
},
],
shortcuts: [
{
name: "Notifications",
short_name: "Notifs",
url: "/my/notifications",
},
{
name: "Chats",
url: "/my/messaging",
},
],
categories: ["social"],
};
export const manifestHandler = async (ctx: Koa.Context) => {
// TODO
//const res = structuredClone(manifest);
const res = JSON.parse(JSON.stringify(manifest));
const instance = await fetchMeta(true);
const instance = await fetchMeta(false);
res.short_name = instance.name || "Firefish";
res.name = instance.name || "Firefish";
if (instance.themeColor) res.theme_color = instance.themeColor;
for (const icon of res.icons) {
manifest.short_name = instance.name || "Firefish";
manifest.name = instance.name || "Firefish";
if (instance.themeColor) manifest.theme_color = instance.themeColor;
for (const icon of manifest.icons) {
icon.src = `${icon.src}?v=${config.version.replace(/[^0-9]/g, "")}`;
}
for (const screenshot of res.screenshots) {
for (const screenshot of manifest.screenshots) {
screenshot.src = `${screenshot.src}?v=${config.version.replace(
/[^0-9]/g,
"",
)}`;
}
ctx.set("Cache-Control", "max-age=300");
ctx.body = res;
ctx.body = manifest;
};

View File

@ -1,5 +1,4 @@
import { publishMainStream } from "@/services/stream.js";
import { pushNotification } from "@/services/push-notification.js";
import {
Notifications,
Mutings,
@ -8,7 +7,12 @@ import {
Users,
Followings,
} from "@/models/index.js";
import { genId, isSilencedServer } from "backend-rs";
import {
genId,
isSilencedServer,
sendPushNotification,
PushNotificationKind,
} from "backend-rs";
import type { User } from "@/models/entities/user.js";
import type { Notification } from "@/models/entities/notification.js";
import { sendEmailNotification } from "./send-email-notification.js";
@ -81,7 +85,7 @@ export async function createNotification(
if (fresh == null) return; // 既に削除されているかもしれない
// We execute this before, because the server side "read" check doesnt work well with push notifications, the app and service worker will decide themself
// when it is best to show push notifications
pushNotification(notifieeId, "notification", packed);
sendPushNotification(notifieeId, PushNotificationKind.Generic, packed);
if (fresh.isRead) return;
//#region ただしミュートしているユーザーからの通知なら無視

View File

@ -9,16 +9,17 @@ import {
} from "@/models/index.js";
import {
genId,
sendPushNotification,
publishToChatStream,
publishToGroupChatStream,
publishToChatIndexStream,
toPuny,
ChatEvent,
ChatIndexEvent,
PushNotificationKind,
} from "backend-rs";
import type { MessagingMessage } from "@/models/entities/messaging-message.js";
import { publishMainStream } from "@/services/stream.js";
import { pushNotification } from "@/services/push-notification.js";
import { Not } from "typeorm";
import type { Note } from "@/models/entities/note.js";
import renderNote from "@/remote/activitypub/renderer/note.js";
@ -118,7 +119,11 @@ export async function createMessage(
//#endregion
publishMainStream(recipientUser.id, "unreadMessagingMessage", messageObj);
pushNotification(recipientUser.id, "unreadMessagingMessage", messageObj);
sendPushNotification(
recipientUser.id,
PushNotificationKind.Chat,
messageObj,
);
} else if (recipientGroup) {
const joinings = await UserGroupJoinings.findBy({
userGroupId: recipientGroup.id,
@ -127,7 +132,11 @@ export async function createMessage(
for (const joining of joinings) {
if (freshMessage.reads.includes(joining.userId)) return; // 既読
publishMainStream(joining.userId, "unreadMessagingMessage", messageObj);
pushNotification(joining.userId, "unreadMessagingMessage", messageObj);
sendPushNotification(
joining.userId,
PushNotificationKind.Chat,
messageObj,
);
}
}
}, 2000);

View File

@ -1,115 +0,0 @@
import push from "web-push";
import { config } from "@/config.js";
import { SwSubscriptions } from "@/models/index.js";
import { fetchMeta, getNoteSummary } from "backend-rs";
import type { Packed } from "@/misc/schema.js";
// Defined also packages/sw/types.ts#L14-L21
type pushNotificationsTypes = {
notification: Packed<"Notification">;
unreadMessagingMessage: Packed<"MessagingMessage">;
readNotifications: { notificationIds: string[] };
readAllNotifications: undefined;
readAllMessagingMessages: undefined;
readAllMessagingMessagesOfARoom: { userId: string } | { groupId: string };
};
// プッシュメッセージサーバーには文字数制限があるため、内容を削減します
function truncateNotification(notification: Packed<"Notification">): any {
if (notification.note != null) {
return {
...notification,
note: {
...notification.note,
// replace the text with summary
text: getNoteSummary(
notification.type === "renote" && notification.note.renote != null
? notification.note.renote
: notification.note,
),
cw: undefined,
reply: undefined,
renote: undefined,
user: undefined as any, // 通知を受け取ったユーザーである場合が多いのでこれも捨てる
},
};
}
return notification;
}
export async function pushNotification<T extends keyof pushNotificationsTypes>(
userId: string,
type: T,
body: pushNotificationsTypes[T],
) {
const meta = await fetchMeta(true);
if (
!meta.enableServiceWorker ||
meta.swPublicKey == null ||
meta.swPrivateKey == null
)
return;
// アプリケーションの連絡先と、サーバーサイドの鍵ペアの情報を登録
push.setVapidDetails(config.url, meta.swPublicKey, meta.swPrivateKey);
// Fetch
const subscriptions = await SwSubscriptions.findBy({
userId: userId,
});
for (const subscription of subscriptions) {
if (
[
"readNotifications",
"readAllNotifications",
"readAllMessagingMessages",
"readAllMessagingMessagesOfARoom",
].includes(type) &&
!subscription.sendReadMessage
)
continue;
const pushSubscription = {
endpoint: subscription.endpoint,
keys: {
auth: subscription.auth,
p256dh: subscription.publickey,
},
};
push
.sendNotification(
pushSubscription,
JSON.stringify({
type,
body:
type === "notification"
? truncateNotification(body as Packed<"Notification">)
: body,
userId,
dateTime: Date.now(),
}),
{
proxy: config.proxy,
},
)
.catch((err: any) => {
//swLogger.info(err.statusCode);
//swLogger.info(err.headers);
//swLogger.info(err.body);
if (err.statusCode === 410) {
SwSubscriptions.delete({
userId: userId,
endpoint: subscription.endpoint,
auth: subscription.auth,
publickey: subscription.publickey,
});
}
});
}
}

View File

@ -75,7 +75,7 @@
"sass": "1.77.1",
"seedrandom": "3.0.5",
"stringz": "2.1.0",
"swiper": "11.1.1",
"swiper": "11.1.3",
"syuilo-password-strength": "0.0.1",
"textarea-caret": "3.1.0",
"three": "0.164.1",
@ -88,9 +88,9 @@
"vite": "5.2.11",
"vite-plugin-compression": "0.5.1",
"vue": "3.4.27",
"vue-draggable-plus": "0.4.0",
"vue-draggable-plus": "0.4.1",
"vue-plyr": "7.0.0",
"vue-prism-editor": "2.0.0-alpha.2",
"vue-tsc": "2.0.17"
"vue-tsc": "2.0.18"
}
}

View File

@ -349,17 +349,6 @@ export default defineComponent({
),
];
}
case "center": {
return [
h(
"div",
{
style: "text-align: center;",
},
genEl(token.children),
),
];
}
}
if (style == null) {
return [

View File

@ -44,7 +44,6 @@ import icon from "@/scripts/icon";
const stream = useStream();
const meta = await os.api("server-info", {});
const serverStats = await os.api("stats");
const cpuUsage = ref(0);

View File

@ -464,9 +464,7 @@ const preview_bold = ref(`**${i18n.ts._mfm.dummy}**`);
const preview_small = ref(
`<small>${i18n.ts._mfm.dummy}</small> $[small ${i18n.ts._mfm.dummy}]`,
);
const preview_center = ref(
`<center>${i18n.ts._mfm.dummy}</center>\n$[center ${i18n.ts._mfm.dummy}]`,
);
const preview_center = ref(`<center>${i18n.ts._mfm.dummy}</center>`);
const preview_inlineCode = ref('`<: "Hello, world!"`');
const preview_blockCode = ref(
'```\n~ (#i, 100) {\n\t<: ? ((i % 15) = 0) "FizzBuzz"\n\t\t.? ((i % 3) = 0) "Fizz"\n\t\t.? ((i % 5) = 0) "Buzz"\n\t\t. i\n}\n```',

View File

@ -22,5 +22,4 @@ export const MFM_TAGS = [
"rotate",
"fade",
"small",
"center",
];

View File

@ -36,7 +36,7 @@
/>
<text x="1" y="5">
CPU
<tspan>{{ cpuP }}%</tspan>
<tspan>{{ cpuUsage }}%</tspan>
</text>
</svg>
<svg :viewBox="`0 0 ${viewBoxX} ${viewBoxY}`">
@ -75,7 +75,7 @@
/>
<text x="1" y="5">
MEM
<tspan>{{ memP }}%</tspan>
<tspan>{{ memUsage }}%</tspan>
</text>
</svg>
</div>
@ -87,26 +87,25 @@ import { v4 as uuid } from "uuid";
const props = defineProps<{
connection: any;
meta: any;
}>();
const viewBoxX: number = ref(50);
const viewBoxY: number = ref(30);
const stats: any[] = ref([]);
const viewBoxX = ref(50);
const viewBoxY = ref(30);
const stats = ref<any[]>([]);
const cpuGradientId = uuid();
const cpuMaskId = uuid();
const memGradientId = uuid();
const memMaskId = uuid();
const cpuPolylinePoints: string = ref("");
const memPolylinePoints: string = ref("");
const cpuPolygonPoints: string = ref("");
const memPolygonPoints: string = ref("");
const cpuHeadX: any = ref(null);
const cpuHeadY: any = ref(null);
const memHeadX: any = ref(null);
const memHeadY: any = ref(null);
const cpuP: string = ref("");
const memP: string = ref("");
const cpuPolylinePoints = ref("");
const memPolylinePoints = ref("");
const cpuPolygonPoints = ref("");
const memPolygonPoints = ref("");
const cpuHeadX = ref<number>();
const cpuHeadY = ref<number>();
const memHeadX = ref<number>();
const memHeadY = ref<number>();
const cpuUsage = ref<string>();
const memUsage = ref<string>();
onMounted(() => {
props.connection.on("stats", onStats);
@ -127,11 +126,11 @@ function onStats(connStats) {
const cpuPolylinePointsStats = stats.value.map((s, i) => [
viewBoxX.value - (stats.value.length - 1 - i),
(1 - s.cpu) * viewBoxY.value,
(1 - s.cpu / 100) * viewBoxY.value,
]);
const memPolylinePointsStats = stats.value.map((s, i) => [
viewBoxX.value - (stats.value.length - 1 - i),
(1 - s.mem.active / s.mem.total) * viewBoxY.value,
(1 - s.mem.used / s.mem.total) * viewBoxY.value,
]);
cpuPolylinePoints.value = cpuPolylinePointsStats
.map((xy) => `${xy[0]},${xy[1]}`)
@ -152,8 +151,10 @@ function onStats(connStats) {
memHeadX.value = memPolylinePointsStats[memPolylinePointsStats.length - 1][0];
memHeadY.value = memPolylinePointsStats[memPolylinePointsStats.length - 1][1];
cpuP.value = (connStats.cpu * 100).toFixed(0);
memP.value = ((connStats.mem.active / connStats.mem.total) * 100).toFixed(0);
cpuUsage.value = connStats.cpu.toFixed(1);
memUsage.value = ((connStats.mem.used / connStats.mem.total) * 100).toFixed(
1,
);
}
function onStatsLog(statsLog) {

View File

@ -19,10 +19,10 @@ const props = defineProps<{
meta: any;
}>();
const usage: number = ref(0);
const usage = ref(0);
function onStats(stats) {
usage.value = stats.cpu;
usage.value = stats.cpu / 100;
}
onMounted(() => {

View File

@ -4,7 +4,7 @@
<div>
<p><i :class="icon('ph-hard-drives')"></i>Disk</p>
<p>Total: {{ bytes(total, 1) }}</p>
<p>Free: {{ bytes(available, 1) }}</p>
<p>Available: {{ bytes(available, 1) }}</p>
<p>Used: {{ bytes(used, 1) }}</p>
</div>
</div>
@ -18,7 +18,12 @@ import bytes from "@/filters/bytes";
import icon from "@/scripts/icon";
const props = defineProps<{
meta: any; // TODO
meta: {
fs: {
used: number;
total: number;
};
};
}>();
const usage = computed(() => props.meta.fs.used / props.meta.fs.total);

View File

@ -26,23 +26,18 @@
:connection="connection"
:meta="meta"
/>
<XNet
<XCpu
v-else-if="widgetProps.view === 1"
:connection="connection"
:meta="meta"
/>
<XCpu
<XMemory
v-else-if="widgetProps.view === 2"
:connection="connection"
:meta="meta"
/>
<XMemory
v-else-if="widgetProps.view === 3"
:connection="connection"
:meta="meta"
/>
<XDisk
v-else-if="widgetProps.view === 4"
v-else-if="widgetProps.view === 3"
:connection="connection"
:meta="meta"
/>
@ -52,10 +47,13 @@
<script lang="ts" setup>
import { onUnmounted, ref } from "vue";
import type { Widget, WidgetComponentExpose } from "../widget";
import type {
WidgetComponentEmits,
WidgetComponentExpose,
WidgetComponentProps,
} from "../widget";
import { useWidgetPropsManager } from "../widget";
import XCpuMemory from "./cpu-mem.vue";
import XNet from "./net.vue";
import XCpu from "./cpu.vue";
import XMemory from "./mem.vue";
import XDisk from "./disk.vue";
@ -87,11 +85,8 @@ const widgetPropsDef = {
type WidgetProps = GetFormResultType<typeof widgetPropsDef>;
// vueimporttype
// const props = defineProps<WidgetComponentProps<WidgetProps>>();
// const emit = defineEmits<WidgetComponentEmits<WidgetProps>>();
const props = defineProps<{ widget?: Widget<WidgetProps> }>();
const emit = defineEmits<{ (ev: "updateProps", props: WidgetProps) }>();
const props = defineProps<WidgetComponentProps<WidgetProps>>();
const emit = defineEmits<WidgetComponentEmits<WidgetProps>>();
const { widgetProps, configure, save } = useWidgetPropsManager(
name,
@ -107,14 +102,7 @@ os.apiGet("server-info", {}).then((res) => {
});
const toggleView = () => {
if (
(widgetProps.view === 5 && instance.features.searchFilters) ||
(widgetProps.view === 4 && !instance.features.searchFilters)
) {
widgetProps.view = 0;
} else {
widgetProps.view++;
}
widgetProps.view = (widgetProps.view + 1) % 4;
save();
};

View File

@ -5,7 +5,7 @@
<p><i :class="icon('ph-microchip')"></i>RAM</p>
<p>Total: {{ bytes(total, 1) }}</p>
<p>Used: {{ bytes(used, 1) }}</p>
<p>Free: {{ bytes(free, 1) }}</p>
<p>Available: {{ bytes(available, 1) }}</p>
</div>
</div>
</template>
@ -18,19 +18,18 @@ import icon from "@/scripts/icon";
const props = defineProps<{
connection: any;
meta: any;
}>();
const usage = ref<number>(0);
const total = ref<number>(0);
const used = ref<number>(0);
const free = ref<number>(0);
const available = ref<number>(0);
function onStats(stats) {
usage.value = stats.mem.active / stats.mem.total;
usage.value = stats.mem.used / stats.mem.total;
total.value = stats.mem.total;
used.value = stats.mem.active;
free.value = total.value - used.value;
used.value = stats.mem.used;
available.value = stats.mem.available;
}
onMounted(() => {

View File

@ -1,156 +0,0 @@
<template>
<div class="oxxrhrto">
<svg :viewBox="`0 0 ${viewBoxX} ${viewBoxY}`">
<polygon
:points="inPolygonPoints"
fill="#f6c177"
fill-opacity="0.5"
/>
<polyline
:points="inPolylinePoints"
fill="none"
stroke="#f6c177"
stroke-width="1"
/>
<circle :cx="inHeadX" :cy="inHeadY" r="1.5" fill="#f6c177" />
<text x="1" y="5">
NET rx
<tspan>{{ bytes(inRecent) }}</tspan>
</text>
</svg>
<svg :viewBox="`0 0 ${viewBoxX} ${viewBoxY}`">
<polygon
:points="outPolygonPoints"
fill="#31748f"
fill-opacity="0.5"
/>
<polyline
:points="outPolylinePoints"
fill="none"
stroke="#31748f"
stroke-width="1"
/>
<circle :cx="outHeadX" :cy="outHeadY" r="1.5" fill="#31748f" />
<text x="1" y="5">
NET tx
<tspan>{{ bytes(outRecent) }}</tspan>
</text>
</svg>
</div>
</template>
<script lang="ts" setup>
import { onBeforeUnmount, onMounted, ref } from "vue";
import bytes from "@/filters/bytes";
const props = defineProps<{
connection: any;
meta: any;
}>();
const viewBoxX: number = ref(50);
const viewBoxY: number = ref(30);
const stats: any[] = ref([]);
const inPolylinePoints: string = ref("");
const outPolylinePoints: string = ref("");
const inPolygonPoints: string = ref("");
const outPolygonPoints: string = ref("");
const inHeadX: any = ref(null);
const inHeadY: any = ref(null);
const outHeadX: any = ref(null);
const outHeadY: any = ref(null);
const inRecent: number = ref(0);
const outRecent: number = ref(0);
onMounted(() => {
props.connection.on("stats", onStats);
props.connection.on("statsLog", onStatsLog);
props.connection.send("requestLog", {
id: Math.random().toString().substring(2, 10),
});
});
onBeforeUnmount(() => {
props.connection.off("stats", onStats);
props.connection.off("statsLog", onStatsLog);
});
function onStats(connStats) {
stats.value.push(connStats);
if (stats.value.length > 50) stats.value.shift();
const inPeak = Math.max(
1024 * 64,
Math.max(...stats.value.map((s) => s.net.rx)),
);
const outPeak = Math.max(
1024 * 64,
Math.max(...stats.value.map((s) => s.net.tx)),
);
const inPolylinePointsStats = stats.value.map((s, i) => [
viewBoxX.value - (stats.value.length - 1 - i),
(1 - s.net.rx / inPeak) * viewBoxY.value,
]);
const outPolylinePointsStats = stats.value.map((s, i) => [
viewBoxX.value - (stats.value.length - 1 - i),
(1 - s.net.tx / outPeak) * viewBoxY.value,
]);
inPolylinePoints.value = inPolylinePointsStats
.map((xy) => `${xy[0]},${xy[1]}`)
.join(" ");
outPolylinePoints.value = outPolylinePointsStats
.map((xy) => `${xy[0]},${xy[1]}`)
.join(" ");
inPolygonPoints.value = `${viewBoxX.value - (stats.value.length - 1)},${
viewBoxY.value
} ${inPolylinePoints.value} ${viewBoxX.value},${viewBoxY.value}`;
outPolygonPoints.value = `${viewBoxX.value - (stats.value.length - 1)},${
viewBoxY.value
} ${outPolylinePoints.value} ${viewBoxX.value},${viewBoxY.value}`;
inHeadX.value = inPolylinePointsStats[inPolylinePointsStats.length - 1][0];
inHeadY.value = inPolylinePointsStats[inPolylinePointsStats.length - 1][1];
outHeadX.value = outPolylinePointsStats[outPolylinePointsStats.length - 1][0];
outHeadY.value = outPolylinePointsStats[outPolylinePointsStats.length - 1][1];
inRecent.value = connStats.net.rx;
outRecent.value = connStats.net.tx;
}
function onStatsLog(statsLog) {
for (const revStats of [...statsLog].reverse()) {
onStats(revStats);
}
}
</script>
<style lang="scss" scoped>
.oxxrhrto {
display: flex;
> svg {
display: block;
padding: 10px;
width: 50%;
&:first-child {
padding-right: 5px;
}
&:last-child {
padding-left: 5px;
}
> text {
font-size: 5px;
fill: currentColor;
> tspan {
opacity: 0.5;
}
}
}
}
</style>

View File

@ -19,7 +19,7 @@
:stroke="color"
/>
<text x="50%" y="50%" dy="0.05" text-anchor="middle">
{{ (value * 100).toFixed(0) }}%
{{ (value * 100).toFixed(1) }}%
</text>
</svg>
</template>

View File

@ -21,10 +21,10 @@
},
"devDependencies": {
"@swc/cli": "0.3.12",
"@swc/core": "1.5.5",
"@swc/types": "0.1.6",
"@swc/core": "1.5.7",
"@swc/types": "0.1.7",
"@types/jest": "29.5.12",
"@types/node": "20.12.11",
"@types/node": "20.12.12",
"jest": "29.7.0",
"jest-fetch-mock": "3.0.3",
"jest-websocket-mock": "2.5.0",

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,9 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:recommended"],
"rangeStrategy": "bump",
"branchConcurrentLimit": 0,
"prHourlyLimit": 20,
"prConcurrentLimit": 20,
"enabledManagers": ["npm", "cargo"],
"baseBranches": ["develop"],

View File

@ -15,7 +15,7 @@ await (async () => {
]);
const locales = (await import("../locales/index.mjs")).default;
const meta = (await import("../built/meta.json", { assert: { type: "json" } })).default;
const meta = JSON.parse(await fs.readFile(file("built/meta.json")));
for await (const [lang, locale] of Object.entries(locales)) {
await fs.writeFile(