Compare commits
60 commits
chore-upda
...
master
Author | SHA1 | Date | |
---|---|---|---|
02b20ba677 | |||
ec522a5bb2 | |||
7e5469ad2e | |||
2a4f8ce539 | |||
|
74bf91b976 | ||
|
91c46a64ae | ||
2cec7c2ad2 | |||
c64b40c616 | |||
c249ebeb8b | |||
|
1db3171069 | ||
|
c41f5649e6 | ||
84bb01dbb3 | |||
1b8c15aded | |||
aae35112cd | |||
bfee1f132d | |||
|
fc55eb4de0 | ||
|
888354ed5c | ||
|
4665d2ff87 | ||
|
2b5e82878e | ||
02280710a0 | |||
|
b0183fa2b3 | ||
da71fc1d08 | |||
|
ae52cc555f | ||
eb5f3067c1 | |||
|
3111f3e25c | ||
8bddddea2c | |||
|
e42bff0b5c | ||
1bf1d60cd9 | |||
|
b261bee2f1 | ||
64313eca1f | |||
|
b373dcd75a | ||
b6f916f5f9 | |||
3cf66d941f | |||
fce6090bfa | |||
6586c02cbf | |||
8b9819008a | |||
|
fa38ee17e2 | ||
|
e3a862905d | ||
|
825b01cfa6 | ||
|
19996e67f3 | ||
|
4d7283c3da | ||
d621853a1d | |||
|
b0b09176c5 | ||
2ca90b1d3f | |||
|
b8c3e17404 | ||
8fc0f8f0d5 | |||
|
ecbcf02d4d | ||
ea24dca77d | |||
|
3714d29a23 | ||
4f6d4b709e | |||
95616fef4a | |||
0b3a43088b | |||
ac503b0b06 | |||
883c609412 | |||
|
d44cf2d5c6 | ||
8ee266d846 | |||
c07c5798d9 | |||
b53ac22ba4 | |||
88c7914f96 | |||
|
d3b4ae0952 |
12 changed files with 167 additions and 275 deletions
43
.github/workflows/clippy-fmt.yml
vendored
43
.github/workflows/clippy-fmt.yml
vendored
|
@ -1,43 +0,0 @@
|
||||||
name: Lint
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
types: [opened, synchronize, reopened]
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
fmt:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Install Rust
|
|
||||||
uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
toolchain: stable
|
|
||||||
components: rustfmt
|
|
||||||
- name: Check with rustfmt
|
|
||||||
uses: actions-rs/cargo@v1
|
|
||||||
with:
|
|
||||||
command: fmt
|
|
||||||
args: --all -- --check
|
|
||||||
|
|
||||||
clippy:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Install Rust
|
|
||||||
uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
toolchain: stable
|
|
||||||
components: clippy
|
|
||||||
override: true
|
|
||||||
|
|
||||||
- name: Check with Clippy
|
|
||||||
uses: actions-rs/clippy-check@v1
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
args: --workspace --tests --all-features
|
|
49
.github/workflows/coverage.yml
vendored
49
.github/workflows/coverage.yml
vendored
|
@ -1,49 +0,0 @@
|
||||||
name: Coverage
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
types: [opened, synchronize, reopened]
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build_and_test:
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
version:
|
|
||||||
- nightly
|
|
||||||
|
|
||||||
name: ${{ matrix.version }} - x86_64-unknown-linux-gnu
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: ⚡ Cache
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
~/.cargo/registry
|
|
||||||
~/.cargo/git
|
|
||||||
target
|
|
||||||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
||||||
|
|
||||||
- name: Install ${{ matrix.version }}
|
|
||||||
uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
toolchain: ${{ matrix.version }}-x86_64-unknown-linux-gnu
|
|
||||||
profile: minimal
|
|
||||||
override: true
|
|
||||||
|
|
||||||
- name: Generate coverage file
|
|
||||||
if: (github.ref == 'refs/heads/master' || github.event_name == 'pull_request')
|
|
||||||
uses: actions-rs/tarpaulin@v0.1
|
|
||||||
with:
|
|
||||||
args: "-t 1200"
|
|
||||||
env:
|
|
||||||
GIT_HASH: 8e77345f1597e40c2e266cb4e6dee74888918a61
|
|
||||||
|
|
||||||
- name: Upload to Codecov
|
|
||||||
uses: codecov/codecov-action@v2
|
|
||||||
if: github.ref == 'refs/heads/master'
|
|
70
.github/workflows/linux.yml
vendored
70
.github/workflows/linux.yml
vendored
|
@ -1,70 +0,0 @@
|
||||||
name: Build
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
types: [opened, synchronize, reopened]
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build_and_test:
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
version:
|
|
||||||
#- 1.51.0
|
|
||||||
- stable
|
|
||||||
# - nightly
|
|
||||||
|
|
||||||
name: ${{ matrix.version }} - x86_64-unknown-linux-gnu
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: ⚡ Cache
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
/var/lib/docker
|
|
||||||
~/.cargo/registry
|
|
||||||
~/.cargo/git
|
|
||||||
target
|
|
||||||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
||||||
|
|
||||||
- name: Login to DockerHub
|
|
||||||
if: (github.ref == 'refs/heads/master' || github.event_name == 'push') && github.repository == 'realaravinth/libmedium'
|
|
||||||
uses: docker/login-action@v1
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Install ${{ matrix.version }}
|
|
||||||
uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
toolchain: ${{ matrix.version }}-x86_64-unknown-linux-gnu
|
|
||||||
profile: minimal
|
|
||||||
override: true
|
|
||||||
|
|
||||||
- name: build
|
|
||||||
run: make
|
|
||||||
|
|
||||||
- name: run tests
|
|
||||||
run: make test
|
|
||||||
|
|
||||||
- name: build and publish docker images
|
|
||||||
run: make docker-publish
|
|
||||||
|
|
||||||
- name: generate documentation
|
|
||||||
if: matrix.version == 'stable' && (github.repository == 'realaravinth/libmedium')
|
|
||||||
run: make doc
|
|
||||||
env:
|
|
||||||
GIT_HASH: 8e77345f1597e40c2e266cb4e6dee74888918a61 # dummy value
|
|
||||||
|
|
||||||
- name: Deploy to GitHub libmedium
|
|
||||||
if: matrix.version == 'stable' && (github.repository == 'realaravinth/libmedium')
|
|
||||||
uses: JamesIves/github-pages-deploy-action@3.7.1
|
|
||||||
with:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
BRANCH: gh-libmedium
|
|
||||||
FOLDER: target/doc
|
|
|
@ -31,7 +31,6 @@ steps:
|
||||||
when:
|
when:
|
||||||
event: [push, tag, deployment]
|
event: [push, tag, deployment]
|
||||||
branch: master
|
branch: master
|
||||||
secrets: [docker_token]
|
|
||||||
settings:
|
settings:
|
||||||
repo: realaravinth/libmedium
|
repo: realaravinth/libmedium
|
||||||
username: realaravinth
|
username: realaravinth
|
||||||
|
|
181
Cargo.lock
generated
181
Cargo.lock
generated
|
@ -21,15 +21,15 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "actix-http"
|
name = "actix-http"
|
||||||
version = "3.7.0"
|
version = "3.9.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4eb9843d84c775696c37d9a418bbb01b932629d01870722c0f13eb3f95e2536d"
|
checksum = "d48f96fc3003717aeb9856ca3d02a8c7de502667ad76eeacd830b48d2e91fac4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-codec",
|
"actix-codec",
|
||||||
"actix-rt",
|
"actix-rt",
|
||||||
"actix-service",
|
"actix-service",
|
||||||
"actix-utils",
|
"actix-utils",
|
||||||
"ahash 0.8.11",
|
"ahash",
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
"bitflags 2.5.0",
|
"bitflags 2.5.0",
|
||||||
"brotli",
|
"brotli",
|
||||||
|
@ -85,9 +85,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "actix-rt"
|
name = "actix-rt"
|
||||||
version = "2.9.0"
|
version = "2.10.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "28f32d40287d3f402ae0028a9d54bef51af15c8769492826a69d28f81893151d"
|
checksum = "24eda4e2a6e042aa4e55ac438a2ae052d3b5da0ecf83d7411e1a368946925208"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-macros",
|
"actix-macros",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
|
@ -134,9 +134,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "actix-web"
|
name = "actix-web"
|
||||||
version = "4.6.0"
|
version = "4.9.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b1cf67dadb19d7c95e5a299e2dda24193b89d5d4f33a3b9800888ede9e19aa32"
|
checksum = "9180d76e5cc7ccbc4d60a506f2c727730b154010262df5b910eb17dbe4b8cb38"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-codec",
|
"actix-codec",
|
||||||
"actix-http",
|
"actix-http",
|
||||||
|
@ -147,7 +147,7 @@ dependencies = [
|
||||||
"actix-service",
|
"actix-service",
|
||||||
"actix-utils",
|
"actix-utils",
|
||||||
"actix-web-codegen",
|
"actix-web-codegen",
|
||||||
"ahash 0.8.11",
|
"ahash",
|
||||||
"bytes",
|
"bytes",
|
||||||
"bytestring",
|
"bytestring",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
|
@ -156,6 +156,7 @@ dependencies = [
|
||||||
"encoding_rs",
|
"encoding_rs",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
|
"impl-more",
|
||||||
"itoa",
|
"itoa",
|
||||||
"language-tags",
|
"language-tags",
|
||||||
"log",
|
"log",
|
||||||
|
@ -175,9 +176,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "actix-web-codegen"
|
name = "actix-web-codegen"
|
||||||
version = "4.2.2"
|
version = "4.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "eb1f50ebbb30eca122b188319a4398b3f7bb4a8cdf50ecfb73bfc6a3c3ce54f5"
|
checksum = "f591380e2e68490b5dfaf1dd1aa0ebe78d84ba7067078512b4ea6e4492d622b8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-router",
|
"actix-router",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
|
@ -212,17 +213,6 @@ version = "1.0.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ahash"
|
|
||||||
version = "0.7.8"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9"
|
|
||||||
dependencies = [
|
|
||||||
"getrandom",
|
|
||||||
"once_cell",
|
|
||||||
"version_check",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ahash"
|
name = "ahash"
|
||||||
version = "0.8.11"
|
version = "0.8.11"
|
||||||
|
@ -313,12 +303,6 @@ dependencies = [
|
||||||
"rustc-demangle",
|
"rustc-demangle",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "base64"
|
|
||||||
version = "0.13.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "base64"
|
name = "base64"
|
||||||
version = "0.21.7"
|
version = "0.21.7"
|
||||||
|
@ -351,6 +335,9 @@ name = "bitflags"
|
||||||
version = "2.5.0"
|
version = "2.5.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1"
|
checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "block-buffer"
|
name = "block-buffer"
|
||||||
|
@ -455,11 +442,12 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "config"
|
name = "config"
|
||||||
version = "0.13.4"
|
version = "0.14.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "23738e11972c7643e4ec947840fc463b6a571afcd3e735bdfce7d03c7a784aca"
|
checksum = "7328b20597b53c2454f0b1919720c25c7339051c02b72b7e05409e00b14132be"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
|
"convert_case 0.6.0",
|
||||||
"json5",
|
"json5",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"nom",
|
"nom",
|
||||||
|
@ -468,16 +456,45 @@ dependencies = [
|
||||||
"rust-ini",
|
"rust-ini",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"toml 0.5.11",
|
"toml",
|
||||||
"yaml-rust",
|
"yaml-rust",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "const-random"
|
||||||
|
version = "0.1.18"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "87e00182fe74b066627d63b85fd550ac2998d4b0bd86bfed477a0ae4c7c71359"
|
||||||
|
dependencies = [
|
||||||
|
"const-random-macro",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "const-random-macro"
|
||||||
|
version = "0.1.16"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e"
|
||||||
|
dependencies = [
|
||||||
|
"getrandom",
|
||||||
|
"once_cell",
|
||||||
|
"tiny-keccak",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "convert_case"
|
name = "convert_case"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"
|
checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "convert_case"
|
||||||
|
version = "0.6.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca"
|
||||||
|
dependencies = [
|
||||||
|
"unicode-segmentation",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cookie"
|
name = "cookie"
|
||||||
version = "0.16.2"
|
version = "0.16.2"
|
||||||
|
@ -538,6 +555,12 @@ version = "0.8.20"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80"
|
checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "crunchy"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crypto-common"
|
name = "crypto-common"
|
||||||
version = "0.1.6"
|
version = "0.1.6"
|
||||||
|
@ -559,15 +582,15 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "derive_more"
|
name = "derive_more"
|
||||||
version = "0.99.17"
|
version = "0.99.18"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321"
|
checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"convert_case",
|
"convert_case 0.4.0",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"rustc_version",
|
"rustc_version",
|
||||||
"syn 1.0.109",
|
"syn 2.0.66",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -582,9 +605,12 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dlv-list"
|
name = "dlv-list"
|
||||||
version = "0.3.0"
|
version = "0.5.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0688c2a7f92e427f44895cd63841bff7b29f8d7a1648b9e7e07a4a365b2e1257"
|
checksum = "442039f5147480ba31067cb00ada1adae6892028e40e45fc5de7b7df6dcc1b5f"
|
||||||
|
dependencies = [
|
||||||
|
"const-random",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "either"
|
name = "either"
|
||||||
|
@ -903,12 +929,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hashbrown"
|
name = "hashbrown"
|
||||||
version = "0.12.3"
|
version = "0.13.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
|
checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e"
|
||||||
dependencies = [
|
|
||||||
"ahash 0.7.8",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hashbrown"
|
name = "hashbrown"
|
||||||
|
@ -1053,6 +1076,12 @@ dependencies = [
|
||||||
"unicode-normalization",
|
"unicode-normalization",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "impl-more"
|
||||||
|
version = "0.1.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "206ca75c9c03ba3d4ace2460e57b189f39f43de612c2f85836e65c929701bb2d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "indexmap"
|
name = "indexmap"
|
||||||
version = "2.2.6"
|
version = "2.2.6"
|
||||||
|
@ -1138,9 +1167,9 @@ checksum = "d4345964bb142484797b161f473a503a434de77149dd8c7427788c6e13379388"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lazy_static"
|
name = "lazy_static"
|
||||||
version = "1.4.0"
|
version = "1.5.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
|
@ -1223,9 +1252,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "log"
|
name = "log"
|
||||||
version = "0.4.21"
|
version = "0.4.22"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c"
|
checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memchr"
|
name = "memchr"
|
||||||
|
@ -1401,12 +1430,12 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ordered-multimap"
|
name = "ordered-multimap"
|
||||||
version = "0.4.3"
|
version = "0.6.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ccd746e37177e1711c20dd619a1620f34f5c8b569c53590a72dedd5344d8924a"
|
checksum = "4ed8acf08e98e744e5384c8bc63ceb0364e68a6854187221c18df61c4797690e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dlv-list",
|
"dlv-list",
|
||||||
"hashbrown 0.12.3",
|
"hashbrown 0.13.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1735,20 +1764,21 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ron"
|
name = "ron"
|
||||||
version = "0.7.1"
|
version = "0.8.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "88073939a61e5b7680558e6be56b419e208420c2adb92be54921fa6b72283f1a"
|
checksum = "b91f7eff05f748767f183df4320a63d6936e9c6107d97c9e6bdd9784f4289c94"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.13.1",
|
"base64 0.21.7",
|
||||||
"bitflags 1.3.2",
|
"bitflags 2.5.0",
|
||||||
"serde",
|
"serde",
|
||||||
|
"serde_derive",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rust-ini"
|
name = "rust-ini"
|
||||||
version = "0.18.0"
|
version = "0.19.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f6d5f2436026b4f6e79dc829837d467cc7e9a55ee40e750d716713540715a2df"
|
checksum = "7e2a3bcec1f113553ef1c88aae6c020a369d03d55b58de9869a0908930385091"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"ordered-multimap",
|
"ordered-multimap",
|
||||||
|
@ -1822,7 +1852,7 @@ dependencies = [
|
||||||
"quote",
|
"quote",
|
||||||
"serde",
|
"serde",
|
||||||
"syn 2.0.66",
|
"syn 2.0.66",
|
||||||
"toml 0.8.14",
|
"toml",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1890,18 +1920,18 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.203"
|
version = "1.0.210"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094"
|
checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_derive"
|
name = "serde_derive"
|
||||||
version = "1.0.203"
|
version = "1.0.210"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba"
|
checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
@ -1910,11 +1940,12 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_json"
|
name = "serde_json"
|
||||||
version = "1.0.117"
|
version = "1.0.128"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3"
|
checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itoa",
|
"itoa",
|
||||||
|
"memchr",
|
||||||
"ryu",
|
"ryu",
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
@ -2168,6 +2199,15 @@ dependencies = [
|
||||||
"time-core",
|
"time-core",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tiny-keccak"
|
||||||
|
version = "2.0.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237"
|
||||||
|
dependencies = [
|
||||||
|
"crunchy",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tinyvec"
|
name = "tinyvec"
|
||||||
version = "1.6.0"
|
version = "1.6.0"
|
||||||
|
@ -2223,15 +2263,6 @@ dependencies = [
|
||||||
"tokio",
|
"tokio",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "toml"
|
|
||||||
version = "0.5.11"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234"
|
|
||||||
dependencies = [
|
|
||||||
"serde",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml"
|
name = "toml"
|
||||||
version = "0.8.14"
|
version = "0.8.14"
|
||||||
|
@ -2331,6 +2362,12 @@ dependencies = [
|
||||||
"tinyvec",
|
"tinyvec",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-segmentation"
|
||||||
|
version = "1.11.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unreachable"
|
name = "unreachable"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
|
@ -2342,9 +2379,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "url"
|
name = "url"
|
||||||
version = "2.5.0"
|
version = "2.5.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633"
|
checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"form_urlencoded",
|
"form_urlencoded",
|
||||||
"idna",
|
"idna",
|
||||||
|
|
|
@ -16,7 +16,7 @@ actix-rt = "2"
|
||||||
actix-web = "4.0.1"
|
actix-web = "4.0.1"
|
||||||
bincode = "1.3.3"
|
bincode = "1.3.3"
|
||||||
chrono = "0.4.23"
|
chrono = "0.4.23"
|
||||||
config = "0.13"
|
config = "0.14"
|
||||||
derive_more = "0.99"
|
derive_more = "0.99"
|
||||||
futures = "0.3.17"
|
futures = "0.3.17"
|
||||||
lazy_static = "1.4"
|
lazy_static = "1.4"
|
||||||
|
|
|
@ -57,7 +57,7 @@ business.
|
||||||
| http://md.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion/ | N/A | Hetzner | [~vern](https://vern.cc) |
|
| http://md.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion/ | N/A | Hetzner | [~vern](https://vern.cc) |
|
||||||
| http://vernaqj2qr2pijpgvf3od6ssc3ulz3nv52gwr3hba5l6humuzmgq.b32.i2p/ | N/A | Hetzner | [~vern](https://vern.cc) |
|
| http://vernaqj2qr2pijpgvf3od6ssc3ulz3nv52gwr3hba5l6humuzmgq.b32.i2p/ | N/A | Hetzner | [~vern](https://vern.cc) |
|
||||||
| https://medium.hostux.net | France | Gandi | [hostux](https://hostux.net) |
|
| https://medium.hostux.net | France | Gandi | [hostux](https://hostux.net) |
|
||||||
| https://read.sudovanilla.com | US | Cloudflare | [SudoVanilla](https://sudovanilla.com) |
|
| https://r.sudovanilla.org | US | Selfhosted | [SudoVanilla](https://sudovanilla.org) |
|
||||||
| https://libmedium.ducks.party | DE | Datalix | [ducks.party](https://ducks.party) |
|
| https://libmedium.ducks.party | DE | Datalix | [ducks.party](https://ducks.party) |
|
||||||
## Deploy
|
## Deploy
|
||||||
|
|
||||||
|
|
16
src/data.rs
16
src/data.rs
|
@ -164,14 +164,14 @@ impl Data {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn get_post_light(&self, id: &str) -> PostUrl {
|
pub async fn get_post_light(&self, id: &str) -> Option<PostUrl> {
|
||||||
match self.posts.get(id) {
|
match self.posts.get(id) {
|
||||||
Ok(Some(v)) => {
|
Ok(Some(v)) => {
|
||||||
let cached: PostResp = bincode::deserialize(&v[..]).unwrap();
|
let cached: PostResp = bincode::deserialize(&v[..]).unwrap();
|
||||||
PostUrl {
|
Some(PostUrl {
|
||||||
slug: cached.unique_slug,
|
slug: cached.unique_slug,
|
||||||
username: cached.creator.username,
|
username: cached.creator.username,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
let vars = get_post_light::Variables { id: id.to_owned() };
|
let vars = get_post_light::Variables { id: id.to_owned() };
|
||||||
|
@ -180,10 +180,16 @@ impl Data {
|
||||||
let res = post_graphql::<GetPostLight, _>(&self.client, URL, vars)
|
let res = post_graphql::<GetPostLight, _>(&self.client, URL, vars)
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let res = res.data.expect("missing response data").post.unwrap();
|
if res.data.is_none() {
|
||||||
PostUrl {
|
None
|
||||||
|
} else {
|
||||||
|
match res.data.expect("missing response data").post {
|
||||||
|
None => None,
|
||||||
|
Some(res) => Some(PostUrl {
|
||||||
slug: res.unique_slug,
|
slug: res.unique_slug,
|
||||||
username: res.creator.username,
|
username: res.creator.username,
|
||||||
|
}),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
34
src/post.rs
34
src/post.rs
|
@ -345,6 +345,7 @@ pub fn apply_markup(
|
||||||
) -> Vec<String> {
|
) -> Vec<String> {
|
||||||
let mut paragraphs: Vec<String> = Vec::with_capacity(data.content.body_model.paragraphs.len());
|
let mut paragraphs: Vec<String> = Vec::with_capacity(data.content.body_model.paragraphs.len());
|
||||||
let mut state = ListState::default();
|
let mut state = ListState::default();
|
||||||
|
let mut no_render_html = false;
|
||||||
for (pindex, p) in data.content.body_model.paragraphs.iter().enumerate() {
|
for (pindex, p) in data.content.body_model.paragraphs.iter().enumerate() {
|
||||||
let mut pos = PositionMap::default();
|
let mut pos = PositionMap::default();
|
||||||
if p.type_ == "H3" && pindex == 0 {
|
if p.type_ == "H3" && pindex == 0 {
|
||||||
|
@ -383,33 +384,42 @@ pub fn apply_markup(
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut content = String::with_capacity(p.text.len());
|
let mut content = String::with_capacity(p.text.len());
|
||||||
content += &Markup::start(p, gists, pindex, &mut state);
|
let start = &Markup::start(p, gists, pindex, &mut state);
|
||||||
|
content += start;
|
||||||
|
if start == "<pre>" {
|
||||||
|
no_render_html = true;
|
||||||
|
}
|
||||||
pos.arr.sort();
|
pos.arr.sort();
|
||||||
|
let mut page = String::default();
|
||||||
if let Some(first) = pos.arr.first() {
|
if let Some(first) = pos.arr.first() {
|
||||||
//content += p.text.substring(cur, *first as usize);
|
page += p.text.slice(cur..*first as usize);
|
||||||
content += p.text.slice(cur..*first as usize);
|
|
||||||
cur = incr_cur(cur, *first);
|
cur = incr_cur(cur, *first);
|
||||||
for point in pos.arr.iter() {
|
for point in pos.arr.iter() {
|
||||||
//content.push(p.text.substring(start, start + point);
|
|
||||||
// if *point != 0 {
|
|
||||||
|
|
||||||
if cur != *point as usize {
|
if cur != *point as usize {
|
||||||
// content += p.text.substring(cur, *point as usize);
|
page += p.text.slice(cur..*point as usize);
|
||||||
content += p.text.slice(cur..*point as usize);
|
|
||||||
}
|
}
|
||||||
// }
|
// }
|
||||||
let pos_markups = pos.map.get(point).unwrap();
|
let pos_markups = pos.map.get(point).unwrap();
|
||||||
for m in pos_markups.iter() {
|
for m in pos_markups.iter() {
|
||||||
content += &m.apply_markup(pindex);
|
page += &m.apply_markup(pindex);
|
||||||
}
|
}
|
||||||
cur = incr_cur(cur, *point);
|
cur = incr_cur(cur, *point);
|
||||||
}
|
}
|
||||||
log::debug!("LAST");
|
log::debug!("LAST");
|
||||||
content += p.text.slice(cur..);
|
page += p.text.slice(cur..);
|
||||||
content += &Markup::end(p, pindex, &mut state);
|
let end = &Markup::end(p, pindex, &mut state);
|
||||||
|
if end == "</pre>" {
|
||||||
|
no_render_html = false;
|
||||||
|
}
|
||||||
|
content += &page;
|
||||||
|
content += end;
|
||||||
} else {
|
} else {
|
||||||
log::debug!("LAST WITH NO MARKUP");
|
log::debug!("LAST WITH NO MARKUP");
|
||||||
content += p.text.slice(cur..);
|
page += p.text.slice(cur..);
|
||||||
|
if no_render_html {
|
||||||
|
page = page.replace("<", "<").replace(">", ">");
|
||||||
|
}
|
||||||
|
content += &page;
|
||||||
content += &Markup::end(p, pindex, &mut state);
|
content += &Markup::end(p, pindex, &mut state);
|
||||||
}
|
}
|
||||||
paragraphs.push(content);
|
paragraphs.push(content);
|
||||||
|
|
16
src/proxy.rs
16
src/proxy.rs
|
@ -158,29 +158,33 @@ async fn assets(path: web::Path<String>, data: AppData) -> impl Responder {
|
||||||
|
|
||||||
#[actix_web_codegen_const_routes::get(path = "crate::V1_API_ROUTES.proxy.by_post_id")]
|
#[actix_web_codegen_const_routes::get(path = "crate::V1_API_ROUTES.proxy.by_post_id")]
|
||||||
async fn by_post_id(path: web::Path<String>, data: AppData) -> impl Responder {
|
async fn by_post_id(path: web::Path<String>, data: AppData) -> impl Responder {
|
||||||
let post_data = data.get_post_light(&path).await;
|
match data.get_post_light(&path).await {
|
||||||
HttpResponse::Found()
|
None => HttpResponse::NotFound().body("Post not found"),
|
||||||
|
Some(post_data) => HttpResponse::Found()
|
||||||
.append_header((
|
.append_header((
|
||||||
header::LOCATION,
|
header::LOCATION,
|
||||||
crate::V1_API_ROUTES
|
crate::V1_API_ROUTES
|
||||||
.proxy
|
.proxy
|
||||||
.get_page(&post_data.username, &post_data.slug),
|
.get_page(&post_data.username, &post_data.slug),
|
||||||
))
|
))
|
||||||
.finish()
|
.finish(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[actix_web_codegen_const_routes::get(path = "crate::V1_API_ROUTES.proxy.top_level_post")]
|
#[actix_web_codegen_const_routes::get(path = "crate::V1_API_ROUTES.proxy.top_level_post")]
|
||||||
async fn by_top_level_post(path: web::Path<String>, data: AppData) -> impl Responder {
|
async fn by_top_level_post(path: web::Path<String>, data: AppData) -> impl Responder {
|
||||||
if let Some(post_id) = path.split('-').last() {
|
if let Some(post_id) = path.split('-').last() {
|
||||||
let post_data = data.get_post_light(post_id).await;
|
match data.get_post_light(post_id).await {
|
||||||
HttpResponse::Found()
|
None => HttpResponse::NotFound().body("Post not found"),
|
||||||
|
Some(post_data) => HttpResponse::Found()
|
||||||
.append_header((
|
.append_header((
|
||||||
header::LOCATION,
|
header::LOCATION,
|
||||||
crate::V1_API_ROUTES
|
crate::V1_API_ROUTES
|
||||||
.proxy
|
.proxy
|
||||||
.get_page(&post_data.username, &post_data.slug),
|
.get_page(&post_data.username, &post_data.slug),
|
||||||
))
|
))
|
||||||
.finish()
|
.finish(),
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
HttpResponse::NotFound().body("Post not found, please file bug report")
|
HttpResponse::NotFound().body("Post not found, please file bug report")
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
body {
|
body {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
main {
|
main {
|
||||||
|
|
|
@ -317,7 +317,6 @@ padding: 0;
|
||||||
body {
|
body {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
|
||||||
}
|
}
|
||||||
main {
|
main {
|
||||||
width: 35em;
|
width: 35em;
|
||||||
|
|
Loading…
Reference in a new issue