Merge branch 'develop' into iceshrimp_mastodon

This commit is contained in:
naskya 2024-06-22 23:54:37 +09:00
commit c072f791aa
No known key found for this signature in database
GPG key ID: 712D413B3A9FED5C
19 changed files with 2738 additions and 1704 deletions

View file

@ -223,6 +223,31 @@ build:container:
- buildah inspect "${IMAGE_TAG}"
- buildah push "${IMAGE_TAG}"
cargo:check:msrv:
stage: test
image: docker.io/rust:1.74-slim-bookworm
rules:
- if: $TEST == 'true'
when: always
- if: $TEST == 'false'
when: never
- if: $CI_COMMIT_BRANCH == 'develop' || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == 'develop'
changes:
paths:
- packages/backend-rs/**/*
- packages/macro-rs/**/*
- Cargo.toml
- Cargo.lock
when: always
services: []
before_script:
- apt-get update && apt-get -y upgrade
- apt-get install -y --no-install-recommends build-essential clang mold python3 perl nodejs postgresql-client
- cp ci/cargo/config.toml /usr/local/cargo/config.toml
script:
- cargo fetch --locked --manifest-path Cargo.toml
- cargo check --locked --frozen --all-features
cargo:test:
stage: test
rules:
@ -237,7 +262,6 @@ cargo:test:
- packages/macro-rs/**/*
- Cargo.toml
- Cargo.lock
- package.json
when: always
script:
- curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C /usr/local/cargo/bin

118
Cargo.lock generated
View file

@ -92,7 +92,7 @@ checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.66",
"syn 2.0.67",
]
[[package]]
@ -143,7 +143,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.66",
"syn 2.0.67",
]
[[package]]
@ -154,7 +154,7 @@ checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.66",
"syn 2.0.67",
]
[[package]]
@ -207,7 +207,7 @@ dependencies = [
"chrono",
"cuid2",
"emojis",
"idna",
"idna 1.0.1",
"image",
"isahc",
"macros",
@ -380,9 +380,9 @@ checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
[[package]]
name = "bytemuck"
version = "1.16.0"
version = "1.16.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78834c15cb5d5efe3452d58b1e8ba890dd62d21907f867f383358198e56ebca5"
checksum = "b236fc92302c97ed75b38da1f4917b5cdda4984745740f153a5d3059e48d725e"
[[package]]
name = "byteorder"
@ -629,7 +629,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "edb49164822f3ee45b17acd4a208cfc1251410cf0cad9a833234c9890774dd9f"
dependencies = [
"quote",
"syn 2.0.66",
"syn 2.0.67",
]
[[package]]
@ -772,7 +772,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.66",
"syn 2.0.67",
]
[[package]]
@ -1388,14 +1388,24 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.66",
"syn 2.0.67",
]
[[package]]
name = "idna"
version = "1.0.0"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4716a3a0933a1d01c2f72450e89596eb51dd34ef3c211ccd875acdf1f8fe47ed"
checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6"
dependencies = [
"unicode-bidi",
"unicode-normalization",
]
[[package]]
name = "idna"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44a986806a1cc899952ba462bc1f28afbfd5850ab6cb030ccb20dd02cc527a24"
dependencies = [
"icu_normalizer",
"icu_properties",
@ -1457,7 +1467,7 @@ checksum = "0122b7114117e64a63ac49f752a5ca4624d534c7b1c7de796ac196381cd2d947"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.66",
"syn 2.0.67",
]
[[package]]
@ -1486,7 +1496,7 @@ checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.66",
"syn 2.0.67",
]
[[package]]
@ -1734,7 +1744,7 @@ dependencies = [
"convert_case",
"proc-macro2",
"quote",
"syn 2.0.66",
"syn 2.0.67",
]
[[package]]
@ -1759,9 +1769,9 @@ dependencies = [
[[package]]
name = "memchr"
version = "2.7.2"
version = "2.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d"
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
[[package]]
name = "mime"
@ -1777,9 +1787,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]]
name = "miniz_oxide"
version = "0.7.3"
version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae"
checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08"
dependencies = [
"adler",
"simd-adler32",
@ -1819,23 +1829,23 @@ checksum = "e1c0f5d67ee408a4685b61f5ab7e58605c8ae3f2b4189f0127d804ff13d5560a"
[[package]]
name = "napi-derive"
version = "2.16.5"
version = "3.0.0-alpha.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e0e034ddf6155192cf83f267ede763fe6c164dfa9971585436b16173718d94c4"
checksum = "c230c813bfd4d6c7aafead3c075b37f0cf7fecb38be8f4cf5cfcee0b2c273ad0"
dependencies = [
"cfg-if",
"convert_case",
"napi-derive-backend",
"proc-macro2",
"quote",
"syn 2.0.66",
"syn 2.0.67",
]
[[package]]
name = "napi-derive-backend"
version = "1.0.67"
version = "2.0.0-alpha.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bff2c00437f3b3266391eb5e6aa25d0029187daf5caf05b8e3271468fb5ae73e"
checksum = "4370cc24c2e58d0f3393527b282eb00f1158b304248f549e1ec81bd2927db5fe"
dependencies = [
"convert_case",
"once_cell",
@ -1843,7 +1853,7 @@ dependencies = [
"quote",
"regex",
"semver",
"syn 2.0.66",
"syn 2.0.67",
]
[[package]]
@ -1971,7 +1981,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.66",
"syn 2.0.67",
]
[[package]]
@ -2063,7 +2073,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.66",
"syn 2.0.67",
]
[[package]]
@ -2124,7 +2134,7 @@ dependencies = [
"proc-macro-error",
"proc-macro2",
"quote",
"syn 2.0.66",
"syn 2.0.67",
]
[[package]]
@ -2181,7 +2191,7 @@ checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8"
dependencies = [
"cfg-if",
"libc",
"redox_syscall 0.5.1",
"redox_syscall 0.5.2",
"smallvec",
"windows-targets 0.52.5",
]
@ -2282,7 +2292,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.66",
"syn 2.0.67",
]
[[package]]
@ -2432,9 +2442,9 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.85"
version = "1.0.86"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23"
checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77"
dependencies = [
"unicode-ident",
]
@ -2455,7 +2465,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8021cf59c8ec9c432cfc2526ac6b8aa508ecaf29cd415f271b8406c1b851c3fd"
dependencies = [
"quote",
"syn 2.0.66",
"syn 2.0.67",
]
[[package]]
@ -2603,9 +2613,9 @@ dependencies = [
[[package]]
name = "redox_syscall"
version = "0.5.1"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e"
checksum = "c82cf8cff14456045f55ec4241383baeff27af886adb72ffb2162f99911de0fd"
dependencies = [
"bitflags 2.5.0",
]
@ -2826,7 +2836,7 @@ dependencies = [
"proc-macro-error",
"proc-macro2",
"quote",
"syn 2.0.66",
"syn 2.0.67",
]
[[package]]
@ -2865,7 +2875,7 @@ dependencies = [
"proc-macro2",
"quote",
"sea-bae",
"syn 2.0.66",
"syn 2.0.67",
"unicode-ident",
]
@ -2942,7 +2952,7 @@ checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.66",
"syn 2.0.67",
]
[[package]]
@ -3382,9 +3392,9 @@ checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125"
[[package]]
name = "subtle"
version = "2.5.0"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc"
checksum = "0d0208408ba0c3df17ed26eb06992cb1a1268d41b2c0e12e65203fbe3972cee5"
[[package]]
name = "syn"
@ -3399,9 +3409,9 @@ dependencies = [
[[package]]
name = "syn"
version = "2.0.66"
version = "2.0.67"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5"
checksum = "ff8655ed1d86f3af4ee3fd3263786bc14245ad17c4c7e85ba7187fb3ae028c90"
dependencies = [
"proc-macro2",
"quote",
@ -3428,7 +3438,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.66",
"syn 2.0.67",
]
[[package]]
@ -3493,7 +3503,7 @@ checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.66",
"syn 2.0.67",
]
[[package]]
@ -3598,7 +3608,7 @@ checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.66",
"syn 2.0.67",
]
[[package]]
@ -3692,7 +3702,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.66",
"syn 2.0.67",
]
[[package]]
@ -3791,12 +3801,12 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
[[package]]
name = "url"
version = "2.5.1"
version = "2.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7c25da092f0a868cdf09e8674cd3b7ef3a7d92a24253e663a2fb85e2496de56"
checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c"
dependencies = [
"form_urlencoded",
"idna",
"idna 0.5.0",
"percent-encoding",
]
@ -3904,7 +3914,7 @@ dependencies = [
"once_cell",
"proc-macro2",
"quote",
"syn 2.0.66",
"syn 2.0.67",
"wasm-bindgen-shared",
]
@ -3926,7 +3936,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.66",
"syn 2.0.67",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
@ -4207,7 +4217,7 @@ checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.66",
"syn 2.0.67",
"synstructure 0.13.1",
]
@ -4228,7 +4238,7 @@ checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.66",
"syn 2.0.67",
]
[[package]]
@ -4248,7 +4258,7 @@ checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.66",
"syn 2.0.67",
"synstructure 0.13.1",
]
@ -4277,7 +4287,7 @@ checksum = "97cf56601ee5052b4417d90c8755c6683473c926039908196cf35d99f893ebe7"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.66",
"syn 2.0.67",
]
[[package]]

View file

@ -7,7 +7,7 @@ macros = { path = "packages/macro-rs/macros" }
macros-impl = { path = "packages/macro-rs/macros-impl" }
napi = { git = "https://github.com/napi-rs/napi-rs.git", rev = "ca2cd5c35a0c39ec4a94e93c6c5695b681046df2" }
napi-derive = "2.16.5"
napi-derive = "3.0.0-alpha.1"
napi-build = "2.1.3"
argon2 = { version = "0.5.3", default-features = false }
@ -19,14 +19,13 @@ chrono = { version = "0.4.38", default-features = false }
convert_case = { version = "0.6.0", default-features = false }
cuid2 = { version = "0.1.2", default-features = false }
emojis = { version = "0.6.2", default-features = false }
idna = { version = "1.0.0", default-features = false }
idna = { version = "1.0.1", default-features = false }
image = { version = "0.25.1", default-features = false }
isahc = { version = "1.7.2", default-features = false }
nom-exif = { version = "1.2.0", default-features = false }
once_cell = { version = "1.19.0", default-features = false }
openssl = "0.10.64"
pretty_assertions = { version = "1.4.0", default-features = false }
proc-macro2 = { version = "1.0.85", default-features = false }
proc-macro2 = { version = "1.0.86", default-features = false }
quote = { version = "1.0.36", default-features = false }
rand = { version = "0.8.5", default-features = false }
redis = { version = "0.25.4", default-features = false }
@ -36,16 +35,23 @@ sea-orm = { version = "0.12.15", default-features = false }
serde = { version = "1.0.203", default-features = false }
serde_json = { version = "1.0.117", default-features = false }
serde_yaml = { version = "0.9.34", default-features = false }
syn = { version = "2.0.66", default-features = false }
syn = { version = "2.0.67", default-features = false }
sysinfo = { version = "0.30.12", default-features = false }
thiserror = { version = "1.0.61", default-features = false }
tokio = { version = "1.38.0", default-features = false }
tokio-test = { version = "0.4.4", default-features = false }
tracing = { version = "0.1.40", default-features = false }
tracing-subscriber = { version = "0.3.18", default-features = false }
url = { version = "2.5.1", default-features = false }
url = { version = "2.5.2", default-features = false }
urlencoding = { version = "2.1.3", default-features = false }
web-push = { git = "https://github.com/pimeys/rust-web-push.git", rev = "40febe4085e3cef9cdfd539c315e3e945aba0656", default-features = false }
# subdependencies
## explicitly list OpenSSL to use the vendored version
openssl = "0.10.64"
## pin ravif and bitstream-io version because the latest one requires Rust 1.79
ravif = "=0.11.5"
bitstream-io = "=2.3.0"
[profile.release]
lto = true

View file

@ -395,7 +395,7 @@ _profile:
metadataLabel: Etiqueta
metadataContent: Contingut
changeAvatar: Canvia l'avatar
changeBanner: Canvia el banner
changeBanner: Canvia el bàner
locationDescription: Si primer introduïu la vostra ciutat, es mostrarà l'hora local
a altres usuaris.
name: Nom
@ -1114,7 +1114,7 @@ createAccount: Crea un compte
fontSize: Mida del text
noFollowRequests: No tens cap sol·licitud de seguiment per aprovar
openImageInNewTab: Obre les imatges a una pestanya nova
dashboard: Tauler
dashboard: Taulell
local: Local
remote: Remot
total: Total
@ -1551,7 +1551,7 @@ itsOn: Activat
itsOff: Desactivat
emailRequiredForSignup: Requereix una adreça de correu electrònic per registrar-te
unread: Sense llegir
controlPanel: Tauler de control
controlPanel: Taulell de control
manageAccounts: Gestionar comptes
makeReactionsPublic: Estableix l'historial de reaccions com a públic
classic: Centrat

View file

@ -2283,7 +2283,7 @@ searchPostsWithFiles: Nur Beiträge mit Dateien
noAltTextWarning: Einige der angehängten Dateien haben keine Beschreibung. Haben Sie
vergessen, diese zu schreiben?
toReply: Antworten
toPost: Beitrag teilen
toPost: Teilen
sentFollowRequests: Gesendete Follow-Anfragen
replyMute: Antworten in Timelines stummschalten
replyUnmute: Stummschaltung von Antworten in Timelines aufheben

View file

@ -5,7 +5,7 @@
"type": "git",
"url": "https://firefish.dev/firefish/firefish.git"
},
"packageManager": "pnpm@9.3.0",
"packageManager": "pnpm@9.4.0",
"private": true,
"scripts": {
"rebuild": "pnpm run clean && pnpm run build",
@ -42,14 +42,14 @@
"js-yaml": "4.1.0"
},
"devDependencies": {
"@biomejs/biome": "1.8.1",
"@biomejs/cli-darwin-arm64": "1.8.1",
"@biomejs/cli-darwin-x64": "1.8.1",
"@biomejs/cli-linux-arm64": "1.8.1",
"@biomejs/cli-linux-x64": "1.8.1",
"@types/node": "20.14.2",
"execa": "9.2.0",
"pnpm": "9.3.0",
"typescript": "5.4.5"
"@biomejs/biome": "1.8.2",
"@biomejs/cli-darwin-arm64": "1.8.2",
"@biomejs/cli-darwin-x64": "1.8.2",
"@biomejs/cli-linux-arm64": "1.8.2",
"@biomejs/cli-linux-x64": "1.8.2",
"@types/node": "20.14.8",
"execa": "9.3.0",
"pnpm": "9.4.0",
"typescript": "5.5.2"
}
}

View file

@ -32,4 +32,3 @@ index.js index.d.ts: $(SRC)
rm --force index.js index.d.ts
cp built/index.js index.js
cp built/index.d.ts index.d.ts
sed -i 's/^ \*r"/ */g' index.d.ts

File diff suppressed because it is too large Load diff

View file

@ -1,404 +1,453 @@
/* tslint:disable */
// prettier-ignore
/* eslint-disable */
/* prettier-ignore */
/* auto-generated by NAPI-RS */
const { existsSync, readFileSync } = require('fs')
const { join } = require('path')
const { platform, arch } = process
const { readFileSync } = require('fs')
let nativeBinding = null
let localFileExisted = false
let loadError = null
const loadErrors = []
function isMusl() {
// For Node 10
if (!process.report || typeof process.report.getReport !== 'function') {
try {
const lddPath = require('child_process').execSync('which ldd').toString().trim()
return readFileSync(lddPath, 'utf8').includes('musl')
} catch (e) {
return true
const isMusl = () => {
let musl = false
if (process.platform === 'linux') {
musl = isMuslFromFilesystem()
if (musl === null) {
musl = isMuslFromReport()
}
} else {
const { glibcVersionRuntime } = process.report.getReport().header
return !glibcVersionRuntime
if (musl === null) {
musl = isMuslFromChildProcess()
}
}
return musl
}
const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-')
const isMuslFromFilesystem = () => {
try {
return readFileSync('/usr/bin/ldd', 'utf-8').includes('musl')
} catch {
return null
}
}
switch (platform) {
case 'android':
switch (arch) {
case 'arm64':
localFileExisted = existsSync(join(__dirname, 'backend-rs.android-arm64.node'))
try {
if (localFileExisted) {
nativeBinding = require('./backend-rs.android-arm64.node')
} else {
nativeBinding = require('backend-rs-android-arm64')
}
} catch (e) {
loadError = e
}
break
case 'arm':
localFileExisted = existsSync(join(__dirname, 'backend-rs.android-arm-eabi.node'))
try {
if (localFileExisted) {
nativeBinding = require('./backend-rs.android-arm-eabi.node')
} else {
nativeBinding = require('backend-rs-android-arm-eabi')
}
} catch (e) {
loadError = e
}
break
default:
throw new Error(`Unsupported architecture on Android ${arch}`)
const isMuslFromReport = () => {
const report = typeof process.report.getReport === 'function' ? process.report.getReport() : null
if (!report) {
return null
}
if (report.header && report.header.glibcVersionRuntime) {
return false
}
if (Array.isArray(report.sharedObjects)) {
if (report.sharedObjects.some(isFileMusl)) {
return true
}
break
case 'win32':
switch (arch) {
case 'x64':
localFileExisted = existsSync(
join(__dirname, 'backend-rs.win32-x64-msvc.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./backend-rs.win32-x64-msvc.node')
} else {
nativeBinding = require('backend-rs-win32-x64-msvc')
}
} catch (e) {
loadError = e
}
break
case 'ia32':
localFileExisted = existsSync(
join(__dirname, 'backend-rs.win32-ia32-msvc.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./backend-rs.win32-ia32-msvc.node')
} else {
nativeBinding = require('backend-rs-win32-ia32-msvc')
}
} catch (e) {
loadError = e
}
break
case 'arm64':
localFileExisted = existsSync(
join(__dirname, 'backend-rs.win32-arm64-msvc.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./backend-rs.win32-arm64-msvc.node')
} else {
nativeBinding = require('backend-rs-win32-arm64-msvc')
}
} catch (e) {
loadError = e
}
break
default:
throw new Error(`Unsupported architecture on Windows: ${arch}`)
}
break
case 'darwin':
localFileExisted = existsSync(join(__dirname, 'backend-rs.darwin-universal.node'))
try {
if (localFileExisted) {
nativeBinding = require('./backend-rs.darwin-universal.node')
} else {
nativeBinding = require('backend-rs-darwin-universal')
}
return false
}
const isMuslFromChildProcess = () => {
try {
return require('child_process').execSync('ldd --version', { encoding: 'utf8' }).includes('musl')
} catch (e) {
// If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false
return false
}
}
function requireNative() {
if (process.platform === 'android') {
if (process.arch === 'arm64') {
try {
return require('./backend-rs.android-arm64.node')
} catch (e) {
loadErrors.push(e)
}
break
} catch {}
switch (arch) {
case 'x64':
localFileExisted = existsSync(join(__dirname, 'backend-rs.darwin-x64.node'))
try {
if (localFileExisted) {
nativeBinding = require('./backend-rs.darwin-x64.node')
} else {
nativeBinding = require('backend-rs-darwin-x64')
}
} catch (e) {
loadError = e
}
break
case 'arm64':
localFileExisted = existsSync(
join(__dirname, 'backend-rs.darwin-arm64.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./backend-rs.darwin-arm64.node')
} else {
nativeBinding = require('backend-rs-darwin-arm64')
}
} catch (e) {
loadError = e
}
break
default:
throw new Error(`Unsupported architecture on macOS: ${arch}`)
}
break
case 'freebsd':
if (arch !== 'x64') {
throw new Error(`Unsupported architecture on FreeBSD: ${arch}`)
}
localFileExisted = existsSync(join(__dirname, 'backend-rs.freebsd-x64.node'))
try {
if (localFileExisted) {
nativeBinding = require('./backend-rs.freebsd-x64.node')
} else {
nativeBinding = require('backend-rs-freebsd-x64')
try {
return require('backend-rs-android-arm64')
} catch (e) {
loadErrors.push(e)
}
} catch (e) {
loadError = e
} else if (process.arch === 'arm') {
try {
return require('./backend-rs.android-arm-eabi.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('backend-rs-android-arm-eabi')
} catch (e) {
loadErrors.push(e)
}
} else {
loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`))
}
break
case 'linux':
switch (arch) {
case 'x64':
if (isMusl()) {
localFileExisted = existsSync(
join(__dirname, 'backend-rs.linux-x64-musl.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./backend-rs.linux-x64-musl.node')
} else {
nativeBinding = require('backend-rs-linux-x64-musl')
}
} catch (e) {
loadError = e
}
} else {
localFileExisted = existsSync(
join(__dirname, 'backend-rs.linux-x64-gnu.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./backend-rs.linux-x64-gnu.node')
} else {
nativeBinding = require('backend-rs-linux-x64-gnu')
}
} catch (e) {
loadError = e
}
}
break
case 'arm64':
if (isMusl()) {
localFileExisted = existsSync(
join(__dirname, 'backend-rs.linux-arm64-musl.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./backend-rs.linux-arm64-musl.node')
} else {
nativeBinding = require('backend-rs-linux-arm64-musl')
}
} catch (e) {
loadError = e
}
} else {
localFileExisted = existsSync(
join(__dirname, 'backend-rs.linux-arm64-gnu.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./backend-rs.linux-arm64-gnu.node')
} else {
nativeBinding = require('backend-rs-linux-arm64-gnu')
}
} catch (e) {
loadError = e
}
}
break
case 'arm':
if (isMusl()) {
localFileExisted = existsSync(
join(__dirname, 'backend-rs.linux-arm-musleabihf.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./backend-rs.linux-arm-musleabihf.node')
} else {
nativeBinding = require('backend-rs-linux-arm-musleabihf')
}
} catch (e) {
loadError = e
}
} else {
localFileExisted = existsSync(
join(__dirname, 'backend-rs.linux-arm-gnueabihf.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./backend-rs.linux-arm-gnueabihf.node')
} else {
nativeBinding = require('backend-rs-linux-arm-gnueabihf')
}
} catch (e) {
loadError = e
}
}
break
case 'riscv64':
if (isMusl()) {
localFileExisted = existsSync(
join(__dirname, 'backend-rs.linux-riscv64-musl.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./backend-rs.linux-riscv64-musl.node')
} else {
nativeBinding = require('backend-rs-linux-riscv64-musl')
}
} catch (e) {
loadError = e
}
} else {
localFileExisted = existsSync(
join(__dirname, 'backend-rs.linux-riscv64-gnu.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./backend-rs.linux-riscv64-gnu.node')
} else {
nativeBinding = require('backend-rs-linux-riscv64-gnu')
}
} catch (e) {
loadError = e
}
}
break
case 's390x':
localFileExisted = existsSync(
join(__dirname, 'backend-rs.linux-s390x-gnu.node')
)
} else if (process.platform === 'win32') {
if (process.arch === 'x64') {
try {
return require('./backend-rs.win32-x64-msvc.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('backend-rs-win32-x64-msvc')
} catch (e) {
loadErrors.push(e)
}
} else if (process.arch === 'ia32') {
try {
return require('./backend-rs.win32-ia32-msvc.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('backend-rs-win32-ia32-msvc')
} catch (e) {
loadErrors.push(e)
}
} else if (process.arch === 'arm64') {
try {
return require('./backend-rs.win32-arm64-msvc.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('backend-rs-win32-arm64-msvc')
} catch (e) {
loadErrors.push(e)
}
} else {
loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`))
}
} else if (process.platform === 'darwin') {
try {
return require('./backend-rs.darwin-universal.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('backend-rs-darwin-universal')
} catch (e) {
loadErrors.push(e)
}
if (process.arch === 'x64') {
try {
return require('./backend-rs.darwin-x64.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('backend-rs-darwin-x64')
} catch (e) {
loadErrors.push(e)
}
} else if (process.arch === 'arm64') {
try {
return require('./backend-rs.darwin-arm64.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('backend-rs-darwin-arm64')
} catch (e) {
loadErrors.push(e)
}
} else {
loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`))
}
} else if (process.platform === 'freebsd') {
if (process.arch === 'x64') {
try {
return require('./backend-rs.freebsd-x64.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('backend-rs-freebsd-x64')
} catch (e) {
loadErrors.push(e)
}
} else if (process.arch === 'arm64') {
try {
return require('./backend-rs.freebsd-arm64.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('backend-rs-freebsd-arm64')
} catch (e) {
loadErrors.push(e)
}
} else {
loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`))
}
} else if (process.platform === 'linux') {
if (process.arch === 'x64') {
if (isMusl()) {
try {
if (localFileExisted) {
nativeBinding = require('./backend-rs.linux-s390x-gnu.node')
} else {
nativeBinding = require('backend-rs-linux-s390x-gnu')
}
} catch (e) {
loadError = e
}
break
default:
throw new Error(`Unsupported architecture on Linux: ${arch}`)
return require('./backend-rs.linux-x64-musl.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('backend-rs-linux-x64-musl')
} catch (e) {
loadErrors.push(e)
}
} else {
try {
return require('./backend-rs.linux-x64-gnu.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('backend-rs-linux-x64-gnu')
} catch (e) {
loadErrors.push(e)
}
}
} else if (process.arch === 'arm64') {
if (isMusl()) {
try {
return require('./backend-rs.linux-arm64-musl.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('backend-rs-linux-arm64-musl')
} catch (e) {
loadErrors.push(e)
}
} else {
try {
return require('./backend-rs.linux-arm64-gnu.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('backend-rs-linux-arm64-gnu')
} catch (e) {
loadErrors.push(e)
}
}
} else if (process.arch === 'arm') {
if (isMusl()) {
try {
return require('./backend-rs.linux-arm-musleabihf.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('backend-rs-linux-arm-musleabihf')
} catch (e) {
loadErrors.push(e)
}
} else {
try {
return require('./backend-rs.linux-arm-gnueabihf.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('backend-rs-linux-arm-gnueabihf')
} catch (e) {
loadErrors.push(e)
}
}
} else if (process.arch === 'riscv64') {
if (isMusl()) {
try {
return require('./backend-rs.linux-riscv64-musl.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('backend-rs-linux-riscv64-musl')
} catch (e) {
loadErrors.push(e)
}
} else {
try {
return require('./backend-rs.linux-riscv64-gnu.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('backend-rs-linux-riscv64-gnu')
} catch (e) {
loadErrors.push(e)
}
}
} else if (process.arch === 'ppc64') {
try {
return require('./backend-rs.linux-ppc64-gnu.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('backend-rs-linux-ppc64-gnu')
} catch (e) {
loadErrors.push(e)
}
} else if (process.arch === 's390x') {
try {
return require('./backend-rs.linux-s390x-gnu.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('backend-rs-linux-s390x-gnu')
} catch (e) {
loadErrors.push(e)
}
} else {
loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
}
break
default:
throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
} else {
loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`))
}
}
nativeBinding = requireNative()
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
try {
nativeBinding = require('./backend-rs.wasi.cjs')
} catch (err) {
if (process.env.NAPI_RS_FORCE_WASI) {
console.error(err)
}
}
if (!nativeBinding) {
try {
nativeBinding = require('backend-rs-wasm32-wasi')
} catch (err) {
if (process.env.NAPI_RS_FORCE_WASI) {
console.error(err)
}
}
}
}
if (!nativeBinding) {
if (loadError) {
throw loadError
if (loadErrors.length > 0) {
// TODO Link to documentation with potential fixes
// - The package owner could build/publish bindings for this arch
// - The user may need to bundle the correct files
// - The user may need to re-install node_modules to get new packages
throw new Error('Failed to load native binding', { cause: loadErrors })
}
throw new Error(`Failed to load native binding`)
}
const { SECOND, MINUTE, HOUR, DAY, USER_ONLINE_THRESHOLD, USER_ACTIVE_THRESHOLD, FILE_TYPE_BROWSERSAFE, fetchMeta, updateMetaCache, metaToPugArgs, loadConfig, stringToAcct, acctToString, fetchNodeinfo, nodeinfo_2_1, nodeinfo_2_0, updateNodeinfoCache, Protocol, Inbound, Outbound, greet, initializeRustLogger, showServerInfo, isBlockedServer, isSilencedServer, isAllowedServer, checkWordMute, getFullApAccount, isSelfHost, isSameOrigin, extractHost, toPuny, isUnicodeEmoji, sqlLikeEscape, sqlRegexEscape, safeForSql, formatMilliseconds, getImageSizeFromUrl, isQuote, isSafeUrl, latestVersion, getNoteSummary, nyaify, hashPassword, verifyPassword, isOldPasswordAlgorithm, decodeReaction, countReactions, toDbReaction, removeOldAttestationChallenges, cpuInfo, cpuUsage, memoryUsage, storageUsage, AntennaSrc, DriveFileUsageHint, MutedNoteReason, NoteVisibility, NotificationType, PageVisibility, PollNoteVisibility, PushSubscriptionType, RelayStatus, UserEmojiModPerm, UserProfileFfvisibility, UserProfileMutingNotificationTypes, updateAntennasOnNewNote, updateAntennaCache, watchNote, unwatchNote, PushNotificationKind, sendPushNotification, publishToChannelStream, publishToChatStream, ChatIndexEvent, publishToChatIndexStream, publishToBroadcastStream, DriveFileEvent, DriveFolderEvent, publishToDriveFileStream, publishToDriveFolderStream, publishToGroupChatStream, publishToModerationStream, publishToNotesStream, ChatEvent, getTimestamp, genId, genIdAt, generateSecureRandomString, generateUserToken } = nativeBinding
module.exports.SECOND = SECOND
module.exports.MINUTE = MINUTE
module.exports.HOUR = HOUR
module.exports.DAY = DAY
module.exports.USER_ONLINE_THRESHOLD = USER_ONLINE_THRESHOLD
module.exports.USER_ACTIVE_THRESHOLD = USER_ACTIVE_THRESHOLD
module.exports.FILE_TYPE_BROWSERSAFE = FILE_TYPE_BROWSERSAFE
module.exports.fetchMeta = fetchMeta
module.exports.updateMetaCache = updateMetaCache
module.exports.metaToPugArgs = metaToPugArgs
module.exports.loadConfig = loadConfig
module.exports.stringToAcct = stringToAcct
module.exports.acctToString = acctToString
module.exports.fetchNodeinfo = fetchNodeinfo
module.exports.nodeinfo_2_1 = nodeinfo_2_1
module.exports.nodeinfo_2_0 = nodeinfo_2_0
module.exports.updateNodeinfoCache = updateNodeinfoCache
module.exports.Protocol = Protocol
module.exports.Inbound = Inbound
module.exports.Outbound = Outbound
module.exports.greet = greet
module.exports.initializeRustLogger = initializeRustLogger
module.exports.showServerInfo = showServerInfo
module.exports.isBlockedServer = isBlockedServer
module.exports.isSilencedServer = isSilencedServer
module.exports.isAllowedServer = isAllowedServer
module.exports.checkWordMute = checkWordMute
module.exports.getFullApAccount = getFullApAccount
module.exports.isSelfHost = isSelfHost
module.exports.isSameOrigin = isSameOrigin
module.exports.extractHost = extractHost
module.exports.toPuny = toPuny
module.exports.isUnicodeEmoji = isUnicodeEmoji
module.exports.sqlLikeEscape = sqlLikeEscape
module.exports.sqlRegexEscape = sqlRegexEscape
module.exports.safeForSql = safeForSql
module.exports.formatMilliseconds = formatMilliseconds
module.exports.getImageSizeFromUrl = getImageSizeFromUrl
module.exports.isQuote = isQuote
module.exports.isSafeUrl = isSafeUrl
module.exports.latestVersion = latestVersion
module.exports.getNoteSummary = getNoteSummary
module.exports.nyaify = nyaify
module.exports.hashPassword = hashPassword
module.exports.verifyPassword = verifyPassword
module.exports.isOldPasswordAlgorithm = isOldPasswordAlgorithm
module.exports.decodeReaction = decodeReaction
module.exports.countReactions = countReactions
module.exports.toDbReaction = toDbReaction
module.exports.removeOldAttestationChallenges = removeOldAttestationChallenges
module.exports.cpuInfo = cpuInfo
module.exports.cpuUsage = cpuUsage
module.exports.memoryUsage = memoryUsage
module.exports.storageUsage = storageUsage
module.exports.AntennaSrc = AntennaSrc
module.exports.DriveFileUsageHint = DriveFileUsageHint
module.exports.MutedNoteReason = MutedNoteReason
module.exports.NoteVisibility = NoteVisibility
module.exports.NotificationType = NotificationType
module.exports.PageVisibility = PageVisibility
module.exports.PollNoteVisibility = PollNoteVisibility
module.exports.PushSubscriptionType = PushSubscriptionType
module.exports.RelayStatus = RelayStatus
module.exports.UserEmojiModPerm = UserEmojiModPerm
module.exports.UserProfileFfvisibility = UserProfileFfvisibility
module.exports.UserProfileMutingNotificationTypes = UserProfileMutingNotificationTypes
module.exports.updateAntennasOnNewNote = updateAntennasOnNewNote
module.exports.updateAntennaCache = updateAntennaCache
module.exports.watchNote = watchNote
module.exports.unwatchNote = unwatchNote
module.exports.PushNotificationKind = PushNotificationKind
module.exports.sendPushNotification = sendPushNotification
module.exports.publishToChannelStream = publishToChannelStream
module.exports.publishToChatStream = publishToChatStream
module.exports.ChatIndexEvent = ChatIndexEvent
module.exports.publishToChatIndexStream = publishToChatIndexStream
module.exports.publishToBroadcastStream = publishToBroadcastStream
module.exports.DriveFileEvent = DriveFileEvent
module.exports.DriveFolderEvent = DriveFolderEvent
module.exports.publishToDriveFileStream = publishToDriveFileStream
module.exports.publishToDriveFolderStream = publishToDriveFolderStream
module.exports.publishToGroupChatStream = publishToGroupChatStream
module.exports.publishToModerationStream = publishToModerationStream
module.exports.publishToNotesStream = publishToNotesStream
module.exports.ChatEvent = ChatEvent
module.exports.getTimestamp = getTimestamp
module.exports.genId = genId
module.exports.genIdAt = genIdAt
module.exports.generateSecureRandomString = generateSecureRandomString
module.exports.generateUserToken = generateUserToken
module.exports.acctToString = nativeBinding.acctToString
module.exports.AntennaSrc = nativeBinding.AntennaSrc
module.exports.ChatEvent = nativeBinding.ChatEvent
module.exports.ChatIndexEvent = nativeBinding.ChatIndexEvent
module.exports.checkWordMute = nativeBinding.checkWordMute
module.exports.countReactions = nativeBinding.countReactions
module.exports.cpuInfo = nativeBinding.cpuInfo
module.exports.cpuUsage = nativeBinding.cpuUsage
module.exports.DAY = nativeBinding.DAY
module.exports.decodeReaction = nativeBinding.decodeReaction
module.exports.DriveFileEvent = nativeBinding.DriveFileEvent
module.exports.DriveFileUsageHint = nativeBinding.DriveFileUsageHint
module.exports.DriveFolderEvent = nativeBinding.DriveFolderEvent
module.exports.extractHost = nativeBinding.extractHost
module.exports.fetchMeta = nativeBinding.fetchMeta
module.exports.fetchNodeinfo = nativeBinding.fetchNodeinfo
module.exports.FILE_TYPE_BROWSERSAFE = nativeBinding.FILE_TYPE_BROWSERSAFE
module.exports.formatMilliseconds = nativeBinding.formatMilliseconds
module.exports.generateSecureRandomString = nativeBinding.generateSecureRandomString
module.exports.generateUserToken = nativeBinding.generateUserToken
module.exports.genId = nativeBinding.genId
module.exports.genIdAt = nativeBinding.genIdAt
module.exports.getFullApAccount = nativeBinding.getFullApAccount
module.exports.getImageSizeFromUrl = nativeBinding.getImageSizeFromUrl
module.exports.getNoteSummary = nativeBinding.getNoteSummary
module.exports.getTimestamp = nativeBinding.getTimestamp
module.exports.greet = nativeBinding.greet
module.exports.hashPassword = nativeBinding.hashPassword
module.exports.HOUR = nativeBinding.HOUR
module.exports.Inbound = nativeBinding.Inbound
module.exports.initializeRustLogger = nativeBinding.initializeRustLogger
module.exports.isAllowedServer = nativeBinding.isAllowedServer
module.exports.isBlockedServer = nativeBinding.isBlockedServer
module.exports.isOldPasswordAlgorithm = nativeBinding.isOldPasswordAlgorithm
module.exports.isQuote = nativeBinding.isQuote
module.exports.isSafeUrl = nativeBinding.isSafeUrl
module.exports.isSameOrigin = nativeBinding.isSameOrigin
module.exports.isSelfHost = nativeBinding.isSelfHost
module.exports.isSilencedServer = nativeBinding.isSilencedServer
module.exports.isUnicodeEmoji = nativeBinding.isUnicodeEmoji
module.exports.latestVersion = nativeBinding.latestVersion
module.exports.loadConfig = nativeBinding.loadConfig
module.exports.memoryUsage = nativeBinding.memoryUsage
module.exports.metaToPugArgs = nativeBinding.metaToPugArgs
module.exports.MINUTE = nativeBinding.MINUTE
module.exports.MutedNoteReason = nativeBinding.MutedNoteReason
module.exports.nodeinfo_2_0 = nativeBinding.nodeinfo_2_0
module.exports.nodeinfo_2_1 = nativeBinding.nodeinfo_2_1
module.exports.NoteVisibility = nativeBinding.NoteVisibility
module.exports.NotificationType = nativeBinding.NotificationType
module.exports.nyaify = nativeBinding.nyaify
module.exports.Outbound = nativeBinding.Outbound
module.exports.PageVisibility = nativeBinding.PageVisibility
module.exports.PollNoteVisibility = nativeBinding.PollNoteVisibility
module.exports.Protocol = nativeBinding.Protocol
module.exports.publishToBroadcastStream = nativeBinding.publishToBroadcastStream
module.exports.publishToChannelStream = nativeBinding.publishToChannelStream
module.exports.publishToChatIndexStream = nativeBinding.publishToChatIndexStream
module.exports.publishToChatStream = nativeBinding.publishToChatStream
module.exports.publishToDriveFileStream = nativeBinding.publishToDriveFileStream
module.exports.publishToDriveFolderStream = nativeBinding.publishToDriveFolderStream
module.exports.publishToGroupChatStream = nativeBinding.publishToGroupChatStream
module.exports.publishToModerationStream = nativeBinding.publishToModerationStream
module.exports.publishToNotesStream = nativeBinding.publishToNotesStream
module.exports.PushNotificationKind = nativeBinding.PushNotificationKind
module.exports.PushSubscriptionType = nativeBinding.PushSubscriptionType
module.exports.RelayStatus = nativeBinding.RelayStatus
module.exports.removeOldAttestationChallenges = nativeBinding.removeOldAttestationChallenges
module.exports.safeForSql = nativeBinding.safeForSql
module.exports.SECOND = nativeBinding.SECOND
module.exports.sendPushNotification = nativeBinding.sendPushNotification
module.exports.showServerInfo = nativeBinding.showServerInfo
module.exports.sqlLikeEscape = nativeBinding.sqlLikeEscape
module.exports.sqlRegexEscape = nativeBinding.sqlRegexEscape
module.exports.storageUsage = nativeBinding.storageUsage
module.exports.stringToAcct = nativeBinding.stringToAcct
module.exports.toDbReaction = nativeBinding.toDbReaction
module.exports.toPuny = nativeBinding.toPuny
module.exports.unwatchNote = nativeBinding.unwatchNote
module.exports.updateAntennaCache = nativeBinding.updateAntennaCache
module.exports.updateAntennasOnNewNote = nativeBinding.updateAntennasOnNewNote
module.exports.updateMetaCache = nativeBinding.updateMetaCache
module.exports.updateNodeinfoCache = nativeBinding.updateNodeinfoCache
module.exports.USER_ACTIVE_THRESHOLD = nativeBinding.USER_ACTIVE_THRESHOLD
module.exports.USER_ONLINE_THRESHOLD = nativeBinding.USER_ONLINE_THRESHOLD
module.exports.UserEmojiModPerm = nativeBinding.UserEmojiModPerm
module.exports.UserProfileFfvisibility = nativeBinding.UserProfileFfvisibility
module.exports.UserProfileMutingNotificationTypes = nativeBinding.UserProfileMutingNotificationTypes
module.exports.verifyPassword = nativeBinding.verifyPassword
module.exports.watchNote = nativeBinding.watchNote

View file

@ -4,30 +4,29 @@
"main": "built/index.js",
"types": "built/index.d.ts",
"napi": {
"name": "backend-rs",
"triples": {
"additional": [
"aarch64-apple-darwin",
"aarch64-linux-android",
"aarch64-unknown-linux-gnu",
"aarch64-unknown-linux-musl",
"aarch64-pc-windows-msvc",
"armv7-unknown-linux-gnueabihf",
"x86_64-unknown-linux-musl",
"x86_64-unknown-freebsd",
"i686-pc-windows-msvc",
"armv7-linux-androideabi",
"universal-apple-darwin"
]
}
"binaryName": "backend-rs",
"targets": [
"aarch64-apple-darwin",
"aarch64-linux-android",
"aarch64-unknown-linux-gnu",
"aarch64-unknown-linux-musl",
"aarch64-pc-windows-msvc",
"armv7-unknown-linux-gnueabihf",
"x86_64-unknown-linux-gnu",
"x86_64-unknown-linux-musl",
"x86_64-unknown-freebsd",
"i686-pc-windows-msvc",
"armv7-linux-androideabi",
"universal-apple-darwin"
]
},
"devDependencies": {
"@napi-rs/cli": "2.18.3"
"@napi-rs/cli": "3.0.0-alpha.55"
},
"scripts": {
"artifacts": "napi artifacts",
"build": "napi build --features napi --no-const-enum --platform --release ./built/",
"build:debug": "napi build --features napi --no-const-enum --platform ./built/",
"build": "RUSTFLAGS='-C target-cpu=native' napi build --features napi --no-const-enum --platform --release --output-dir ./built/",
"build:debug": "napi build --features napi --no-const-enum --platform --output-dir ./built/",
"prepublishOnly": "napi prepublish -t npm",
"universal": "napi universal",
"version": "napi version"

View file

@ -100,7 +100,6 @@ async fn generate_nodeinfo_2_1() -> Result<Nodeinfo21, DbErr> {
metadata.shrink_to_fit();
Ok(Nodeinfo21 {
version: "2.1".to_string(),
software: Software21 {
name: "firefish".to_string(),
version: CONFIG.version.clone(),

View file

@ -5,17 +5,12 @@
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
// TODO: I want to use these macros but they don't work with rmp_serde
// * #[serde(skip_serializing_if = "Option::is_none")] (https://github.com/3Hren/msgpack-rust/issues/86)
// * #[serde(tag = "version", rename = "2.1")] (https://github.com/3Hren/msgpack-rust/issues/318)
/// NodeInfo schema version 2.1. <https://nodeinfo.diaspora.software/docson/index.html#/ns/schema/2.1>
#[cfg_attr(test, derive(Debug, PartialEq, Deserialize))]
#[derive(Clone, Serialize)]
#[serde(rename_all = "camelCase")]
#[serde(tag = "version", rename = "2.1")]
pub struct Nodeinfo21 {
/// The schema version, must be 2.1.
pub version: String,
/// Metadata about server software in use.
pub software: Software21,
/// The protocols supported on this server.
@ -35,9 +30,8 @@ pub struct Nodeinfo21 {
#[derive(Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
#[macros::export(object, js_name = "Nodeinfo")]
#[serde(tag = "version", rename = "2.0")]
pub struct Nodeinfo20 {
/// The schema version, must be 2.0.
pub version: String,
/// Metadata about server software in use.
pub software: Software20,
/// The protocols supported on this server.
@ -62,8 +56,10 @@ pub struct Software21 {
/// The version of this server software.
pub version: String,
/// The url of the source code repository of this server software.
#[serde(skip_serializing_if = "Option::is_none")]
pub repository: Option<String>,
/// The url of the homepage of this server software.
#[serde(skip_serializing_if = "Option::is_none")]
pub homepage: Option<String>,
}
@ -172,7 +168,9 @@ pub enum Outbound {
#[macros::export(object)]
pub struct Usage {
pub users: Users,
#[serde(skip_serializing_if = "Option::is_none")]
pub local_posts: Option<u32>,
#[serde(skip_serializing_if = "Option::is_none")]
pub local_comments: Option<u32>,
}
@ -182,8 +180,11 @@ pub struct Usage {
#[serde(rename_all = "camelCase")]
#[macros::export(object)]
pub struct Users {
#[serde(skip_serializing_if = "Option::is_none")]
pub total: Option<u32>,
#[serde(skip_serializing_if = "Option::is_none")]
pub active_halfyear: Option<u32>,
#[serde(skip_serializing_if = "Option::is_none")]
pub active_month: Option<u32>,
}
@ -199,7 +200,6 @@ impl From<Software21> for Software20 {
impl From<Nodeinfo21> for Nodeinfo20 {
fn from(nodeinfo: Nodeinfo21) -> Self {
Self {
version: "2.0".to_string(),
software: nodeinfo.software.into(),
protocols: nodeinfo.protocols,
services: nodeinfo.services,

View file

@ -31,18 +31,18 @@
"@koa/router": "12.0.1",
"@ladjs/koa-views": "9.0.0",
"@peertube/http-signature": "1.7.0",
"@redocly/openapi-core": "1.15.0",
"@redocly/openapi-core": "1.16.0",
"@sinonjs/fake-timers": "11.2.2",
"adm-zip": "0.5.14",
"ajv": "8.16.0",
"archiver": "7.0.1",
"async-lock": "1.4.0",
"async-mutex": "0.5.0",
"aws-sdk": "2.1642.0",
"aws-sdk": "2.1646.0",
"axios": "1.7.2",
"backend-rs": "workspace:*",
"blurhash": "2.0.5",
"bull": "4.13.0",
"bull": "4.13.1",
"cacheable-lookup": "git+https://github.com/TheEssem/cacheable-lookup.git#dd2fb616366a3c68dcf321a57a67295967b204bf",
"cbor-x": "1.5.9",
"chalk": "5.3.0",
@ -85,7 +85,7 @@
"multer": "1.4.5-lts.1",
"nested-property": "4.0.0",
"node-fetch": "3.3.2",
"nodemailer": "6.9.13",
"nodemailer": "6.9.14",
"opencc-js": "1.0.5",
"otpauth": "9.3.1",
"parse5": "7.1.2",
@ -122,8 +122,8 @@
"xev": "3.0.2"
},
"devDependencies": {
"@swc/cli": "0.3.12",
"@swc/core": "1.6.1",
"@swc/cli": "0.3.14",
"@swc/core": "1.6.5",
"@types/adm-zip": "0.5.5",
"@types/async-lock": "1.4.0",
"@types/color-convert": "2.0.3",
@ -144,8 +144,8 @@
"@types/koa__cors": "5.0.0",
"@types/koa__multer": "2.0.7",
"@types/koa__router": "12.0.4",
"@types/mocha": "10.0.6",
"@types/node": "20.14.2",
"@types/mocha": "10.0.7",
"@types/node": "20.14.8",
"@types/node-fetch": "2.6.11",
"@types/nodemailer": "6.4.15",
"@types/oauth": "0.9.5",
@ -165,7 +165,7 @@
"@types/syslog-pro": "1.0.3",
"@types/tinycolor2": "1.4.6",
"@types/tmp": "0.2.6",
"@types/uuid": "9.0.8",
"@types/uuid": "10.0.0",
"@types/websocket": "1.0.10",
"@types/ws": "8.5.10",
"cross-env": "7.0.3",
@ -178,8 +178,8 @@
"ts-node": "10.9.2",
"tsconfig-paths": "4.2.0",
"type-fest": "4.20.1",
"typescript": "5.4.5",
"webpack": "5.92.0",
"typescript": "5.5.2",
"webpack": "5.92.1",
"ws": "8.17.1"
}
}

View file

@ -87,14 +87,20 @@ export const paramDef = {
export default define(meta, paramDef, async (ps, me) => {
let user;
const isAdminOrModerator = me && (me.isAdmin || me.isModerator);
const isAdminOrModerator = me != null && (me.isAdmin || me.isModerator);
if (ps.userIds) {
if (ps.userIds.length === 0) {
return [];
}
const isUrl = ps.userIds[0].startsWith("http");
let isUrl = false;
try {
const url = new URL(ps.userIds[0]);
isUrl = ["http", "https"].includes(url.protocol);
} catch (_) {}
let users: User[];
if (isUrl) {
users = await Users.findBy(

View file

@ -32,7 +32,7 @@
"@types/textarea-caret": "3.0.3",
"@types/throttle-debounce": "5.0.2",
"@types/tinycolor2": "1.4.6",
"@types/uuid": "9.0.8",
"@types/uuid": "10.0.0",
"@vitejs/plugin-vue": "5.0.5",
"@vue/runtime-core": "3.4.29",
"autobind-decorator": "2.4.0",
@ -72,7 +72,7 @@
"qrcode-vue3": "1.6.8",
"rollup": "4.17.2",
"s-age": "1.1.2",
"sass": "1.77.5",
"sass": "1.77.6",
"seedrandom": "3.0.5",
"stringz": "2.1.0",
"swiper": "11.1.4",
@ -81,7 +81,7 @@
"throttle-debounce": "5.0.0",
"tinycolor2": "1.6.0",
"tinyld": "1.3.4",
"typescript": "5.4.5",
"typescript": "5.5.2",
"unicode-emoji-json": "0.6.0",
"uuid": "10.0.0",
"vite": "5.3.1",

View file

@ -360,10 +360,8 @@ import { getStaticImageUrl } from "@/scripts/get-static-image-url";
import number from "@/filters/number";
import { userPage } from "@/filters/user";
import { defaultStore } from "@/store";
import * as os from "@/os";
import { i18n } from "@/i18n";
import { isModerator, isSignedIn, me } from "@/me";
import { host } from "@/config";
import icon from "@/scripts/icon";
const XPhotos = defineAsyncComponent(() => import("./index.photos.vue"));

View file

@ -49,7 +49,7 @@ const XGallery = defineAsyncComponent(() => import("./gallery.vue"));
const props = withDefaults(
defineProps<{
acct: string;
page?: string;
page?: "home" | "reactions" | "media" | "clips" | "pages" | "gallery";
}>(),
{
page: "home",

View file

@ -21,11 +21,11 @@
"url": "https://firefish.dev/firefish/firefish.git"
},
"devDependencies": {
"@swc/cli": "0.3.12",
"@swc/core": "1.6.1",
"@swc/types": "0.1.8",
"@swc/cli": "0.3.14",
"@swc/core": "1.6.5",
"@swc/types": "0.1.9",
"@types/jest": "29.5.12",
"@types/node": "20.14.2",
"@types/node": "20.14.8",
"jest": "29.7.0",
"jest-fetch-mock": "3.0.3",
"jest-websocket-mock": "2.5.0",
@ -33,7 +33,7 @@
"ts-jest": "29.1.5",
"ts-node": "10.9.2",
"tsd": "0.31.1",
"typescript": "5.4.5"
"typescript": "5.5.2"
},
"files": [
"built", "src"

File diff suppressed because it is too large Load diff