mirror of
https://github.com/flibusta-apps/batch_downloader.git
synced 2025-12-06 06:15:37 +01:00
Compare commits
16 Commits
ba26a9f99e
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
578ab6f8a3 | ||
| 5f3d042d18 | |||
|
|
e7a6981b9e | ||
| 7473ef5814 | |||
| 1d58813c9f | |||
|
|
8a9fb48ceb | ||
| b21e4ff30d | |||
| 27b1d3b7d3 | |||
|
|
d79a91b8ff | ||
| ece17cea77 | |||
| c2ef4c6044 | |||
| a5f7c3e4db | |||
| 0dd8de8559 | |||
| 951247f92e | |||
| 09d9f6b961 | |||
| 1ffd443360 |
23
.github/workflows/build_docker_image.yml
vendored
23
.github/workflows/build_docker_image.yml
vendored
@@ -3,18 +3,16 @@ name: Build docker image
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
- "main"
|
||||
|
||||
jobs:
|
||||
Build-Docker-Image:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- id: repository_name
|
||||
@@ -22,16 +20,14 @@ jobs:
|
||||
with:
|
||||
string: ${{ github.repository }}
|
||||
|
||||
-
|
||||
name: Login to ghcr.io
|
||||
- name: Login to ghcr.io
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
-
|
||||
name: Build and push
|
||||
- name: Build and push
|
||||
id: docker_build
|
||||
uses: docker/build-push-action@v6
|
||||
env:
|
||||
@@ -39,12 +35,11 @@ jobs:
|
||||
with:
|
||||
push: true
|
||||
platforms: linux/amd64
|
||||
tags: ghcr.io/${{ env.IMAGE }}:latest
|
||||
tags: ghcr.io/${{ env.IMAGE }}:latest,ghcr.io/${{ env.IMAGE }}:${{ github.sha }}
|
||||
context: .
|
||||
file: ./docker/production.dockerfile
|
||||
|
||||
-
|
||||
name: Invoke deployment hook
|
||||
- name: Invoke deployment hook
|
||||
uses: joelwmale/webhook-action@master
|
||||
with:
|
||||
url: ${{ secrets.WEBHOOK_URL }}
|
||||
url: ${{ secrets.WEBHOOK_URL }}?BATCH_DOWNLOADER_TAG=${{ github.sha }}
|
||||
|
||||
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: '44 5 * * 6'
|
||||
|
||||
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@v6
|
||||
|
||||
- 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
|
||||
56
.vscode/launch.json
vendored
56
.vscode/launch.json
vendored
@@ -1,56 +0,0 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Debug executable 'batch_downloader'",
|
||||
"cargo": {
|
||||
"args": [
|
||||
"build",
|
||||
"--bin=batch_downloader",
|
||||
"--package=batch_downloader"
|
||||
],
|
||||
"filter": {
|
||||
"name": "batch_downloader",
|
||||
"kind": "bin"
|
||||
}
|
||||
},
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"env": {
|
||||
"API_KEY": "debug",
|
||||
"MINIO_HOST": "minio.kurbezz.ru:9000",
|
||||
"MINIO_BUCKET": "book.archives",
|
||||
"MINIO_ACCESS_KEY": "SAYRdiuaMvc3gjtxGZRm",
|
||||
"MINIO_SECRET_KEY": "MUwBZs80J8rzKKJvp9Iv4tLBfyxakH7MkrgHiWc1",
|
||||
"LIBRARY_API_KEY": "v3TGJxquSX8qg42EdeatASJddrSDcPdK",
|
||||
"LIBRARY_URL": "https://book-library.kurbezz.ru",
|
||||
"CACHE_API_KEY": "kGaA6feem7Nz5ZuRQDp6L8pdwEdnCAKH",
|
||||
"CACHE_URL": "https://book-channel-cache.kurbezz.ru",
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Debug unit tests in executable 'batch_downloader'",
|
||||
"cargo": {
|
||||
"args": [
|
||||
"test",
|
||||
"--no-run",
|
||||
"--bin=batch_downloader",
|
||||
"--package=batch_downloader"
|
||||
],
|
||||
"filter": {
|
||||
"name": "batch_downloader",
|
||||
"kind": "bin"
|
||||
}
|
||||
},
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}"
|
||||
}
|
||||
]
|
||||
}
|
||||
1758
Cargo.lock
generated
1758
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
49
Cargo.toml
49
Cargo.toml
@@ -3,38 +3,51 @@ name = "batch_downloader"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[profile.release]
|
||||
opt-level = 3
|
||||
debug = false
|
||||
strip = true
|
||||
lto = true
|
||||
codegen-units = 1
|
||||
panic = 'abort'
|
||||
|
||||
[profile.profiling]
|
||||
inherits = "release"
|
||||
debug = true
|
||||
strip = false
|
||||
|
||||
|
||||
[dependencies]
|
||||
tokio = { version = "1.42.0", features = ["full"] }
|
||||
tokio-util = { version = "0.7.13", features = ["compat", "io"] }
|
||||
tokio = { version = "1.44.1", features = ["full"] }
|
||||
tokio-util = { version = "0.7.14", features = ["compat", "io"] }
|
||||
futures-core = "0.3.31"
|
||||
futures-util = "0.3.31"
|
||||
|
||||
tracing = "0.1.41"
|
||||
tracing-subscriber = { version = "0.3.19", features = ["env-filter"]}
|
||||
sentry-tracing = "0.35.0"
|
||||
sentry-tracing = "0.42.0"
|
||||
tower-http = { version = "0.6.2", features = ["trace"] }
|
||||
|
||||
once_cell = "1.20.2"
|
||||
once_cell = "1.21.1"
|
||||
|
||||
axum = { version = "0.7.9", features = ["multipart"] }
|
||||
axum-prometheus = "0.7.0"
|
||||
axum = { version = "0.8.1", features = ["multipart"] }
|
||||
axum-prometheus = "0.9.0"
|
||||
|
||||
serde = { version = "1.0.216", features = ["derive"] }
|
||||
serde_json = "1.0.134"
|
||||
serde = { version = "1.0.219", features = ["derive"] }
|
||||
serde_json = "1.0.140"
|
||||
|
||||
moka = { version = "0.12.8", features = ["future"] }
|
||||
moka = { version = "0.12.10", features = ["future"] }
|
||||
|
||||
md5 = "0.7.0"
|
||||
md5 = "0.8.0"
|
||||
|
||||
smallvec = { version = "1.13.2", features = ["serde"] }
|
||||
smallvec = { version = "1.14.0", features = ["serde"] }
|
||||
smartstring = { version = "1.0.1", features = ["serde"] }
|
||||
reqwest = { version = "0.12.9", features = ["json", "stream", "multipart"] }
|
||||
reqwest = { version = "0.12.15", features = ["json", "stream", "multipart"] }
|
||||
|
||||
bytes = "1.9.0"
|
||||
tempfile = "3.14.0"
|
||||
zip = "2.2.2"
|
||||
bytes = "1.10.1"
|
||||
tempfile = "3.19.1"
|
||||
zip = "4.6.0"
|
||||
|
||||
base64 = "0.22.1"
|
||||
|
||||
@@ -42,6 +55,6 @@ async-stream = "0.3.6"
|
||||
|
||||
translit = "0.6.0"
|
||||
|
||||
sentry = { version = "0.35.0", features = ["debug-images"] }
|
||||
sentry = { version = "0.42.0", features = ["debug-images"] }
|
||||
|
||||
chrono = "0.4.39"
|
||||
chrono = "0.4.40"
|
||||
|
||||
21
LICENSE.md
Normal file
21
LICENSE.md
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 kurbezz
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM rust:bullseye AS builder
|
||||
FROM rust:bookworm AS builder
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y cmake \
|
||||
@@ -11,7 +11,7 @@ COPY . .
|
||||
RUN cargo build --release --bin batch_downloader
|
||||
|
||||
|
||||
FROM debian:bullseye-slim
|
||||
FROM debian:bookworm-slim
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y openssl ca-certificates curl jq \
|
||||
|
||||
10
src/views.rs
10
src/views.rs
@@ -105,7 +105,7 @@ pub async fn get_router() -> Router {
|
||||
let app_router = Router::new()
|
||||
.route("/api/", post(create_archive_task))
|
||||
.route(
|
||||
"/api/check_archive/:task_id",
|
||||
"/api/check_archive/{task_id}",
|
||||
get(check_archive_task_status),
|
||||
)
|
||||
.layer(middleware::from_fn(auth))
|
||||
@@ -114,10 +114,12 @@ pub async fn get_router() -> Router {
|
||||
let metric_router =
|
||||
Router::new().route("/metrics", get(|| async move { metric_handle.render() }));
|
||||
|
||||
let public_router = Router::new().route("/api/download/{task_id}", get(download));
|
||||
|
||||
Router::new()
|
||||
.route("/api/download/:task_id", get(download))
|
||||
.nest("/", app_router)
|
||||
.nest("/", metric_router)
|
||||
.merge(public_router)
|
||||
.merge(app_router)
|
||||
.merge(metric_router)
|
||||
.layer(
|
||||
TraceLayer::new_for_http()
|
||||
.make_span_with(trace::DefaultMakeSpan::new().level(Level::INFO))
|
||||
|
||||
Reference in New Issue
Block a user