Merge branch 'develop' into feat/schedule-create
This commit is contained in:
commit
06bed6f230
24 changed files with 121 additions and 101 deletions
|
@ -78,6 +78,7 @@ test:build:
|
|||
- pnpm install --frozen-lockfile
|
||||
- pnpm run build:debug
|
||||
- pnpm run migrate
|
||||
- psql --host postgres --user "${POSTGRES_USER}" --dbname "${POSTGRES_DB}" --command "$(cat docs/downgrade.sql)"
|
||||
|
||||
test:build:backend_ts_only:
|
||||
stage: test
|
||||
|
@ -93,6 +94,7 @@ test:build:backend_ts_only:
|
|||
- package.json
|
||||
- Cargo.toml
|
||||
- Cargo.lock
|
||||
- docs/downgrade.sql
|
||||
when: never
|
||||
- if: $CI_COMMIT_BRANCH == 'develop' || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == 'develop'
|
||||
changes:
|
||||
|
@ -118,6 +120,7 @@ test:build:backend_ts_only:
|
|||
- pnpm install --frozen-lockfile
|
||||
- pnpm --filter 'backend' --filter 'firefish-js' --filter 'megalodon' run build:debug
|
||||
- pnpm run migrate
|
||||
- psql --host postgres --user "${POSTGRES_USER}" --dbname "${POSTGRES_DB}" --command "$(cat docs/downgrade.sql)"
|
||||
|
||||
test:build:client_only:
|
||||
stage: test
|
||||
|
@ -182,10 +185,9 @@ build:container:
|
|||
- job: test:build:client_only
|
||||
optional: true
|
||||
variables:
|
||||
STORAGE_DRIVER: overlay2
|
||||
STORAGE_DRIVER: overlay
|
||||
before_script:
|
||||
- buildah version
|
||||
- buildah prune --all --force || true
|
||||
- echo "${CI_REGISTRY_PASSWORD}" | buildah login --username "${CI_REGISTRY_USER}" --password-stdin "${CI_REGISTRY}"
|
||||
- export IMAGE_TAG="${CI_REGISTRY}/${CI_PROJECT_PATH}/develop:not-for-production"
|
||||
- export IMAGE_CACHE="${CI_REGISTRY}/${CI_PROJECT_PATH}/develop/cache"
|
||||
|
@ -230,8 +232,6 @@ cargo:clippy:
|
|||
paths:
|
||||
- packages/backend-rs/**/*
|
||||
- packages/macro-rs/**/*
|
||||
- Cargo.toml
|
||||
- Cargo.lock
|
||||
when: always
|
||||
services: []
|
||||
before_script:
|
||||
|
|
80
Cargo.lock
generated
80
Cargo.lock
generated
|
@ -85,9 +85,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.84"
|
||||
version = "1.0.86"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "18b8795de6d09abb2b178fa5a9e3bb10da935750f33449a132b328b9391b2c6a"
|
||||
checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da"
|
||||
|
||||
[[package]]
|
||||
name = "arbitrary"
|
||||
|
@ -103,7 +103,7 @@ checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.64",
|
||||
"syn 2.0.65",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -154,7 +154,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.64",
|
||||
"syn 2.0.65",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -165,7 +165,7 @@ checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.64",
|
||||
"syn 2.0.65",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -430,7 +430,7 @@ dependencies = [
|
|||
"proc-macro-crate",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.64",
|
||||
"syn 2.0.65",
|
||||
"syn_derive",
|
||||
]
|
||||
|
||||
|
@ -500,9 +500,9 @@ checksum = "a2698f953def977c68f935bb0dfa959375ad4638570e969e2f1e9f433cbf1af6"
|
|||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.97"
|
||||
version = "1.0.98"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "099a5357d84c4c61eb35fc8eafa9a79a902c2f76911e5747ced4e032edd8d9b4"
|
||||
checksum = "41c270e7540d725e65ac7f1b212ac8ce349719624d7bcff99f8e2e488e8cf03f"
|
||||
dependencies = [
|
||||
"jobserver",
|
||||
"libc",
|
||||
|
@ -686,9 +686,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.19"
|
||||
version = "0.8.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345"
|
||||
checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80"
|
||||
|
||||
[[package]]
|
||||
name = "crunchy"
|
||||
|
@ -731,7 +731,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "edb49164822f3ee45b17acd4a208cfc1251410cf0cad9a833234c9890774dd9f"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn 2.0.64",
|
||||
"syn 2.0.65",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1223,9 +1223,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.14"
|
||||
version = "0.2.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c"
|
||||
checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"js-sys",
|
||||
|
@ -1478,7 +1478,7 @@ checksum = "0122b7114117e64a63ac49f752a5ca4624d534c7b1c7de796ac196381cd2d947"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.64",
|
||||
"syn 2.0.65",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1507,7 +1507,7 @@ checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.64",
|
||||
"syn 2.0.65",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1642,9 +1642,9 @@ checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8"
|
|||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.153"
|
||||
version = "0.2.155"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
|
||||
checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
|
||||
|
||||
[[package]]
|
||||
name = "libfuzzer-sys"
|
||||
|
@ -1747,7 +1747,7 @@ dependencies = [
|
|||
"quote",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"syn 2.0.64",
|
||||
"syn 2.0.65",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
|
@ -1842,7 +1842,7 @@ dependencies = [
|
|||
"napi-derive-backend",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.64",
|
||||
"syn 2.0.65",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1857,7 +1857,7 @@ dependencies = [
|
|||
"quote",
|
||||
"regex",
|
||||
"semver",
|
||||
"syn 2.0.64",
|
||||
"syn 2.0.65",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1985,7 +1985,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.64",
|
||||
"syn 2.0.65",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2077,7 +2077,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.64",
|
||||
"syn 2.0.65",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2138,7 +2138,7 @@ dependencies = [
|
|||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.64",
|
||||
"syn 2.0.65",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2296,7 +2296,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.64",
|
||||
"syn 2.0.65",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2455,9 +2455,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.82"
|
||||
version = "1.0.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b"
|
||||
checksum = "0b33eb56c327dec362a9e55b3ad14f9d2f0904fb5a5b03b513ab5465399e9f43"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
@ -2478,7 +2478,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "8021cf59c8ec9c432cfc2526ac6b8aa508ecaf29cd415f271b8406c1b851c3fd"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn 2.0.64",
|
||||
"syn 2.0.65",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2944,7 +2944,7 @@ dependencies = [
|
|||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.64",
|
||||
"syn 2.0.65",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2985,7 +2985,7 @@ dependencies = [
|
|||
"proc-macro2",
|
||||
"quote",
|
||||
"sea-bae",
|
||||
"syn 2.0.64",
|
||||
"syn 2.0.65",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
|
@ -3076,7 +3076,7 @@ checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.64",
|
||||
"syn 2.0.65",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -3549,7 +3549,7 @@ dependencies = [
|
|||
"proc-macro2",
|
||||
"quote",
|
||||
"rustversion",
|
||||
"syn 2.0.64",
|
||||
"syn 2.0.65",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -3571,9 +3571,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.64"
|
||||
version = "2.0.65"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7ad3dee41f36859875573074334c200d1add8e4a87bb37113ebd31d926b7b11f"
|
||||
checksum = "d2863d96a84c6439701d7a38f9de935ec562c8832cc55d1dde0f513b52fad106"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -3589,7 +3589,7 @@ dependencies = [
|
|||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.64",
|
||||
"syn 2.0.65",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -3673,7 +3673,7 @@ checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.64",
|
||||
"syn 2.0.65",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -3770,7 +3770,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.64",
|
||||
"syn 2.0.65",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -3875,7 +3875,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.64",
|
||||
"syn 2.0.65",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -4089,7 +4089,7 @@ dependencies = [
|
|||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.64",
|
||||
"syn 2.0.65",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
|
@ -4111,7 +4111,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.64",
|
||||
"syn 2.0.65",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
@ -4395,7 +4395,7 @@ checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.64",
|
||||
"syn 2.0.65",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
@ -25,7 +25,7 @@ nom-exif = "1.2.0"
|
|||
once_cell = "1.19.0"
|
||||
openssl = "0.10.64"
|
||||
pretty_assertions = "1.4.0"
|
||||
proc-macro2 = "1.0.82"
|
||||
proc-macro2 = "1.0.83"
|
||||
quote = "1.0.36"
|
||||
rand = "0.8.5"
|
||||
redis = { version = "0.25.3", default-features = false }
|
||||
|
@ -36,7 +36,7 @@ serde = "1.0.202"
|
|||
serde_json = "1.0.117"
|
||||
serde_yaml = "0.9.34"
|
||||
strum = "0.26.2"
|
||||
syn = "2.0.64"
|
||||
syn = "2.0.65"
|
||||
sysinfo = "0.30.12"
|
||||
thiserror = "1.0.61"
|
||||
tokio = "1.37.0"
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
- git
|
||||
- Node.js
|
||||
- pnpm
|
||||
- Rust toolchain
|
||||
- Rust toolchain and [cargo-nextest](https://nexte.st/)
|
||||
- Python 3
|
||||
- Perl
|
||||
- FFmpeg
|
||||
|
|
|
@ -40,6 +40,14 @@ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
|||
cargo --version
|
||||
```
|
||||
|
||||
### Cargo nextest
|
||||
|
||||
Instructions can be found at [this page](https://nexte.st/book/pre-built-binaries).
|
||||
|
||||
```sh
|
||||
curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
|
||||
```
|
||||
|
||||
### PostgreSQL and PGroonga
|
||||
|
||||
Firefish requires PostgreSQL v12 or later. We recommend that you install v12.x for the same reason as Node.js.
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
# Downgrading to `v20240206`
|
||||
|
||||
## systemd
|
||||
## systemd/pm2
|
||||
|
||||
1. Stop the Firefish service
|
||||
```sh
|
||||
sudo systemctl stop your-firefish-service.service
|
||||
# or pm2 stop firefish
|
||||
```
|
||||
1. Take a backup
|
||||
1. Revert database migrations
|
||||
|
@ -22,7 +23,7 @@
|
|||
```
|
||||
1. Switch back to the `v20240206` tag
|
||||
```sh
|
||||
git switch v20240206
|
||||
git switch --detach v20240206
|
||||
```
|
||||
1. Rebuild Firefish
|
||||
```sh
|
||||
|
@ -32,6 +33,7 @@
|
|||
1. Start the Firefish service and confirm that Firefish is downgraded
|
||||
```sh
|
||||
sudo systemctl start your-firefish-service.service
|
||||
# or pm2 start firefish
|
||||
```
|
||||
|
||||
## Docker/Podman
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
"mocha": "pnpm --filter backend run mocha",
|
||||
"test": "pnpm run test:ts && pnpm run test:rs",
|
||||
"test:ts": "pnpm run mocha",
|
||||
"test:rs": "cargo test",
|
||||
"test:rs": "cargo test --doc && cargo nextest run",
|
||||
"format": "pnpm run format:ts; pnpm run format:rs",
|
||||
"format:ts": "pnpm -r --parallel run format",
|
||||
"format:rs": "cargo fmt --all --",
|
||||
|
|
|
@ -18,7 +18,7 @@ async fn init_database() -> Result<&'static DbConn, DbErr> {
|
|||
.sqlx_logging_level(LevelFilter::Trace)
|
||||
.to_owned();
|
||||
|
||||
tracing::info!("Initializing PostgreSQL connection");
|
||||
tracing::info!("initializing connection");
|
||||
|
||||
let conn = Database::connect(option).await?;
|
||||
Ok(DB_CONN.get_or_init(move || conn))
|
||||
|
|
|
@ -67,10 +67,10 @@ async fn init_conn_pool() -> Result<(), RedisError> {
|
|||
params.concat()
|
||||
};
|
||||
|
||||
tracing::info!("Initializing connection manager");
|
||||
tracing::info!("initializing connection manager");
|
||||
let manager = RedisConnectionManager::new(redis_url)?;
|
||||
|
||||
tracing::info!("Creating connection pool");
|
||||
tracing::info!("creating connection pool");
|
||||
let pool = Pool::builder().build(manager).await?;
|
||||
|
||||
CONN_POOL.get_or_init(|| async { pool }).await;
|
||||
|
|
|
@ -16,5 +16,5 @@ pub fn greet() {
|
|||
println!("{}", GREETING_MESSAGE);
|
||||
|
||||
tracing::info!("Welcome to Firefish!");
|
||||
tracing::info!("Firefish {VERSION}");
|
||||
tracing::info!("Firefish v{VERSION}");
|
||||
}
|
||||
|
|
|
@ -3,9 +3,9 @@ use crate::config::CONFIG;
|
|||
#[derive(thiserror::Error, Debug)]
|
||||
pub enum Error {
|
||||
#[error("Idna error: {0}")]
|
||||
IdnaError(#[from] idna::Errors),
|
||||
IdnaErr(#[from] idna::Errors),
|
||||
#[error("Url parse error: {0}")]
|
||||
UrlParseError(#[from] url::ParseError),
|
||||
UrlParseErr(#[from] url::ParseError),
|
||||
#[error("Hostname is missing")]
|
||||
NoHostname,
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#[inline]
|
||||
#[crate::ts_only_warn("Use `emojis::get(str).is_some()` instead.")]
|
||||
#[crate::export]
|
||||
pub fn is_unicode_emoji(s: &str) -> bool {
|
||||
emojis::get(s).is_some()
|
||||
|
@ -6,9 +6,11 @@ pub fn is_unicode_emoji(s: &str) -> bool {
|
|||
|
||||
#[cfg(test)]
|
||||
mod unit_test {
|
||||
#[allow(deprecated)]
|
||||
use super::is_unicode_emoji;
|
||||
|
||||
#[test]
|
||||
#[allow(deprecated)]
|
||||
fn test_unicode_emoji_check() {
|
||||
assert!(is_unicode_emoji("⭐"));
|
||||
assert!(is_unicode_emoji("👍"));
|
||||
|
|
|
@ -69,7 +69,7 @@ pub async fn get_image_size_from_url(url: &str) -> Result<ImageSize, Error> {
|
|||
return Err(Error::TooManyAttempts(url.to_string()));
|
||||
}
|
||||
|
||||
tracing::info!("retrieving image size from {}", url);
|
||||
tracing::info!("retrieving image from {}", url);
|
||||
|
||||
let mut response = http_client::client()?.get(url)?;
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ pub async fn all_texts(note: NoteLike) -> Result<Vec<String>, DbErr> {
|
|||
texts.push(c);
|
||||
}
|
||||
} else {
|
||||
tracing::warn!("nonexistent renote id: {:#?}", renote_id);
|
||||
tracing::warn!("nonexistent renote id: {}", renote_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ pub async fn all_texts(note: NoteLike) -> Result<Vec<String>, DbErr> {
|
|||
texts.push(c);
|
||||
}
|
||||
} else {
|
||||
tracing::warn!("nonexistent reply id: {:#?}", reply_id);
|
||||
tracing::warn!("nonexistent reply id: {}", reply_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use crate::model::entity::note;
|
||||
|
||||
// for napi export
|
||||
// https://github.com/napi-rs/napi-rs/issues/2060
|
||||
type Note = note::Model;
|
||||
|
||||
|
|
|
@ -15,11 +15,11 @@ pub fn hash_password(password: &str) -> Result<String, password_hash::errors::Er
|
|||
#[derive(thiserror::Error, Debug)]
|
||||
pub enum VerifyError {
|
||||
#[error("An error occured while bcrypt verification: {0}")]
|
||||
BcryptError(#[from] bcrypt::BcryptError),
|
||||
BcryptErr(#[from] bcrypt::BcryptError),
|
||||
#[error("Invalid argon2 password hash: {0}")]
|
||||
InvalidArgon2Hash(#[from] password_hash::Error),
|
||||
#[error("An error occured while argon2 verification: {0}")]
|
||||
Argon2Error(#[from] argon2::Error),
|
||||
Argon2Err(#[from] argon2::Error),
|
||||
}
|
||||
|
||||
#[crate::export]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::database::db_conn;
|
||||
use crate::misc::{convert_host::to_puny, emoji::is_unicode_emoji, meta::fetch_meta};
|
||||
use crate::misc::{convert_host::to_puny, meta::fetch_meta};
|
||||
use crate::model::entity::emoji;
|
||||
use once_cell::sync::Lazy;
|
||||
use regex::Regex;
|
||||
|
@ -58,9 +58,9 @@ pub fn count_reactions(reactions: &HashMap<String, u32>) -> HashMap<String, u32>
|
|||
#[derive(thiserror::Error, Debug)]
|
||||
pub enum Error {
|
||||
#[error("Idna error: {0}")]
|
||||
IdnaError(#[from] idna::Errors),
|
||||
IdnaErr(#[from] idna::Errors),
|
||||
#[error("Database error: {0}")]
|
||||
DbError(#[from] DbErr),
|
||||
DbErr(#[from] DbErr),
|
||||
}
|
||||
|
||||
#[crate::export]
|
||||
|
@ -72,7 +72,8 @@ pub async fn to_db_reaction(reaction: Option<&str>, host: Option<&str>) -> Resul
|
|||
return Ok("❤️".to_owned());
|
||||
}
|
||||
|
||||
if is_unicode_emoji(reaction) {
|
||||
// check if the reaction is an Unicode emoji
|
||||
if emojis::get(reaction).is_some() {
|
||||
return Ok(reaction.to_owned());
|
||||
}
|
||||
|
||||
|
|
|
@ -2,18 +2,18 @@
|
|||
|
||||
use crate::database::db_conn;
|
||||
use crate::model::entity::attestation_challenge;
|
||||
use chrono::{Duration, Local};
|
||||
use chrono::{Duration, Utc};
|
||||
use sea_orm::{ColumnTrait, DbErr, EntityTrait, QueryFilter};
|
||||
|
||||
/// Delete all entries in the "attestation_challenge" table created at more than 5 minutes ago
|
||||
#[crate::export]
|
||||
pub async fn remove_old_attestation_challenges() -> Result<(), DbErr> {
|
||||
let res = attestation_challenge::Entity::delete_many()
|
||||
.filter(attestation_challenge::Column::CreatedAt.lt(Local::now() - Duration::minutes(5)))
|
||||
.filter(attestation_challenge::Column::CreatedAt.lt(Utc::now() - Duration::minutes(5)))
|
||||
.exec(db_conn().await?)
|
||||
.await?;
|
||||
|
||||
tracing::info!("{} attestation challenges are removed", res.rows_affected);
|
||||
tracing::info!("removed {} rows", res.rows_affected);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ pub enum Error {
|
|||
AntennaCheckErr(#[from] AntennaCheckError),
|
||||
}
|
||||
|
||||
// for napi export
|
||||
// https://github.com/napi-rs/napi-rs/issues/2060
|
||||
type Antenna = antenna::Model;
|
||||
type Note = note::Model;
|
||||
|
|
|
@ -5,9 +5,9 @@ use serde::{Deserialize, Serialize};
|
|||
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
pub enum Error {
|
||||
#[error("Http client aquisition error: {0}")]
|
||||
#[error("HTTP client aquisition error: {0}")]
|
||||
HttpClientErr(#[from] http_client::Error),
|
||||
#[error("Http error: {0}")]
|
||||
#[error("HTTP error: {0}")]
|
||||
HttpErr(#[from] isahc::Error),
|
||||
#[error("Bad status: {0}")]
|
||||
BadStatus(String),
|
||||
|
|
|
@ -174,7 +174,7 @@ pub async fn send_push_notification(
|
|||
serde_json::to_string(&compact_content(&kind, content.clone())?)?
|
||||
)
|
||||
};
|
||||
tracing::trace!("payload: {:#?}", payload);
|
||||
tracing::trace!("payload: {}", payload);
|
||||
|
||||
let encoding = if kind == PushNotificationKind::Mastodon {
|
||||
ContentEncoding::AesGcm
|
||||
|
|
|
@ -48,13 +48,13 @@ pub enum Stream {
|
|||
#[derive(thiserror::Error, Debug)]
|
||||
pub enum Error {
|
||||
#[error("Redis error: {0}")]
|
||||
RedisError(#[from] RedisError),
|
||||
RedisErr(#[from] RedisError),
|
||||
#[error("Redis connection error: {0}")]
|
||||
RedisConnErr(#[from] RedisConnError),
|
||||
#[error("Json (de)serialization error: {0}")]
|
||||
JsonError(#[from] serde_json::Error),
|
||||
JsonErr(#[from] serde_json::Error),
|
||||
#[error("Value error: {0}")]
|
||||
ValueError(String),
|
||||
ValueErr(String),
|
||||
}
|
||||
|
||||
pub async fn publish_to_stream(
|
||||
|
@ -69,7 +69,7 @@ pub async fn publish_to_stream(
|
|||
value.unwrap_or("null".to_string()),
|
||||
)
|
||||
} else {
|
||||
value.ok_or(Error::ValueError("Invalid streaming message".to_string()))?
|
||||
value.ok_or(Error::ValueErr("Invalid streaming message".to_string()))?
|
||||
};
|
||||
|
||||
redis_conn()
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
"ajv": "8.13.0",
|
||||
"archiver": "7.0.1",
|
||||
"aws-sdk": "2.1623.0",
|
||||
"axios": "1.6.8",
|
||||
"axios": "1.7.0",
|
||||
"backend-rs": "workspace:*",
|
||||
"blurhash": "2.0.5",
|
||||
"bull": "4.12.6",
|
||||
|
@ -55,7 +55,7 @@
|
|||
"feed": "4.2.2",
|
||||
"file-type": "19.0.0",
|
||||
"firefish-js": "workspace:*",
|
||||
"fluent-ffmpeg": "2.1.2",
|
||||
"fluent-ffmpeg": "2.1.3",
|
||||
"form-data": "4.0.0",
|
||||
"got": "14.3.0",
|
||||
"gunzip-maybe": "1.4.2",
|
||||
|
|
|
@ -88,8 +88,8 @@ importers:
|
|||
specifier: 2.1623.0
|
||||
version: 2.1623.0
|
||||
axios:
|
||||
specifier: 1.6.8
|
||||
version: 1.6.8
|
||||
specifier: 1.7.0
|
||||
version: 1.7.0
|
||||
backend-rs:
|
||||
specifier: workspace:*
|
||||
version: link:../backend-rs
|
||||
|
@ -142,8 +142,8 @@ importers:
|
|||
specifier: workspace:*
|
||||
version: link:../firefish-js
|
||||
fluent-ffmpeg:
|
||||
specifier: 2.1.2
|
||||
version: 2.1.2
|
||||
specifier: 2.1.3
|
||||
version: 2.1.3
|
||||
form-data:
|
||||
specifier: 4.0.0
|
||||
version: 4.0.0
|
||||
|
@ -1282,8 +1282,8 @@ packages:
|
|||
'@discordapp/twemoji@15.0.3':
|
||||
resolution: {integrity: sha512-5t0LLrNaSqViG0cSaomWwfR0+3fWqok+xLq40M8hJHxNX7s8gIoyNZYybQJo+s5/rGMjgdldpt8Ox8MapGvBUA==}
|
||||
|
||||
'@emnapi/runtime@1.1.1':
|
||||
resolution: {integrity: sha512-3bfqkzuR1KLx57nZfjr2NLnFOobvyS0aTszaEGCGqmYMVDRaGvgIZbjGSV/MHSSmLgQ/b9JFHQ5xm5WRZYd+XQ==}
|
||||
'@emnapi/runtime@1.2.0':
|
||||
resolution: {integrity: sha512-bV21/9LQmcQeCPEg3BDFtvwL6cwiTMksYNWQQ4KOxCZikEGalWtenoZ0wCiukJINlGCIi2KXx01g4FoH/LxpzQ==}
|
||||
|
||||
'@es-joy/jsdoccomment@0.43.0':
|
||||
resolution: {integrity: sha512-Q1CnsQrytI3TlCB1IVWXWeqUIPGVEKGaE7IbVdt13Nq/3i0JESAkQQERrfiQkmlpijl+++qyqPgaS31Bvc1jRQ==}
|
||||
|
@ -3005,6 +3005,9 @@ packages:
|
|||
async-lock@1.4.0:
|
||||
resolution: {integrity: sha512-coglx5yIWuetakm3/1dsX9hxCNox22h7+V80RQOu2XUUMidtArxKoZoOtHUPuR84SycKTXzgGzAUR5hJxujyJQ==}
|
||||
|
||||
async@0.2.10:
|
||||
resolution: {integrity: sha512-eAkdoKxU6/LkKDBzLpT+t6Ff5EtfSF4wx1WfJiPEEV7WNLnDaRXk0oVysiEPm262roaachGexwUv94WhSgN5TQ==}
|
||||
|
||||
async@3.2.5:
|
||||
resolution: {integrity: sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==}
|
||||
|
||||
|
@ -3037,8 +3040,8 @@ packages:
|
|||
axios@1.2.2:
|
||||
resolution: {integrity: sha512-bz/J4gS2S3I7mpN/YZfGFTqhXTYzRho8Ay38w2otuuDR322KzFIWm/4W2K6gIwvWaws5n+mnb7D1lN9uD+QH6Q==}
|
||||
|
||||
axios@1.6.8:
|
||||
resolution: {integrity: sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==}
|
||||
axios@1.7.0:
|
||||
resolution: {integrity: sha512-IiB0wQeKyPRdsFVhBgIo31FbzOyf2M6wYl7/NVutFwFBRMiAbjNiydJIHKeLmPugF4kJLfA1uWZ82Is2QzqqFA==}
|
||||
|
||||
b4a@1.6.6:
|
||||
resolution: {integrity: sha512-5Tk1HLk6b6ctmjIkAcU/Ujv/1WqiDl0F0JdRCR80VsOcUlHcu7pWeWRlOqQLHfDEsVx9YH/aif5AG4ehoCtTmg==}
|
||||
|
@ -4499,8 +4502,8 @@ packages:
|
|||
fast-levenshtein@2.0.6:
|
||||
resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==}
|
||||
|
||||
fast-xml-parser@4.3.6:
|
||||
resolution: {integrity: sha512-M2SovcRxD4+vC493Uc2GZVcZaj66CCJhWurC4viynVSTvrpErCShNcDz1lAho6n9REQKvL/ll4A4/fw6Y9z8nw==}
|
||||
fast-xml-parser@4.4.0:
|
||||
resolution: {integrity: sha512-kLY3jFlwIYwBNDojclKsNAC12sfD6NwW74QB2CoNGPvtVxjliYehVunB3HYyNi+n4Tt1dAcgwYvmKF/Z18flqg==}
|
||||
hasBin: true
|
||||
|
||||
fastq@1.17.1:
|
||||
|
@ -4597,9 +4600,9 @@ packages:
|
|||
flatted@3.3.1:
|
||||
resolution: {integrity: sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==}
|
||||
|
||||
fluent-ffmpeg@2.1.2:
|
||||
resolution: {integrity: sha512-IZTB4kq5GK0DPp7sGQ0q/BWurGHffRtQQwVkiqDgeO6wYJLLV5ZhgNOQ65loZxxuPMKZKZcICCUnaGtlxBiR0Q==}
|
||||
engines: {node: '>=0.8.0'}
|
||||
fluent-ffmpeg@2.1.3:
|
||||
resolution: {integrity: sha512-Be3narBNt2s6bsaqP6Jzq91heDgOEaDCJAXcE3qcma/EJBSy5FB4cvO31XBInuAuKBx8Kptf8dkhjK0IOru39Q==}
|
||||
engines: {node: '>=18'}
|
||||
|
||||
focus-trap-vue@4.0.3:
|
||||
resolution: {integrity: sha512-cIX5rybkCAlNZ4IHYJ3nCFIsipDDljJHHjtTO2IgYWkVYg7X9ipUVdab3HzYp88kmHgMwjcB71LYnXRRsF6ZqQ==}
|
||||
|
@ -8486,7 +8489,7 @@ snapshots:
|
|||
jsonfile: 5.0.0
|
||||
universalify: 0.1.2
|
||||
|
||||
'@emnapi/runtime@1.1.1':
|
||||
'@emnapi/runtime@1.2.0':
|
||||
dependencies:
|
||||
tslib: 2.6.2
|
||||
optional: true
|
||||
|
@ -8843,7 +8846,7 @@ snapshots:
|
|||
|
||||
'@img/sharp-wasm32@0.33.4':
|
||||
dependencies:
|
||||
'@emnapi/runtime': 1.1.1
|
||||
'@emnapi/runtime': 1.2.0
|
||||
optional: true
|
||||
|
||||
'@img/sharp-win32-ia32@0.33.4':
|
||||
|
@ -10448,6 +10451,8 @@ snapshots:
|
|||
|
||||
async-lock@1.4.0: {}
|
||||
|
||||
async@0.2.10: {}
|
||||
|
||||
async@3.2.5: {}
|
||||
|
||||
asynckit@0.4.0: {}
|
||||
|
@ -10489,7 +10494,7 @@ snapshots:
|
|||
transitivePeerDependencies:
|
||||
- debug
|
||||
|
||||
axios@1.6.8:
|
||||
axios@1.7.0:
|
||||
dependencies:
|
||||
follow-redirects: 1.15.6
|
||||
form-data: 4.0.0
|
||||
|
@ -11272,7 +11277,7 @@ snapshots:
|
|||
deepl-node@1.13.0:
|
||||
dependencies:
|
||||
'@types/node': 20.12.12
|
||||
axios: 1.6.8
|
||||
axios: 1.7.0
|
||||
form-data: 3.0.1
|
||||
loglevel: 1.9.1
|
||||
transitivePeerDependencies:
|
||||
|
@ -12211,7 +12216,7 @@ snapshots:
|
|||
|
||||
fast-levenshtein@2.0.6: {}
|
||||
|
||||
fast-xml-parser@4.3.6:
|
||||
fast-xml-parser@4.4.0:
|
||||
dependencies:
|
||||
strnum: 1.0.5
|
||||
|
||||
|
@ -12319,9 +12324,9 @@ snapshots:
|
|||
|
||||
flatted@3.3.1: {}
|
||||
|
||||
fluent-ffmpeg@2.1.2:
|
||||
fluent-ffmpeg@2.1.3:
|
||||
dependencies:
|
||||
async: 3.2.5
|
||||
async: 0.2.10
|
||||
which: 1.3.1
|
||||
|
||||
focus-trap-vue@4.0.3(focus-trap@7.5.4)(vue@3.4.27(typescript@5.4.5)):
|
||||
|
@ -12487,7 +12492,7 @@ snapshots:
|
|||
fs.realpath: 1.0.0
|
||||
inflight: 1.0.6
|
||||
inherits: 2.0.4
|
||||
minimatch: 5.1.6
|
||||
minimatch: 5.0.1
|
||||
once: 1.4.0
|
||||
|
||||
globals@11.12.0: {}
|
||||
|
@ -12924,7 +12929,7 @@ snapshots:
|
|||
|
||||
is-svg@5.0.1:
|
||||
dependencies:
|
||||
fast-xml-parser: 4.3.6
|
||||
fast-xml-parser: 4.4.0
|
||||
|
||||
is-symbol@1.0.4:
|
||||
dependencies:
|
||||
|
@ -13741,7 +13746,7 @@ snapshots:
|
|||
content-disposition: 0.5.4
|
||||
content-type: 1.0.5
|
||||
cookies: 0.8.0
|
||||
debug: 4.3.4(supports-color@8.1.1)
|
||||
debug: 4.3.3
|
||||
delegates: 1.0.0
|
||||
depd: 2.0.0
|
||||
destroy: 1.2.0
|
||||
|
|
Loading…
Reference in a new issue