mirror of
https://github.com/flibusta-apps/services_manager_server.git
synced 2025-12-06 20:45:37 +01:00
Compare commits
11 Commits
6c84b01bf9
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| ba7e966446 | |||
| bdfa94cb15 | |||
|
|
9855d967b5 | ||
| fcc165ac9c | |||
| 1af0336c39 | |||
|
|
f2dd89e6ab | ||
| 6312eacfc8 | |||
| cc1e675864 | |||
| d594adca9d | |||
|
|
75b117ffa7 | ||
|
|
e95ee2283b |
2
.github/workflows/build_docker_image.yml
vendored
2
.github/workflows/build_docker_image.yml
vendored
@@ -10,7 +10,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|||||||
55
.github/workflows/rust-clippy.yml
vendored
Normal file
55
.github/workflows/rust-clippy.yml
vendored
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
# This workflow uses actions that are not certified by GitHub.
|
||||||
|
# They are provided by a third-party and are governed by
|
||||||
|
# separate terms of service, privacy policy, and support
|
||||||
|
# documentation.
|
||||||
|
# rust-clippy is a tool that runs a bunch of lints to catch common
|
||||||
|
# mistakes in your Rust code and help improve your Rust code.
|
||||||
|
# More details at https://github.com/rust-lang/rust-clippy
|
||||||
|
# and https://rust-lang.github.io/rust-clippy/
|
||||||
|
|
||||||
|
name: rust-clippy analyze
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ "main" ]
|
||||||
|
pull_request:
|
||||||
|
# The branches below must be a subset of the branches above
|
||||||
|
branches: [ "main" ]
|
||||||
|
schedule:
|
||||||
|
- cron: '15 14 * * 3'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
rust-clippy-analyze:
|
||||||
|
name: Run rust-clippy analyzing
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
security-events: write
|
||||||
|
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
|
- name: Install Rust toolchain
|
||||||
|
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af #@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
toolchain: stable
|
||||||
|
components: clippy
|
||||||
|
override: true
|
||||||
|
|
||||||
|
- name: Install required cargo
|
||||||
|
run: cargo install clippy-sarif sarif-fmt
|
||||||
|
|
||||||
|
- name: Run rust-clippy
|
||||||
|
run:
|
||||||
|
cargo clippy
|
||||||
|
--all-features
|
||||||
|
--message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
- name: Upload analysis results to GitHub
|
||||||
|
uses: github/codeql-action/upload-sarif@v4
|
||||||
|
with:
|
||||||
|
sarif_file: rust-clippy-results.sarif
|
||||||
|
wait-for-processing: true
|
||||||
434
Cargo.lock
generated
434
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -25,13 +25,13 @@ serde = { version = "1.0.219", features = ["derive"] }
|
|||||||
|
|
||||||
tokio = { version = "1.44.2", features = ["full"] }
|
tokio = { version = "1.44.2", features = ["full"] }
|
||||||
axum = { version = "0.8.1", features = ["json"] }
|
axum = { version = "0.8.1", features = ["json"] }
|
||||||
axum-prometheus = "0.8.0"
|
axum-prometheus = "0.9.0"
|
||||||
chrono = { version = "0.4.40", features = ["serde"] }
|
chrono = { version = "0.4.40", features = ["serde"] }
|
||||||
sentry = { version = "0.41.0", features = ["debug-images"] }
|
sentry = { version = "0.42.0", features = ["debug-images"] }
|
||||||
|
|
||||||
tracing = "0.1.41"
|
tracing = "0.1.41"
|
||||||
tracing-subscriber = { version = "0.3.19", features = ["env-filter"]}
|
tracing-subscriber = { version = "0.3.19", features = ["env-filter"]}
|
||||||
sentry-tracing = "0.41.0"
|
sentry-tracing = "0.42.0"
|
||||||
tower-http = { version = "0.6.2", features = ["trace"] }
|
tower-http = { version = "0.6.2", features = ["trace"] }
|
||||||
|
|
||||||
sqlx = { version = "0.8.3", features = ["runtime-tokio", "postgres", "macros", "chrono"] }
|
sqlx = { version = "0.8.3", features = ["runtime-tokio", "postgres", "macros", "chrono"] }
|
||||||
|
|||||||
15
src/views.rs
15
src/views.rs
@@ -113,6 +113,21 @@ async fn create_service(db: Database, Json(data): Json<CreateServiceData>) -> im
|
|||||||
return StatusCode::PAYMENT_REQUIRED.into_response();
|
return StatusCode::PAYMENT_REQUIRED.into_response();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let token_exists = sqlx::query_scalar!(
|
||||||
|
r#"
|
||||||
|
SELECT EXISTS(SELECT 1 FROM services WHERE token = $1)
|
||||||
|
"#,
|
||||||
|
token
|
||||||
|
)
|
||||||
|
.fetch_one(&db.0)
|
||||||
|
.await
|
||||||
|
.unwrap_or(Some(false))
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
if token_exists {
|
||||||
|
return StatusCode::CONFLICT.into_response();
|
||||||
|
}
|
||||||
|
|
||||||
let service = sqlx::query_as!(
|
let service = sqlx::query_as!(
|
||||||
Service,
|
Service,
|
||||||
r#"
|
r#"
|
||||||
|
|||||||
Reference in New Issue
Block a user