Compare commits
453 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2fe705a712 | |||
| 3a448e9e17 | |||
| 6e4def4cc5 | |||
| 34b8fd83c1 | |||
| d5774078e0 | |||
| a3623412f9 | |||
| 1ed60537cf | |||
| 037d670fb7 | |||
| 8b817d50c5 | |||
| fa48060a94 | |||
| b41e982daf | |||
| 2fcb449ed8 | |||
| 218bc54a5f | |||
| 64f0333497 | |||
| 8aa7a5780d | |||
| 17c398bcee | |||
| 76f1455372 | |||
| 1bcad6d7cd | |||
| 9a58d9bcb7 | |||
| c2dcac4413 | |||
| 394273e866 | |||
| 1bcc70c174 | |||
| 188d4ac063 | |||
| 0fbefe2cdc | |||
| eedd5fe4e9 | |||
| 27a1a56223 | |||
| 8e3322776a | |||
| 3d4336c548 | |||
| 0c8c607aa4 | |||
| 60d6734fe2 | |||
| 8c372aa6fc | |||
| d1a74ca8e6 | |||
| c374e0af4c | |||
| 58e8569048 | |||
| 83dbf2a945 | |||
| d7d6d5f644 | |||
| 9aa9885a89 | |||
| 7fe1e083e0 | |||
| a946823554 | |||
| 3a1872c03e | |||
| 5424f9110f | |||
| a597816617 | |||
| fa7a44f6bb | |||
| dfcdcc1833 | |||
| 6345a57498 | |||
| 87457c0ed1 | |||
| 859a1fd528 | |||
| 5069aab584 | |||
| 033fde38fe | |||
| 7b2bab0f9d | |||
| a419ef5319 | |||
| f77dce9f12 | |||
| 4c2cd92f0d | |||
| dd932e1f15 | |||
| 4376810d96 | |||
| c961f4751b | |||
| 9e5ec0c9df | |||
| 112c034e27 | |||
| 664a3ddeea | |||
| 2ffd357d95 | |||
| 2bc4a13964 | |||
| 58324945cc | |||
| 16953ea907 | |||
| d3c2dc8286 | |||
| ebb0b45299 | |||
| 702aa11ecf | |||
| 33221d386e | |||
| 589c159eb9 | |||
| ea1f4d48d5 | |||
| 462c5a1d42 | |||
| f90d7ddee3 | |||
| 175055cf9d | |||
| fe92d95f6c | |||
| 8e50d95a7a | |||
| 9ed36b2aa3 | |||
| 722165a734 | |||
| 74f99e2588 | |||
| 77c08845b5 | |||
| 2bfc26faf2 | |||
| c26f2623a8 | |||
| 451c3b5c88 | |||
| af5674074d | |||
| 28380021a7 | |||
| 37cbf537bb | |||
| 9345a1b7a9 | |||
| d18f1d6d1d | |||
| 621258481d | |||
| ce285bac17 | |||
| a7e45bee11 | |||
| 73e075e216 | |||
| b7c7b6da9f | |||
| 703328601c | |||
| b2e7664339 | |||
| ed22c6b103 | |||
| 94ccbd6190 | |||
| 77edc4849f | |||
| 07da97f434 | |||
| 89dd6be7dd | |||
| 60c1a4264e | |||
| c4c177c530 | |||
| 4a5bffbd57 | |||
| 49b2296015 | |||
| 0ef4a06565 | |||
| 16b1337d67 | |||
| 6599179174 | |||
| f2411f4607 | |||
| 2c3d429b8e | |||
| 7562cf1e75 | |||
| de1c3f3245 | |||
| 5d38c3ad70 | |||
| b55c2ff2f0 | |||
| 056d68804a | |||
| 347bc653d8 | |||
| 6fcece3bc0 | |||
| e119c5bde9 | |||
| 1bc2749e1b | |||
| 58bb07d11d | |||
| affe24b9c6 | |||
| 0bcf063b05 | |||
| 24ecb15119 | |||
| 208c515d70 | |||
| d0ada7fc53 | |||
| d86bd898cb | |||
| db581a955b | |||
| 0b8b1bf25f | |||
| faab5f6b3b | |||
| 6387a1334b | |||
| 10be055381 | |||
| 24c9c7b5a1 | |||
| ac48744aca | |||
| f2d2ecb247 | |||
| 1d46bf8d50 | |||
| 4353f2a92d | |||
| 1b9aeae53c | |||
| 540b9af873 | |||
| d08d2c6958 | |||
| 348259a14b | |||
| e68ca1151d | |||
| 3c15f5a82f | |||
| 5ba823990a | |||
| c82c38fe52 | |||
| e7ab80d5c8 | |||
| 61b68c3a42 | |||
| 6401cb6fb7 | |||
| 9d37408535 | |||
| ded64e1cf0 | |||
| 3b766fc427 | |||
| ad285898f6 | |||
| 78be49d57d | |||
| 25e52788c5 | |||
| 5d25a64f13 | |||
| 0dc89fbf23 | |||
| 94ed0eec2a | |||
| d70e585b64 | |||
| 8f55e50c6e | |||
| c113c99e1d | |||
| 191239584b | |||
| bd1caaf5da | |||
| 76f7b5e7ac | |||
| afe449b951 | |||
| 29f0712ea1 | |||
| d091c24f79 | |||
| f9e7d2bb23 | |||
| dbf36ddf05 | |||
| 8b00853e88 | |||
| 84a3d53075 | |||
| 7967dd91c2 | |||
| b5eb2628f9 | |||
| 4ef6561cc6 | |||
| 7f54f418a8 | |||
| 8f90ea18bf | |||
| e12528aae4 | |||
| 042a1fd2b0 | |||
| be99fe5f99 | |||
| 4a212e5f9e | |||
| c253bdee54 | |||
| 46fc030df4 | |||
| 02277b1ace | |||
| ac507d1d42 | |||
| 5148349098 | |||
| e817941cc5 | |||
| 06962514fe | |||
| c3c8f6804b | |||
| 6dd730030d | |||
| 6c1dd6608d | |||
| 42fb0cf825 | |||
| 2483303138 | |||
| 47e67d9b64 | |||
| 1d042e1bb2 | |||
| 31418b1079 | |||
| 68d79bfa9c | |||
| a46b718937 | |||
| 5570494a37 | |||
| a0cd9dd6bd | |||
| cd5895d560 | |||
| fc8ee1c3bc | |||
| 2a8cc5f3ba | |||
| 82524c9dca | |||
| 864379fb81 | |||
| aae2073146 | |||
| 69963689f9 | |||
| 6ad3359609 | |||
| 6a2ba2260d | |||
| ccbf2124cb | |||
| a733ece26e | |||
| 16624fd742 | |||
| e18be6ec95 | |||
| 1bfed0294f | |||
| d4d32bcc11 | |||
| 0a148721de | |||
| cfe097edf4 | |||
| 578768d7df | |||
| 996dc309f7 | |||
| 09d9164a1c | |||
| 43f32d30cb | |||
| b1d7b3969d | |||
| 89fa208bec | |||
| a11205324b | |||
| 7d17b12000 | |||
| 885dcf91fe | |||
| 192c0f8efd | |||
| 35e71b0f8a | |||
| 1a24ba44b2 | |||
| 7c00d4a88a | |||
| 476310a217 | |||
| 26ffde726f | |||
| 3fd89e6b48 | |||
| be939cf169 | |||
| 4a15bef34f | |||
| 6eee4b0b65 | |||
| f720dcbe9a | |||
| 33fceddc08 | |||
| dfe83aafc5 | |||
| 0775c8f3f9 | |||
| 4cdc1a3655 | |||
| bbd415c392 | |||
| a236f33269 | |||
| 9b593c76e4 | |||
| 012c8d2026 | |||
| cb05571339 | |||
| 64e4550dea | |||
| ec8c17482d | |||
| f167aad0fb | |||
| 24aac22b89 | |||
| 615a5fe346 | |||
| a6699a7319 | |||
| 0f408bc738 | |||
| 44a7953c20 | |||
| 21069ea18e | |||
| 1e1fd49c8c | |||
| 84621d1d27 | |||
| ba4476bf5a | |||
| f87bc455b7 | |||
| 76ec0d2b13 | |||
| 4d547082e0 | |||
| b9b9af6c44 | |||
| 4a4534d6f3 | |||
| 894c4fee2c | |||
| 27a33c833d | |||
| b52d8e4e26 | |||
| b059fb48fc | |||
| f33b057961 | |||
| 663ca4f530 | |||
| 5892c0b088 | |||
| 044a24eac8 | |||
| b93ebedaf3 | |||
| 8539bdaf72 | |||
| c1abd3d6f9 | |||
| becb40544c | |||
| ee96d2b754 | |||
| 30093d3a9f | |||
| 29f2239e3f | |||
| 7f1b33a567 | |||
| d0dd23a1af | |||
| f8774223d4 | |||
| bca870f1f8 | |||
| 64d38c88e8 | |||
| 3ac94b3e43 | |||
| 254eef6a2a | |||
| f1255f477f | |||
| 6c7b95c1b9 | |||
| e7d17caf9d | |||
| 71dd80f125 | |||
| ed4761e841 | |||
| fe05f9a58e | |||
| 51e5a401a5 | |||
| f1990b782d | |||
| 4e3ed0f4c1 | |||
| fdb58215c0 | |||
| 47c8711933 | |||
| 20a099c16f | |||
| 3824e4ba25 | |||
| b163fc8423 | |||
| b50f723a4d | |||
| b778933c64 | |||
| 12b97ce713 | |||
| 4025a45d52 | |||
| 8a6d832513 | |||
| 0b0b3a158f | |||
| 6b745ca8f0 | |||
| 1f0cb7e05c | |||
| c59821945d | |||
| 1a723b78b7 | |||
| e7ff7e3263 | |||
| 3a6c1aeeef | |||
| 567e011a66 | |||
| eaf63e0b17 | |||
| 63b31a9154 | |||
| 5885cb5b09 | |||
| f5ca464b16 | |||
| 1c40d5d3bc | |||
| 7e1abc527f | |||
| 39b2ef72fd | |||
| 17b081a21f | |||
| c482b1b552 | |||
| 8b16b9aaa4 | |||
| 11acc4172c | |||
| 6187c62cb3 | |||
| d6b5b9a721 | |||
| 80675f85f3 | |||
| 07a6be424f | |||
| 8cc56d8d81 | |||
| f8cabcc904 | |||
| d6a946f5b9 | |||
| 2a5a2ec4d2 | |||
| 106e9417d3 | |||
| 2660efec16 | |||
| 1eaa5a6e31 | |||
| b2c26f03e8 | |||
| a75cdaa870 | |||
| 2047355d46 | |||
| 17bbcd1a4b | |||
| 5c8170a97d | |||
| beaeaf743a | |||
| fe641620a6 | |||
| 3e1a6e61ad | |||
| 45b46838ae | |||
| 46cdde8687 | |||
| 6b0dfb729c | |||
| 75a4d1abf1 | |||
| 984c0cda6b | |||
| 902612a470 | |||
| e311d4d423 | |||
| aa33c8e7d3 | |||
| 60e6d49319 | |||
| 6dbd9b76fb | |||
| e3877d3022 | |||
| 4c11df65dc | |||
| f8cfb8cacf | |||
| 9a7e10b560 | |||
| e131330175 | |||
| b9066cb7d0 | |||
| 4c4d9fafd5 | |||
| bbdf2a8293 | |||
| 0d3e1a233f | |||
| 712bc2afbe | |||
| 2eadb80435 | |||
| de05b9e176 | |||
| 5bf1e81f0b | |||
| 55abbff9b8 | |||
| 5f89401a7c | |||
| 7bd3c1b01e | |||
| 961806247c | |||
| ac7ffae121 | |||
| 5321f3cf18 | |||
| 5099a00c6b | |||
| d44c034f6a | |||
| 963e742dcf | |||
| 50462204e8 | |||
| 174ed738bd | |||
| f8d098f353 | |||
| f5b18dffaf | |||
| 002d1f1720 | |||
| 23a5634035 | |||
| 5cd8ae9106 | |||
| 350697f89a | |||
| 569979374f | |||
| 3c666080a9 | |||
| 4e6d7b70cf | |||
| a59f167771 | |||
| f28ab19dc0 | |||
| 6dd4080d65 | |||
| eac76e6806 | |||
| 0cd26dfbf4 | |||
| 3de009713d | |||
| 69bcb01715 | |||
| 9ec2d93f50 | |||
| 4da9b24cb1 | |||
| f40634aa97 | |||
| 83282e0736 | |||
| 43fde90387 | |||
| ccba8163c9 | |||
| 8975b0f9e9 | |||
| d626f3366d | |||
| b24f195e10 | |||
| 003dcf861a | |||
| 5d8efa77a3 | |||
| fb6d49cc6e | |||
| 48776939f4 | |||
| 104b6c1d0c | |||
| 3881927550 | |||
| 0bec13edc0 | |||
| 191d6da486 | |||
| 9aaff1a484 | |||
| 36fd55a7e4 | |||
| fc474bf8d1 | |||
| a050deb557 | |||
| 6de9a1f1c8 | |||
| 5e30bede40 | |||
| 5cca66b346 | |||
| 484659fde2 | |||
| 5fc827c1c9 | |||
| 50753b3a65 | |||
| c5d03d300b | |||
| 010eac6c4a | |||
| a107d35492 | |||
| f9beb2383b | |||
| 7e78cffcaa | |||
| 719fec0828 | |||
| 90fdade566 | |||
| 28576c1fa3 | |||
| d99b42582d | |||
| 92a386277b | |||
| 297d9fcf40 | |||
| ef70cb93e6 | |||
| efb76a3c17 | |||
| 197f0d7ecd | |||
| 3be842c653 | |||
| dabe904642 | |||
| 180e34b07c | |||
| 847d6f7fac | |||
| 6a3f210dfc | |||
| 73aa301d4a | |||
| b3d367b174 | |||
| edaccd1a31 | |||
| e1bd2eab75 | |||
| ac7a05b09a | |||
| 71e0a35e06 | |||
| c217e5e9b3 | |||
| 8ba0c17db5 | |||
| 4e43c676b4 | |||
| b834d1c282 | |||
| 506fe9955d | |||
| 02c528cae4 | |||
| 2a58835f92 | |||
| 5f8d6b8e0e | |||
| 3663bffe5c | |||
| 72464fb428 | |||
| 23049b638c | |||
| f3c05dae62 | |||
| e6bdeb7c4b | |||
| 458baf5f78 | |||
| 597778fd2f |
@@ -0,0 +1,10 @@
|
||||
[target.wasm32-unknown-unknown]
|
||||
# required for clippy
|
||||
rustflags = [
|
||||
"--cfg", "web_sys_unstable_apis",
|
||||
]
|
||||
|
||||
[target.x86_64-unknown-linux-gnu]
|
||||
rustflags = [
|
||||
"--cfg", "web_sys_unstable_apis",
|
||||
]
|
||||
+15
-10
@@ -10,7 +10,7 @@ executors:
|
||||
type: boolean
|
||||
default: false
|
||||
docker:
|
||||
- image: plumeorg/plume-buildenv:v0.0.7
|
||||
- image: plumeorg/plume-buildenv:v0.4.0
|
||||
- image: <<#parameters.postgres>>circleci/postgres:9.6-alpine<</parameters.postgres>><<^parameters.postgres>>alpine:latest<</parameters.postgres>>
|
||||
environment:
|
||||
POSTGRES_USER: postgres
|
||||
@@ -21,6 +21,7 @@ executors:
|
||||
RUST_TEST_THREADS: 1
|
||||
FEATURES: <<#parameters.postgres>>postgres<</ parameters.postgres>><<^parameters.postgres>>sqlite<</parameters.postgres>>
|
||||
DATABASE_URL: <<#parameters.postgres>>postgres://postgres@localhost/plume<</parameters.postgres>><<^parameters.postgres>>plume.sqlite<</parameters.postgres>>
|
||||
ROCKET_SECRET_KEY: VN5xV1DN7XdpATadOCYcuGeR/dV0hHfgx9mx9TarLdM=
|
||||
|
||||
|
||||
commands:
|
||||
@@ -71,7 +72,7 @@ commands:
|
||||
type: string
|
||||
steps:
|
||||
- run: |
|
||||
export RUSTFLAGS="-Zprofile -Zfewer-names -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Zno-landing-pads -Clink-arg=-Xlinker -Clink-arg=--no-keep-memory -Clink-arg=-Xlinker -Clink-arg=--reduce-memory-overheads"
|
||||
export RUSTFLAGS="-Zprofile -Zfewer-names -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Clink-arg=-Xlinker -Clink-arg=--no-keep-memory -Clink-arg=-Xlinker -Clink-arg=--reduce-memory-overheads"
|
||||
export CARGO_INCREMENTAL=0
|
||||
<< parameters.cmd >>
|
||||
|
||||
@@ -82,7 +83,7 @@ commands:
|
||||
type: string
|
||||
steps:
|
||||
- run: zip -0 ccov.zip `find . -name 'plume*.gc*' -o -name 'plm*.gc*'`
|
||||
- run: grcov ccov.zip -s . -t lcov --llvm --branch --ignore-not-existing --ignore-dir '/*' -o lcov.info
|
||||
- run: grcov ccov.zip -s . -t lcov --llvm --branch --ignore-not-existing --ignore '/*' -o lcov.info
|
||||
- run: bash <(curl -s https://codecov.io/bash) -f lcov.info -F <<parameters.type>>
|
||||
- run: find . -name 'plume*.gc*' -delete -o -name 'plm*.gc*' -delete
|
||||
- run: rm ccov.zip lcov.info
|
||||
@@ -99,7 +100,7 @@ commands:
|
||||
steps:
|
||||
- run: |
|
||||
cmd="cargo build <<#parameters.release>>--release<</parameters.release>> --no-default-features --features="${FEATURES}" -p <<parameters.package>> -j"
|
||||
for i in 36 4 2 1 1; do
|
||||
for i in 16 4 2 1 1; do
|
||||
$cmd $i && exit 0
|
||||
done
|
||||
exit 1
|
||||
@@ -143,11 +144,14 @@ jobs:
|
||||
cache: <<#parameters.postgres>>postgres<</ parameters.postgres>><<^parameters.postgres>>sqlite<</parameters.postgres>>
|
||||
- run_with_coverage:
|
||||
cmd: |
|
||||
cargo build -p plume-cli --no-default-features --features=${FEATURES} -j 4
|
||||
./target/debug/plm migration run
|
||||
./target/debug/plm search init
|
||||
cmd="cargo test --all --exclude plume-front --exclude plume-macro --no-run --no-default-features --features=${FEATURES} -j"
|
||||
for i in 36 4 2 1 1; do
|
||||
for i in 16 4 2 1 1; do
|
||||
$cmd $i && break
|
||||
done
|
||||
cargo test --all --exclude plume-front --exclude plume-macro --no-default-features --features="${FEATURES}" -j1 -- --test-threads=1
|
||||
cargo test --all --exclude plume-front --exclude plume-macro --no-default-features --features="${FEATURES}" -j1
|
||||
- upload_coverage:
|
||||
type: unit
|
||||
- cache:
|
||||
@@ -164,18 +168,18 @@ jobs:
|
||||
steps:
|
||||
- restore_env:
|
||||
cache: <<#parameters.postgres>>postgres<</ parameters.postgres>><<^parameters.postgres>>sqlite<</parameters.postgres>>
|
||||
- run: cargo web deploy -p plume-front
|
||||
- run: wasm-pack build --target web --release plume-front
|
||||
- run_with_coverage:
|
||||
cmd: |
|
||||
cmd="cargo install --debug --no-default-features --features="${FEATURES}",test --force --path . -j"
|
||||
for i in 36 4 2 1 1; do
|
||||
for i in 16 4 2 1 1; do
|
||||
$cmd $i && exit 0
|
||||
done
|
||||
exit 1
|
||||
- run_with_coverage:
|
||||
cmd: |
|
||||
cmd="cargo install --debug --no-default-features --features="${FEATURES}" --force --path plume-cli -j"
|
||||
for i in 36 4 2 1 1; do
|
||||
for i in 16 4 2 1 1; do
|
||||
$cmd $i && exit 0
|
||||
done
|
||||
exit 1
|
||||
@@ -199,7 +203,7 @@ jobs:
|
||||
steps:
|
||||
- restore_env:
|
||||
cache: release-<<#parameters.postgres>>postgres<</ parameters.postgres>><<^parameters.postgres>>sqlite<</parameters.postgres>>
|
||||
- run: cargo web deploy -p plume-front --release
|
||||
- run: wasm-pack build --target web --release plume-front
|
||||
- build:
|
||||
package: plume
|
||||
release: true
|
||||
@@ -226,6 +230,7 @@ jobs:
|
||||
steps:
|
||||
- restore_env:
|
||||
cache: none
|
||||
- run: cargo build
|
||||
- run: crowdin upload -b master
|
||||
|
||||
workflows:
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
localhost:443 {
|
||||
proxy / localhost:7878 {
|
||||
transparent
|
||||
}
|
||||
tls self_signed
|
||||
localhost {
|
||||
reverse_proxy localhost:7878
|
||||
}
|
||||
|
||||
@@ -1,19 +1,22 @@
|
||||
FROM debian:stretch-20190326
|
||||
FROM debian:buster-20210208
|
||||
ENV PATH="/root/.cargo/bin:${PATH}"
|
||||
|
||||
#install native/circleci/build dependancies
|
||||
RUN apt update &&\
|
||||
apt install -y --no-install-recommends git ssh tar gzip ca-certificates default-jre&&\
|
||||
apt install -y --no-install-recommends binutils-dev build-essential cmake curl gcc gettext git libcurl4-openssl-dev libdw-dev libelf-dev libiberty-dev libpq-dev libsqlite3-dev libssl-dev make openssl pkg-config postgresql postgresql-contrib python zlib1g-dev python3-pip zip unzip &&\
|
||||
echo "deb [trusted=yes] https://apt.fury.io/caddy/ /" \
|
||||
| tee -a /etc/apt/sources.list.d/caddy-fury.list &&\
|
||||
apt update &&\
|
||||
apt install -y --no-install-recommends binutils-dev build-essential cmake curl gcc gettext git libcurl4-openssl-dev libdw-dev libelf-dev libiberty-dev libpq-dev libsqlite3-dev libssl-dev make openssl pkg-config postgresql postgresql-contrib python zlib1g-dev python3-pip zip unzip libclang-dev clang caddy&&\
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
#install and configure rust
|
||||
RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly-2019-03-23 -y &&\
|
||||
RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly-2021-01-15 -y &&\
|
||||
rustup component add rustfmt clippy &&\
|
||||
rustup component add rust-std --target wasm32-unknown-unknown
|
||||
|
||||
#compile some deps
|
||||
RUN cargo install cargo-web &&\
|
||||
RUN cargo install wasm-pack &&\
|
||||
cargo install grcov &&\
|
||||
strip /root/.cargo/bin/* &&\
|
||||
rm -fr ~/.cargo/registry
|
||||
@@ -24,8 +27,7 @@ COPY cargo_config /root/.cargo/config
|
||||
#install selenium for front end tests
|
||||
RUN pip3 install selenium
|
||||
|
||||
#install and configure caddy
|
||||
RUN curl https://getcaddy.com | bash -s personal
|
||||
#configure caddy
|
||||
COPY Caddyfile /Caddyfile
|
||||
|
||||
#install crowdin
|
||||
|
||||
+12
@@ -15,6 +15,9 @@ DATABASE_URL=postgres://plume:plume@localhost/plume
|
||||
# The domain of your instance
|
||||
BASE_URL=plu.me
|
||||
|
||||
# Log level for each crate
|
||||
RUST_LOG=info
|
||||
|
||||
# The secret key for private cookies and CSRF protection
|
||||
# You can generate one with `openssl rand -base64 32`
|
||||
ROCKET_SECRET_KEY=
|
||||
@@ -45,3 +48,12 @@ ROCKET_ADDRESS=127.0.0.1
|
||||
#PLUME_LOGO_192=icons/trwnh/paragraphs/plumeParagraphs192.png
|
||||
#PLUME_LOGO_256=icons/trwnh/paragraphs/plumeParagraphs256.png
|
||||
#PLUME_LOGO_512=icons/trwnh/paragraphs/plumeParagraphs512.png
|
||||
|
||||
## LDAP CONFIG ##
|
||||
# the object that will be bound is "${USER_NAME_ATTR}=${username},${BASE_DN}"
|
||||
#LDAP_ADDR=ldap://127.0.0.1:1389
|
||||
#LDAP_BASE_DN="ou=users,dc=your-org,dc=eu"
|
||||
#LDAP_USER_NAME_ATTR=cn
|
||||
#LDAP_USER_MAIL_ATTR=mail
|
||||
#LDAP_TLS=false
|
||||
|
||||
|
||||
@@ -7,6 +7,16 @@ assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!--
|
||||
We would appreciated if you report a bug at our Gitea instance's issue page:
|
||||
https://git.joinplu.me/Plume/Plume/issues
|
||||
You can login to the Gitea with your GitHub account.
|
||||
|
||||
We welcome to receive bug reports here, GitHub, too.
|
||||
-->
|
||||
|
||||
|
||||
|
||||
<!-- Describe your bug, explaining how to reproduce it, and what was expected -->
|
||||
|
||||
|
||||
|
||||
@@ -7,6 +7,15 @@ assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!--
|
||||
We would appreciated if you request a feature at our Gitea instance's issue page:
|
||||
https://git.joinplu.me/Plume/Plume/issues
|
||||
You can login to the Gitea with your GitHub account.
|
||||
|
||||
We welcome to receive feature requests here, GitHub, too.
|
||||
-->
|
||||
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<!--
|
||||
We would appreciated if you report a bug at our Gitea instance's pull request page:
|
||||
https://git.joinplu.me/Plume/Plume/pulls
|
||||
You can login to the Gitea with your GitHub account.
|
||||
|
||||
We welcome to receive pull requests here, GitHub, too.
|
||||
-->
|
||||
@@ -18,3 +18,5 @@ tags.*
|
||||
search_index
|
||||
.buildconfig
|
||||
__pycache__
|
||||
.vscode/
|
||||
*-journal
|
||||
|
||||
+218
@@ -0,0 +1,218 @@
|
||||
# Changelog
|
||||
|
||||
<!-- next-header -->
|
||||
|
||||
## [Unreleased] - ReleaseDate
|
||||
|
||||
### Added
|
||||
|
||||
- Allow `dir` attributes for LtoR text in RtoL document (#860)
|
||||
- More translation languages (#862)
|
||||
- Proxy support (#829)
|
||||
- Riker a actor system library (#870)
|
||||
- (request-target) and Host header in HTTP Signature (#872)
|
||||
|
||||
### Changed
|
||||
|
||||
- Upgrade some dependent crates (#858)
|
||||
- Use tracing crate (#868)
|
||||
- Update Rust version to nightly-2021-01-15 (#878)
|
||||
- Upgrade Tantivy to 0.13.3 and lindera-tantivy to 0.7.1 (#878)
|
||||
- Run searcher on actor system (#870)
|
||||
- Use article title as its slug instead of capitalizing and inserting hyphens (#920)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Percent-encode URI for remote_interact (#866, #857)
|
||||
- Menu animation not opening on iOS (#876, #897)
|
||||
- Make actors subscribe to channel once (#913)
|
||||
- Upsert posts and media instead of trying to insert and fail (#912)
|
||||
- Update post's ActivityPub id when published by update (#915)
|
||||
- Calculate media URI properly even when MEDIA_UPLOAD_DIRECTORY configured (#916)
|
||||
- Prevent duplicated posts in 'all' timeline (#917)
|
||||
|
||||
## [[0.6.0]] - 2020-12-29
|
||||
|
||||
### Added
|
||||
|
||||
- Vazir font for better support of languages written in Arabic script (#787)
|
||||
- Login via LDAP (#826)
|
||||
- cargo-release (#835)
|
||||
- Care about weak ETag header for better caching (#840)
|
||||
- Support for right to left languages in post content (#853)
|
||||
|
||||
### Changed
|
||||
|
||||
- Bump Docker base images to Buster flavor (#797)
|
||||
- Upgrade Rocket to 0.4.5 (#800)
|
||||
- Keep tags as-is (#832)
|
||||
- Update Docker image for testing (#838)
|
||||
- Update Dockerfile.dev (#841)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Recreate search index if its format is outdated (#802)
|
||||
- Make it possible to switch to rich text editor (#808)
|
||||
- Fix margins for the mobile devices (#817)
|
||||
- GPU acceleration for the mobile menu (#818)
|
||||
- Natural title position for RtoL languages (#825)
|
||||
- Remove link to unimplemented page (#827)
|
||||
- Fix displaying not found page when submitting a duplicated blocklist email (#831)
|
||||
|
||||
### Security
|
||||
|
||||
- Validate spoofing of activity
|
||||
|
||||
## [0.5.0] - 2020-06-21
|
||||
|
||||
### Added
|
||||
|
||||
- Email blocklisting (#718)
|
||||
- Syntax highlighting (#691)
|
||||
- Persian localization (#782)
|
||||
- Switchable tokenizer - enables Japanese full-text search (#776)
|
||||
- Make database connections configurable by environment variables (#768)
|
||||
|
||||
### Changed
|
||||
|
||||
- Display likes and boost on post cards (#744)
|
||||
- Rust 2018 (#726)
|
||||
- Bump to LLVM to 9.0.0 to fix ARM builds (#737)
|
||||
- Remove dependency on runtime-fmt (#773)
|
||||
- Drop the -alpha suffix in release names, it is implied that Plume is not stable yet because of the 0 major version (Plume 1.0.0 will be the first stable release).
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix parsing of mentions inside a Markdown code block (be430c6)
|
||||
- Fix RSS issues (#720)
|
||||
- Fix Atom feed (#764)
|
||||
- Fix default theme (#746)
|
||||
- Fix shown password on remote interact pages (#741)
|
||||
- Allow unicode hashtags (#757)
|
||||
- Fix French grammar for for 0 (#760)
|
||||
- Don't show boosts and likes for "all" and "local" in timelines (#781)
|
||||
- Fix liking and boosting posts on remote instances (#762)
|
||||
|
||||
## [0.4.0] - 2019-12-23
|
||||
|
||||
### Added
|
||||
|
||||
- Add support for generic timeline (#525)
|
||||
- Federate user deletion (#551)
|
||||
- import migrations and don't require diesel_cli for admins (#555)
|
||||
- Cache local instance (#572)
|
||||
- Initial RTL support #575 (#577)
|
||||
- Confirm deletion of blog (#602)
|
||||
- Make a distinction between moderators and admins (#619)
|
||||
- Theming (#624)
|
||||
- Add clap to plume in order to print help and version (#631)
|
||||
- Add Snapcraft metadata and install/maintenance hooks (#666)
|
||||
- Add environmental variable to control path of media (#683)
|
||||
- Add autosaving to the editor (#688)
|
||||
- CI: Upload artifacts to pull request deploy environment (#539)
|
||||
- CI: Upload artifact of wasm binary (#571)
|
||||
|
||||
### Changed
|
||||
|
||||
- Update follow_remote.rs.html grammar (#548)
|
||||
- Add some feedback when performing some actions (#552)
|
||||
- Theme update (#553)
|
||||
- Remove the new index lock tantivy uses (#556)
|
||||
- Reduce reqwest timeout to 5s (#557)
|
||||
- Improve notification management (#561)
|
||||
- Fix occurrences of 'have been' to 'has been' (#578) + Direct follow-up to #578 (#603)
|
||||
- Store password reset requests in database (#610)
|
||||
- Use futures and tokio to send activities (#620)
|
||||
- Don't ignore dotenv errors (#630)
|
||||
- Replace the input! macro with an Input builder (#646)
|
||||
- Update default license (#659)
|
||||
- Paginate the outbox responses. Fixes #669 (#681)
|
||||
- Use the "classic" editor by default (#697)
|
||||
- Fix issue #705 (#708)
|
||||
- Make comments in styleshhets a bit clearer (#545)
|
||||
- Rewrite circleci config (#558)
|
||||
- Use openssl instead of sha256sum for build.rs (#568)
|
||||
- Update dependencies (#574)
|
||||
- Refactor code to use Shrinkwraprs and diesel-derive-newtype (#598)
|
||||
- Add enum containing all successful route returns (#614)
|
||||
- Update dependencies which depended on nix -- fixes arm32 builds (#615)
|
||||
- Update some documents (#616)
|
||||
- Update dependencies (#643)
|
||||
- Make the comment syntax consistent across all CSS (#487)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Remove r (#535)
|
||||
- Fix certain improper rendering of forms (#560)
|
||||
- make hashtags work in profile summary (#562)
|
||||
- Fix some federation issue (#573)
|
||||
- Prevent comment form submit button distortion on iOS (#592)
|
||||
- Update textarea overflow to scroll (#609)
|
||||
- Fix arm builds (#612)
|
||||
- Fix theme caching (#647)
|
||||
- Fix issue #642, frontend not in English if the user language does not exist (#648)
|
||||
- Don't index drafts (#656)
|
||||
- Fill entirely user on creation (#657)
|
||||
- Delete notification on user deletion (#658)
|
||||
- Order media so that latest added are top (#660)
|
||||
- Fix logo URL (#664)
|
||||
- Snap: Ensure cargo-web doesn't erroneously adopt our workspace. (#667)
|
||||
- Snap: Another fix for building (#668)
|
||||
- Snap: Fix build for non-Tier-1 Rust platforms (#672)
|
||||
- Don't split sentences for translations (#677)
|
||||
- Escape href quotation marks (#678)
|
||||
- Re-add empty strings in translation (#682)
|
||||
- Make the search index creation during migration respect SEARCH_INDEX (#689)
|
||||
- Fix the navigation menu not opening on touch (#690)
|
||||
- Make search items optional (#693)
|
||||
- Various snap fixes (#698)
|
||||
- Fix #637 : Markdown footnotes (#700)
|
||||
- Fix lettre (#706)
|
||||
- CI: Fix Crowdin upload (#576)
|
||||
|
||||
### Removed
|
||||
|
||||
- Remove the Canapi dependency (#540)
|
||||
- Remove use of Rust in migrations (#704)
|
||||
|
||||
## [0.3.0] - 2019-04-19
|
||||
|
||||
### Added
|
||||
|
||||
- Cover for articles (#299, #387)
|
||||
- Password reset (#448)
|
||||
- New editor (#293, #458, #482, #483, #486, #530)
|
||||
- Search (#324, #375, #445)
|
||||
- Edit blogs (#460, #494, #497)
|
||||
- Hashtags in articles (#283, #295)
|
||||
- API endpoints (#245, #285, #307)
|
||||
- A bunch of new translations! (#479, #501, #506, #510, #512, #514)
|
||||
|
||||
### Changed
|
||||
|
||||
- Federation improvements (#216, #217, #357, #364, #399, #443, #446, #455, #502, #519)
|
||||
- Improved build process (#281, #374, #392, #402, #489, #498, #503, #511, #513, #515, #528)
|
||||
|
||||
### Fixes
|
||||
|
||||
- UI usability fixes (#370, #386, #401, #417, #418, #444, #452, #480, #516, #518, #522, #532)
|
||||
|
||||
## [0.2.0] - 2018-09-12
|
||||
|
||||
### Added
|
||||
|
||||
- Article publishing, or save as a draft
|
||||
- Like, or boost an article
|
||||
- Basic Markdown editor
|
||||
- Federated commenting system
|
||||
- User account creation
|
||||
- Limited federation on other platforms and subscribing to users
|
||||
- Ability to create multiple blogs
|
||||
|
||||
<!-- next-url -->
|
||||
[Unreleased]: https://github.com/Plume-org/Plume/compare/0.6.0...HEAD
|
||||
[[0.6.0]]: https://github.com/Plume-org/Plume/compare/0.5.0...0.6.0
|
||||
[0.5.0]: https://github.com/Plume-org/Plume/compare/0.4.0-alpha-4...0.5.0
|
||||
[0.4.0]: https://github.com/Plume-org/Plume/compare/0.3.0-alpha-2...0.4.0-alpha-4
|
||||
[0.3.0]: https://github.com/Plume-org/Plume/compare/0.2.0-alpha-1...0.3.0-alpha-2
|
||||
[0.2.0]: https://github.com/Plume-org/Plume/releases/tag/0.2.0-alpha-1
|
||||
Generated
+3337
-1930
File diff suppressed because it is too large
Load Diff
+12
-11
@@ -1,37 +1,37 @@
|
||||
[package]
|
||||
authors = ["Plume contributors"]
|
||||
name = "plume"
|
||||
version = "0.3.0"
|
||||
version = "0.6.1-dev"
|
||||
repository = "https://github.com/Plume-org/Plume"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
activitypub = "0.1.3"
|
||||
askama_escape = "0.1"
|
||||
atom_syndication = "0.6"
|
||||
clap = "2.33"
|
||||
colored = "1.8"
|
||||
dotenv = "0.14"
|
||||
dotenv = "0.15.0"
|
||||
gettext = { git = "https://github.com/Plume-org/gettext/", rev = "294c54d74c699fbc66502b480a37cc66c1daa7f3" }
|
||||
gettext-macros = { git = "https://github.com/Plume-org/gettext-macros/", rev = "a7c605f7edd6bfbfbfe7778026bfefd88d82db10" }
|
||||
gettext-utils = { git = "https://github.com/Plume-org/gettext-macros/", rev = "a7c605f7edd6bfbfbfe7778026bfefd88d82db10" }
|
||||
guid-create = "0.1"
|
||||
heck = "0.3.0"
|
||||
lettre = "0.9.2"
|
||||
lettre_email = "0.9.2"
|
||||
num_cpus = "1.10"
|
||||
rocket = "0.4.0"
|
||||
rocket_contrib = { version = "0.4.0", features = ["json"] }
|
||||
rocket = "=0.4.6"
|
||||
rocket_contrib = { version = "=0.4.5", features = ["json"] }
|
||||
rocket_i18n = { git = "https://github.com/Plume-org/rocket_i18n", rev = "e922afa7c366038b3433278c03b1456b346074f2" }
|
||||
rpassword = "4.0"
|
||||
runtime-fmt = "0.3.0"
|
||||
scheduled-thread-pool = "0.2.2"
|
||||
serde = "1.0"
|
||||
serde_json = "1.0"
|
||||
serde_qs = "0.5"
|
||||
shrinkwraprs = "0.2.1"
|
||||
validator = "0.8"
|
||||
validator_derive = "0.8"
|
||||
webfinger = "0.4.1"
|
||||
tracing = "0.1.22"
|
||||
tracing-subscriber = "0.2.15"
|
||||
riker = "0.4.2"
|
||||
|
||||
[[bin]]
|
||||
name = "plume"
|
||||
@@ -47,7 +47,7 @@ version = "3.1.2"
|
||||
|
||||
[dependencies.diesel]
|
||||
features = ["r2d2", "chrono"]
|
||||
version = "*"
|
||||
version = "1.4.5"
|
||||
|
||||
[dependencies.multipart]
|
||||
default-features = false
|
||||
@@ -65,10 +65,10 @@ path = "plume-models"
|
||||
|
||||
[dependencies.rocket_csrf]
|
||||
git = "https://github.com/fdb-hiroshima/rocket_csrf"
|
||||
rev = "4a72ea2ec716cb0b26188fb00bccf2ef7d1e031c"
|
||||
rev = "29910f2829e7e590a540da3804336577b48c7b31"
|
||||
|
||||
[build-dependencies]
|
||||
ructe = "0.6.2"
|
||||
ructe = "0.13.0"
|
||||
rsass = "0.9"
|
||||
|
||||
[features]
|
||||
@@ -77,6 +77,7 @@ postgres = ["plume-models/postgres", "diesel/postgres"]
|
||||
sqlite = ["plume-models/sqlite", "diesel/sqlite"]
|
||||
debug-mailer = []
|
||||
test = []
|
||||
search-lindera = ["plume-models/search-lindera"]
|
||||
|
||||
[workspace]
|
||||
members = ["plume-api", "plume-cli", "plume-models", "plume-common", "plume-front", "plume-macro"]
|
||||
|
||||
+5
-4
@@ -1,4 +1,4 @@
|
||||
FROM rust:1-stretch as builder
|
||||
FROM rust:1-buster as builder
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
@@ -10,7 +10,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
gcc \
|
||||
make \
|
||||
openssl \
|
||||
libssl-dev
|
||||
libssl-dev \
|
||||
clang
|
||||
|
||||
WORKDIR /scratch
|
||||
COPY script/wasm-deps.sh .
|
||||
@@ -18,7 +19,7 @@ RUN chmod a+x ./wasm-deps.sh && sleep 1 && ./wasm-deps.sh
|
||||
|
||||
WORKDIR /app
|
||||
COPY Cargo.toml Cargo.lock rust-toolchain ./
|
||||
RUN cargo install cargo-web
|
||||
RUN cargo install wasm-pack
|
||||
|
||||
COPY . .
|
||||
|
||||
@@ -27,7 +28,7 @@ RUN cargo install --path ./ --force --no-default-features --features postgres
|
||||
RUN cargo install --path plume-cli --force --no-default-features --features postgres
|
||||
RUN cargo clean
|
||||
|
||||
FROM debian:stretch-slim
|
||||
FROM debian:buster-slim
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
|
||||
+4
-3
@@ -1,4 +1,4 @@
|
||||
FROM rust:1-stretch
|
||||
FROM rust:1-buster
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
@@ -10,7 +10,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
gcc \
|
||||
make \
|
||||
openssl \
|
||||
libssl-dev
|
||||
libssl-dev\
|
||||
clang
|
||||
|
||||
WORKDIR /scratch
|
||||
COPY script/wasm-deps.sh .
|
||||
@@ -19,7 +20,7 @@ RUN chmod a+x ./wasm-deps.sh && sleep 1 && ./wasm-deps.sh
|
||||
WORKDIR /app
|
||||
COPY Cargo.toml Cargo.lock rust-toolchain ./
|
||||
RUN cargo install diesel_cli --no-default-features --features postgres --version '=1.3.0'
|
||||
RUN cargo install cargo-web
|
||||
RUN cargo install wasm-pack
|
||||
|
||||
COPY . .
|
||||
|
||||
|
||||
@@ -30,11 +30,11 @@ A lot of features are still missing, but what is already here should be quite st
|
||||
- **Media management**: you can upload pictures to illustrate your articles, but also audio files if you host a podcast, and manage them all from Plume.
|
||||
- **Federation**: Plume is part of a network of interconnected websites called the Fediverse. Each of these websites (often called *instances*) have their own
|
||||
rules and thematics, but they can all communicate with each other.
|
||||
- **Collaborative writing**: invite other people to your blogs, and write articles together.
|
||||
- **Collaborative writing**: invite other people to your blogs, and write articles together. (Not implemented yet, but will be in 1.0)
|
||||
|
||||
## Get involved
|
||||
|
||||
If you want to have regular news about the project, the best place is probably [our blog](https://fediverse.blog/~/PlumeDev), or our Matrix room: [`#plume:disroot.org`](https://riot.im/app/#/room/#plume:disroot.org).
|
||||
If you want to have regular news about the project, the best place is probably [our blog](https://fediverse.blog/~/PlumeDev), or our Matrix room: [`#plume-blog:matrix.org`](https://matrix.to/#/#plume-blog:matrix.org).
|
||||
|
||||
If you want to contribute more, a good first step is to read [our contribution guides](https://docs.joinplu.me/contribute). We accept all kind of contribution:
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
* {
|
||||
font-family: monospace;
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ main header.article {
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: end;
|
||||
justify-content: flex-end;
|
||||
|
||||
h1, .article-info {
|
||||
text-align: center;
|
||||
@@ -64,41 +64,41 @@ main header.article {
|
||||
}
|
||||
|
||||
main .article-info {
|
||||
margin: 0 auto 3em;
|
||||
font-size: 0.95em;
|
||||
font-weight: 400;
|
||||
margin: 0 auto 3em;
|
||||
font-size: 0.95em;
|
||||
font-weight: 400;
|
||||
|
||||
.author, .author a {
|
||||
font-weight: 600;
|
||||
}
|
||||
.author, .author a {
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
|
||||
/* The article itself */
|
||||
main article {
|
||||
max-width: $article-width;
|
||||
margin: 2.5em auto;
|
||||
font-family: $lora;
|
||||
font-size: 1.2em;
|
||||
line-height: 1.7;
|
||||
margin: 2.5em auto;
|
||||
font-family: $lora;
|
||||
font-size: 1.2em;
|
||||
line-height: 1.7;
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
img {
|
||||
display: block;
|
||||
margin: 3em auto;
|
||||
max-width: 100%;
|
||||
img {
|
||||
display: block;
|
||||
margin: 3em auto;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
pre {
|
||||
padding: 1em;
|
||||
background: $gray;
|
||||
overflow: auto;
|
||||
padding: 1em;
|
||||
background: $gray;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
border-left: 5px solid $gray;
|
||||
border-inline-start: 5px solid $gray;
|
||||
margin: 1em auto;
|
||||
padding: 0em 2em;
|
||||
}
|
||||
@@ -126,7 +126,7 @@ main .article-meta {
|
||||
|
||||
> p {
|
||||
margin: 2em $horizontal-margin;
|
||||
font-size: 0.9em;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
/* Article Tags */
|
||||
@@ -157,15 +157,15 @@ main .article-meta {
|
||||
/* Likes & Boosts */
|
||||
.actions {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-around;
|
||||
flex-direction: row;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.likes, .reshares {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 0.5em 0;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 0.5em 0;
|
||||
|
||||
p {
|
||||
font-size: 1.5em;
|
||||
@@ -175,34 +175,34 @@ main .article-meta {
|
||||
|
||||
.action {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background: none;
|
||||
color: $text-color;
|
||||
border: none;
|
||||
font-size: 1.1em;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background: none;
|
||||
color: $text-color;
|
||||
border: none;
|
||||
font-size: 1.1em;
|
||||
cursor: pointer;
|
||||
|
||||
svg.feather {
|
||||
transition: background 0.1s ease-in;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
svg.feather {
|
||||
transition: background 0.1s ease-in;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
margin: 0.5em 0;
|
||||
width: 2.5em;
|
||||
height: 2.5em;
|
||||
margin: 0.5em 0;
|
||||
width: 2.5em;
|
||||
height: 2.5em;
|
||||
|
||||
border-radius: 50%;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
&.reshared, &.liked {
|
||||
svg.feather {
|
||||
color: $background;
|
||||
font-weight: 900;
|
||||
color: $background;
|
||||
font-weight: 900;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -213,14 +213,14 @@ main .article-meta {
|
||||
|
||||
.action svg.feather {
|
||||
padding: 0.7em;
|
||||
box-sizing: border-box;
|
||||
color: $red;
|
||||
fill: none;
|
||||
border: solid $red thin;
|
||||
box-sizing: border-box;
|
||||
color: $red;
|
||||
fill: none;
|
||||
border: solid $red thin;
|
||||
}
|
||||
|
||||
.action:hover svg.feather {
|
||||
background: transparentize($red, 0.85);
|
||||
background: transparentize($red, 0.85);
|
||||
}
|
||||
|
||||
.action.liked svg.feather {
|
||||
@@ -238,22 +238,22 @@ main .article-meta {
|
||||
|
||||
.action svg.feather {
|
||||
padding: 0.7em;
|
||||
box-sizing: border-box;
|
||||
color: $primary;
|
||||
border: solid $primary thin;
|
||||
font-weight: 600;
|
||||
box-sizing: border-box;
|
||||
color: $primary;
|
||||
border: solid $primary thin;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.action:hover svg.feather {
|
||||
background: transparentize($primary, 0.85);
|
||||
background: transparentize($primary, 0.85);
|
||||
}
|
||||
|
||||
.action.reshared svg.feather {
|
||||
background: $primary;
|
||||
}
|
||||
.action.reshared:hover svg.feather {
|
||||
background: transparentize($primary, 0.75)
|
||||
color: $primary;
|
||||
background: transparentize($primary, 0.75)
|
||||
color: $primary;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,9 +262,9 @@ main .article-meta {
|
||||
margin: 0 $horizontal-margin;
|
||||
|
||||
h2 {
|
||||
color: $primary;
|
||||
font-size: 1.5em;
|
||||
font-weight: 600;
|
||||
color: $primary;
|
||||
font-size: 1.5em;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
summary {
|
||||
@@ -279,16 +279,16 @@ main .article-meta {
|
||||
|
||||
// Respond & delete comment buttons
|
||||
a.button, form.inline, form.inline input {
|
||||
padding: 0;
|
||||
background: none;
|
||||
color: $text-color;
|
||||
margin-right: 2em;
|
||||
font-family: $route159;
|
||||
padding: 0;
|
||||
background: none;
|
||||
color: $text-color;
|
||||
margin-right: 2em;
|
||||
font-family: $route159;
|
||||
font-weight: normal;
|
||||
|
||||
&::before {
|
||||
color: $primary;
|
||||
padding-right: 0.5em;
|
||||
&::before {
|
||||
color: $primary;
|
||||
padding-right: 0.5em;
|
||||
}
|
||||
|
||||
&:hover { color: $primary; }
|
||||
@@ -296,8 +296,8 @@ main .article-meta {
|
||||
|
||||
.comment {
|
||||
margin: 1em 0;
|
||||
font-size: 1em;
|
||||
border: none;
|
||||
font-size: 1em;
|
||||
border: none;
|
||||
|
||||
.content {
|
||||
background: $gray;
|
||||
@@ -328,36 +328,36 @@ main .article-meta {
|
||||
color: transparentize($text-color, 0.6);
|
||||
}
|
||||
|
||||
.author {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
align-content: center;
|
||||
.author {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
align-content: center;
|
||||
|
||||
* {
|
||||
transition: all 0.1s ease-in;
|
||||
}
|
||||
* {
|
||||
transition: all 0.1s ease-in;
|
||||
}
|
||||
|
||||
.display-name {
|
||||
color: $text-color;
|
||||
.display-name {
|
||||
color: $text-color;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
.display-name { color: $primary; }
|
||||
small { opacity: 1; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
& > .comment {
|
||||
padding-left: 2em;
|
||||
}
|
||||
|
||||
.text {
|
||||
padding: 1.25em 0;
|
||||
font-family: $lora;
|
||||
font-size: 1.1em;
|
||||
line-height: 1.4;
|
||||
text-align: left;
|
||||
.text {
|
||||
padding: 1.25em 0;
|
||||
font-family: $lora;
|
||||
font-size: 1.1em;
|
||||
line-height: 1.4;
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -490,3 +490,30 @@ input:checked ~ .cw-container > .cw-text {
|
||||
display: inline;
|
||||
}
|
||||
}
|
||||
|
||||
// Small screens
|
||||
@media screen and (max-width: 600px) {
|
||||
#plume-editor header {
|
||||
flex-direction: column-reverse;
|
||||
|
||||
button {
|
||||
flex: 0 0 0;
|
||||
}
|
||||
}
|
||||
|
||||
.popup {
|
||||
top: 10vh;
|
||||
bottom: 10vh;
|
||||
left: 1vw;
|
||||
right: 1vw;
|
||||
}
|
||||
|
||||
main article {
|
||||
margin: 2.5em .5em;
|
||||
max-width: none;
|
||||
}
|
||||
|
||||
main .article-meta > *, main .article-meta .comments, main .article-meta > .banner > * {
|
||||
margin: 0 5%;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,3 +17,12 @@ $text-color: $white;
|
||||
$primary: $purple;
|
||||
$primary-text-color: $white; // text color on primary background (buttons for instance)
|
||||
$success-color: $blue;
|
||||
|
||||
//Code Highlighting
|
||||
|
||||
$code-keyword-color: #f79ac1;
|
||||
$code-source-color: #a6f0ab;
|
||||
$code-constant-color: #dfec84;
|
||||
$code-operator-color: #eddf95;
|
||||
$code-string-color: #f2ae60;
|
||||
$code-comment-color: #a3b4f9;
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
label {
|
||||
display: block;
|
||||
margin: 2em auto .5em;
|
||||
font-size: 1.2em;
|
||||
display: block;
|
||||
margin: 2em auto .5em;
|
||||
font-size: 1.2em;
|
||||
}
|
||||
input, textarea, select {
|
||||
transition: all 0.1s ease-in;
|
||||
display: block;
|
||||
width: 100%;
|
||||
margin: auto;
|
||||
padding: 1em;
|
||||
box-sizing: border-box;
|
||||
transition: all 0.1s ease-in;
|
||||
display: block;
|
||||
width: 100%;
|
||||
margin: auto;
|
||||
padding: 1em;
|
||||
box-sizing: border-box;
|
||||
-webkit-appearance: textarea;
|
||||
|
||||
background: $form-input-background;
|
||||
color: $text-color;
|
||||
border: solid $form-input-border thin;
|
||||
background: $form-input-background;
|
||||
color: $text-color;
|
||||
border: solid $form-input-border thin;
|
||||
|
||||
font-size: 1.2em;
|
||||
font-weight: 400;
|
||||
font-size: 1.2em;
|
||||
font-weight: 400;
|
||||
|
||||
&:focus {
|
||||
border-color: $primary;
|
||||
}
|
||||
&:focus {
|
||||
border-color: $primary;
|
||||
}
|
||||
}
|
||||
form input[type="submit"] {
|
||||
margin: 2em auto;
|
||||
@@ -29,18 +29,18 @@ form input[type="submit"] {
|
||||
}
|
||||
|
||||
textarea {
|
||||
resize: vertical;
|
||||
resize: vertical;
|
||||
overflow-y: scroll;
|
||||
font-family: $lora;
|
||||
font-size: 1.1em;
|
||||
line-height: 1.5;
|
||||
font-family: $lora;
|
||||
font-size: 1.1em;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
input[type="checkbox"] {
|
||||
display: inline;
|
||||
margin: initial;
|
||||
min-width: initial;
|
||||
width: initial;
|
||||
display: inline;
|
||||
margin: initial;
|
||||
min-width: initial;
|
||||
width: initial;
|
||||
-webkit-appearance: checkbox;
|
||||
}
|
||||
|
||||
@@ -71,31 +71,31 @@ form.inline {
|
||||
}
|
||||
|
||||
.button, .button:visited, input[type="submit"], input[type="submit"].button {
|
||||
transition: all 0.1s ease-in;
|
||||
display: inline-block;
|
||||
transition: all 0.1s ease-in;
|
||||
display: inline-block;
|
||||
-webkit-appearance: none;
|
||||
|
||||
margin: 0.5em auto;
|
||||
padding: 0.75em 1em;
|
||||
margin: 0.5em auto;
|
||||
padding: 0.75em 1em;
|
||||
|
||||
background: $primary;
|
||||
color: $primary-text-color;
|
||||
background: $primary;
|
||||
color: $primary-text-color;
|
||||
font-weight: bold;
|
||||
border: none;
|
||||
|
||||
cursor: pointer;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
background: transparentize($primary, 0.1);
|
||||
}
|
||||
&:hover {
|
||||
background: transparentize($primary, 0.1);
|
||||
}
|
||||
|
||||
&.destructive {
|
||||
background: $red;
|
||||
&.destructive {
|
||||
background: $red;
|
||||
|
||||
&:hover {
|
||||
background: transparentize($red, 0.1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.secondary {
|
||||
background: $gray;
|
||||
@@ -115,20 +115,20 @@ input[type="submit"] {
|
||||
form.new-post {
|
||||
max-width: 60em;
|
||||
.title {
|
||||
margin: 0 auto;
|
||||
padding: 0.75em 0;
|
||||
margin: 0 auto;
|
||||
padding: 0.75em 0;
|
||||
|
||||
background: none;
|
||||
border: none;
|
||||
background: none;
|
||||
border: none;
|
||||
|
||||
font-family: $playfair;
|
||||
font-size: 2em;
|
||||
text-align: left;
|
||||
font-family: $playfair;
|
||||
font-size: 2em;
|
||||
text-align: left;
|
||||
}
|
||||
textarea {
|
||||
min-height: 20em;
|
||||
overflow-y: scroll;
|
||||
resize: none;
|
||||
min-height: 20em;
|
||||
overflow-y: scroll;
|
||||
resize: none;
|
||||
-webkit-appearance: textarea;
|
||||
}
|
||||
}
|
||||
|
||||
+154
-173
@@ -6,43 +6,43 @@ html {
|
||||
}
|
||||
|
||||
html, body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background: $background;
|
||||
color: $text-color;
|
||||
font-family: $route159;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background: $background;
|
||||
color: $text-color;
|
||||
font-family: $route159;
|
||||
|
||||
::selection {
|
||||
background: transparentize($primary, 0.7);
|
||||
}
|
||||
::-moz-selection {
|
||||
::-moz-selection {
|
||||
background: transparentize($primary, 0.7);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
a, a:visited {
|
||||
color: $primary;
|
||||
text-decoration: none;
|
||||
color: $primary;
|
||||
text-decoration: none;
|
||||
}
|
||||
a::selection {
|
||||
color: $background;
|
||||
color: $background;
|
||||
}
|
||||
a::-moz-selection {
|
||||
color: $background;
|
||||
color: $background;
|
||||
}
|
||||
small {
|
||||
margin-left: 1em;
|
||||
color: transparentize($text-color, 0.6);
|
||||
font-size: 0.75em;
|
||||
word-wrap: break-word;
|
||||
word-break: break-all;
|
||||
margin-left: 1em;
|
||||
color: transparentize($text-color, 0.6);
|
||||
font-size: 0.75em;
|
||||
word-wrap: break-word;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.center {
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
opacity: 0.6;
|
||||
padding: 5em;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
opacity: 0.6;
|
||||
padding: 5em;
|
||||
}
|
||||
|
||||
.right {
|
||||
@@ -53,28 +53,28 @@ small {
|
||||
}
|
||||
|
||||
.spaced {
|
||||
margin: 4rem 0;
|
||||
margin: 4rem 0;
|
||||
}
|
||||
|
||||
.banner {
|
||||
background: $gray;
|
||||
padding-top: 2em;
|
||||
padding-bottom: 1em;
|
||||
margin: 3em 0px;
|
||||
background: $gray;
|
||||
padding-top: 2em;
|
||||
padding-bottom: 1em;
|
||||
margin: 3em 0px;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none;
|
||||
appearance: none;
|
||||
display: none;
|
||||
appearance: none;
|
||||
}
|
||||
|
||||
/* Main */
|
||||
body > main > *, .h-feed > * {
|
||||
margin: 1em $horizontal-margin;
|
||||
margin: 1em $horizontal-margin;
|
||||
}
|
||||
|
||||
body > main > .h-entry, .h-feed {
|
||||
margin: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
body > main {
|
||||
@@ -98,18 +98,18 @@ main {
|
||||
margin-top: 1em;
|
||||
|
||||
&.article {
|
||||
margin: 1em auto 0.5em;
|
||||
font-family: $playfair;
|
||||
font-size: 2.5em;
|
||||
font-weight: normal;
|
||||
margin: 1em auto 0.5em;
|
||||
font-family: $playfair;
|
||||
font-size: 2.5em;
|
||||
font-weight: normal;
|
||||
}
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1.75em;
|
||||
font-weight: 300;
|
||||
font-size: 1.75em;
|
||||
font-weight: 300;
|
||||
|
||||
&.article {
|
||||
&.article {
|
||||
font-size: 1.25em;
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
@@ -139,15 +139,15 @@ main {
|
||||
|
||||
/* Errors */
|
||||
p.error {
|
||||
color: $red;
|
||||
font-weight: bold;
|
||||
color: $red;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* User page */
|
||||
.user h1 {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
@@ -156,14 +156,14 @@ p.error {
|
||||
}
|
||||
|
||||
.badge {
|
||||
margin-right: 1em;
|
||||
padding: 0.35em 1em;
|
||||
margin-right: 1em;
|
||||
padding: 0.35em 1em;
|
||||
|
||||
background: $background;
|
||||
color: $primary;
|
||||
border: 1px solid $primary;
|
||||
background: $background;
|
||||
color: $primary;
|
||||
border: 1px solid $primary;
|
||||
|
||||
font-size: 1rem;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.user-summary {
|
||||
@@ -172,58 +172,97 @@ p.error {
|
||||
|
||||
/* Cards */
|
||||
.cards {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
padding: 0 5%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
padding: 0 5%;
|
||||
margin: 1rem 0 5rem;
|
||||
}
|
||||
.card {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
min-width: 20em;
|
||||
min-height: 20em;
|
||||
margin: 1em;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
|
||||
background: $gray;
|
||||
min-width: 20em;
|
||||
min-height: 20em;
|
||||
margin: 1em;
|
||||
box-sizing: border-box;
|
||||
|
||||
text-overflow: ellipsis;
|
||||
background: $gray;
|
||||
|
||||
> * {
|
||||
margin: 20px;
|
||||
}
|
||||
text-overflow: ellipsis;
|
||||
|
||||
.cover {
|
||||
footer.authors {
|
||||
div {
|
||||
float: left;
|
||||
margin-right: 0.25em;
|
||||
}
|
||||
|
||||
.likes { color: $red; }
|
||||
.reshares { color: $primary; }
|
||||
|
||||
span.likes, span.resahres {
|
||||
font-family: "Route159",serif;
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
svg.feather {
|
||||
width: 0.85em;
|
||||
height: 0.85em;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
> * {
|
||||
margin: 20px;
|
||||
}
|
||||
|
||||
.cover {
|
||||
min-height: 10em;
|
||||
background-position: center;
|
||||
background-size: cover;
|
||||
margin: 0px;
|
||||
|
||||
&:hover {
|
||||
opacity: 0.9;
|
||||
}
|
||||
}
|
||||
|
||||
h3 {
|
||||
margin: 0.75em 20px;
|
||||
font-family: $playfair;
|
||||
font-size: 1.75em;
|
||||
font-weight: normal;
|
||||
a {
|
||||
transition: color 0.1s ease-in;
|
||||
color: $text-color;
|
||||
flex-grow: 1;
|
||||
margin: 0;
|
||||
font-family: $playfair;
|
||||
font-size: 1.75em;
|
||||
font-weight: normal;
|
||||
line-height: 1.75;
|
||||
a {
|
||||
display: block;
|
||||
transition: color 0.1s ease-in;
|
||||
color: $text-color;
|
||||
|
||||
&:hover { color: $primary; }
|
||||
}
|
||||
&:hover { color: $primary; }
|
||||
}
|
||||
}
|
||||
|
||||
.controls {
|
||||
float: right;
|
||||
|
||||
.button {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
main {
|
||||
flex: 1;
|
||||
flex: 1;
|
||||
|
||||
font-family: $lora;
|
||||
font-size: 1em;
|
||||
line-height: 1.25;
|
||||
text-align: left;
|
||||
overflow: hidden;
|
||||
font-family: $lora;
|
||||
font-size: 1em;
|
||||
line-height: 1.25;
|
||||
text-align: left;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -265,15 +304,15 @@ p.error {
|
||||
|
||||
/* Stats */
|
||||
.stats {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
margin: 2em;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
margin: 2em;
|
||||
|
||||
> div {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
> div {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
p {
|
||||
@@ -469,91 +508,8 @@ figure {
|
||||
|
||||
/// Small screens
|
||||
@media screen and (max-width: 600px) {
|
||||
@keyframes menuOpening {
|
||||
from {
|
||||
transform: scaleX(0);
|
||||
transform-origin: left;
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
transform: scaleX(1);
|
||||
transform-origin: left;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
body > header {
|
||||
flex-direction: column;
|
||||
|
||||
nav#menu {
|
||||
display: inline-flex;
|
||||
z-index: 21;
|
||||
}
|
||||
|
||||
#content {
|
||||
display: none;
|
||||
appearance: none;
|
||||
text-align: center;
|
||||
z-index: 20;
|
||||
}
|
||||
}
|
||||
|
||||
body > header:focus-within #content, #content.show {
|
||||
position: fixed;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-start;
|
||||
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
|
||||
animation: 0.2s menuOpening;
|
||||
|
||||
&::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
transform: skewX(-10deg);
|
||||
top: 0;
|
||||
left: -20%;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
z-index: -10;
|
||||
|
||||
background: $primary;
|
||||
}
|
||||
|
||||
> nav {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
|
||||
a {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
margin: 0;
|
||||
padding: 1rem 1.5rem;
|
||||
color: $background;
|
||||
font-size: 1.4em;
|
||||
font-weight: 300;
|
||||
|
||||
&.title { font-size: 1.8em; }
|
||||
|
||||
> *:first-child { width: 3rem; }
|
||||
> img:first-child { height: 3rem; }
|
||||
> *:last-child { margin-left: 1rem; }
|
||||
> nav hr {
|
||||
display: block;
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
border: solid $background 0.1rem;
|
||||
}
|
||||
.mobile-label { display: initial; }
|
||||
}
|
||||
}
|
||||
body > main > *, .h-feed > * {
|
||||
margin: 1em;
|
||||
}
|
||||
|
||||
main .article-meta {
|
||||
@@ -601,7 +557,7 @@ figure {
|
||||
margin: 0;
|
||||
|
||||
& > * {
|
||||
max-width: 100%;
|
||||
max-width: 100% !important;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -623,3 +579,28 @@ figure {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//highlighting
|
||||
code {
|
||||
.constant{
|
||||
color: $code-constant-color;
|
||||
}
|
||||
.string{
|
||||
color: $code-string-color;
|
||||
}
|
||||
.keyword.type,.keyword.control,.type{
|
||||
color: $code-keyword-color;
|
||||
}
|
||||
.keyword.operator{
|
||||
color: $code-operator-color;
|
||||
}
|
||||
.source{
|
||||
color: $code-source-color;
|
||||
}
|
||||
.comment{
|
||||
color: $code-comment-color;
|
||||
}
|
||||
.function{
|
||||
color:inherit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ body > header {
|
||||
|
||||
#content {
|
||||
display: flex;
|
||||
align-content: center;
|
||||
justify-content: space-between;
|
||||
align-content: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
nav#menu {
|
||||
@@ -19,44 +19,44 @@ body > header {
|
||||
|
||||
a {
|
||||
transform: skewX(15deg);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 1.4em;
|
||||
height: 1.4em;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
color: $gray;
|
||||
font-size: 1.33em;
|
||||
}
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 1.4em;
|
||||
height: 1.4em;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
color: $gray;
|
||||
font-size: 1.33em;
|
||||
}
|
||||
}
|
||||
|
||||
nav {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
|
||||
hr {
|
||||
height: 100%;
|
||||
width: 0.2em;
|
||||
background: $primary;
|
||||
border: none;
|
||||
transform: skewX(-15deg);
|
||||
hr {
|
||||
height: 100%;
|
||||
width: 0.2em;
|
||||
background: $primary;
|
||||
border: none;
|
||||
transform: skewX(-15deg);
|
||||
}
|
||||
a {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
align-self: stretch;
|
||||
margin: 0;
|
||||
padding: 0 2em;
|
||||
font-size: 1em;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
align-self: stretch;
|
||||
margin: 0;
|
||||
padding: 0 2em;
|
||||
font-size: 1em;
|
||||
|
||||
i { font-size: 1.2em; }
|
||||
i { font-size: 1.2em; }
|
||||
|
||||
&.title {
|
||||
margin: 0;
|
||||
&.title {
|
||||
margin: 0;
|
||||
text-align: center;
|
||||
padding: 0.5em 1em;
|
||||
font-size: 1.75em;
|
||||
@@ -70,7 +70,7 @@ body > header {
|
||||
margin: 0;
|
||||
padding-left: 0.5em;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -101,33 +101,237 @@ body > header {
|
||||
}
|
||||
}
|
||||
|
||||
/// Small screens
|
||||
@media screen and (max-width: 600px) {
|
||||
@keyframes menuOpening {
|
||||
from {
|
||||
transform: scaleX(0);
|
||||
transform-origin: left;
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
transform: scaleX(1);
|
||||
transform-origin: left;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
@-webkit-keyframes menuOpening {
|
||||
from {
|
||||
-webkit-transform: scaleX(0);
|
||||
transform-origin: left;
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
-webkit-transform: scaleX(1);
|
||||
transform-origin: left;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
body > header {
|
||||
flex-direction: column;
|
||||
|
||||
nav#menu {
|
||||
display: inline-flex;
|
||||
z-index: 21;
|
||||
}
|
||||
|
||||
#content {
|
||||
display: none;
|
||||
appearance: none;
|
||||
text-align: center;
|
||||
z-index: 20;
|
||||
}
|
||||
}
|
||||
|
||||
body > header:focus-within #content, .show + #content {
|
||||
position: fixed;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-start;
|
||||
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
|
||||
animation: 0.2s menuOpening;
|
||||
|
||||
&::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
transform: skewX(-10deg);
|
||||
top: 0;
|
||||
left: -20%;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
z-index: -10;
|
||||
|
||||
background: $primary;
|
||||
}
|
||||
|
||||
> nav {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
|
||||
a {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
margin: 0;
|
||||
padding: 1rem 1.5rem;
|
||||
color: $background;
|
||||
font-size: 1.4em;
|
||||
font-weight: 300;
|
||||
|
||||
&.title { font-size: 1.8em; }
|
||||
|
||||
> *:first-child { width: 3rem; }
|
||||
> img:first-child { height: 3rem; }
|
||||
> *:last-child { margin-left: 1rem; }
|
||||
> nav hr {
|
||||
display: block;
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
border: solid $background 0.1rem;
|
||||
}
|
||||
.mobile-label { display: initial; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Only enable label animations on large screens */
|
||||
@media screen and (min-width: 600px) {
|
||||
header nav a {
|
||||
i {
|
||||
transition: all 0.2s ease;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.mobile-label {
|
||||
transition: all 0.2s ease;
|
||||
display: block;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
transform: translate(-50%, 0);
|
||||
opacity: 0;
|
||||
font-size: 0.9em;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
img + .mobile-label { display: none; }
|
||||
|
||||
&:hover {
|
||||
i { margin-bottom: 0.75em; }
|
||||
.mobile-label {
|
||||
opacity: 1;
|
||||
transform: translate(-50%, 80%);
|
||||
}
|
||||
header nav a {
|
||||
i {
|
||||
transition: all 0.2s ease;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.mobile-label {
|
||||
transition: all 0.2s ease;
|
||||
display: block;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
transform: translateZ(0);
|
||||
opacity: 0;
|
||||
font-size: 0.9em;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
img + .mobile-label { display: none; }
|
||||
|
||||
&:hover {
|
||||
i { margin-bottom: 0.75em; }
|
||||
.mobile-label {
|
||||
opacity: 1;
|
||||
transform: translate(-50%, 80%);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Small screens
|
||||
@media screen and (max-width: 600px) {
|
||||
@keyframes menuOpening {
|
||||
from {
|
||||
transform: scaleX(0);
|
||||
transform-origin: left;
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
transform: scaleX(1);
|
||||
transform-origin: left;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
@-webkit-keyframes menuOpening {
|
||||
from {
|
||||
-webkit-transform: scaleX(0);
|
||||
transform-origin: left;
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
-webkit-transform: scaleX(1);
|
||||
transform-origin: left;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
body > header {
|
||||
flex-direction: column;
|
||||
|
||||
nav#menu {
|
||||
display: inline-flex;
|
||||
z-index: 21;
|
||||
}
|
||||
|
||||
#content {
|
||||
display: none;
|
||||
appearance: none;
|
||||
text-align: center;
|
||||
z-index: 20;
|
||||
}
|
||||
}
|
||||
|
||||
body > header:focus-within #content, .show + #content {
|
||||
position: fixed;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-start;
|
||||
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
|
||||
animation: 0.2s menuOpening;
|
||||
|
||||
&::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
transform: skewX(-10deg);
|
||||
top: 0;
|
||||
left: -20%;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
z-index: -10;
|
||||
|
||||
background: $primary;
|
||||
}
|
||||
|
||||
> nav {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
|
||||
a {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
margin: 0;
|
||||
padding: 1rem 1.5rem;
|
||||
color: $background;
|
||||
font-size: 1.4em;
|
||||
font-weight: 300;
|
||||
|
||||
&.title { font-size: 1.8em; }
|
||||
|
||||
> *:first-child { width: 3rem; }
|
||||
> img:first-child { height: 3rem; }
|
||||
> *:last-child { margin-left: 1rem; }
|
||||
> nav hr {
|
||||
display: block;
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
border: solid $background 0.1rem;
|
||||
}
|
||||
.mobile-label { display: initial; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/* Color Scheme */
|
||||
$gray: #F3F3F3;
|
||||
$gray: #f3f3f3;
|
||||
$black: #242424;
|
||||
$white: #F8F8F8;
|
||||
$purple: #7765E3;
|
||||
$white: #f8f8f8;
|
||||
$purple: #7765e3;
|
||||
$lightpurple: #c2bbee;
|
||||
$red: #E92F2F;
|
||||
$red: #e92f2f;
|
||||
$yellow: #ffe347;
|
||||
$green: #23f0c7;
|
||||
|
||||
@@ -24,6 +24,14 @@ $margin: 0 $horizontal-margin;
|
||||
|
||||
/* Fonts */
|
||||
|
||||
$route159: "Route159", serif;
|
||||
$playfair: "Playfair Display", serif;
|
||||
$lora: "Lora", serif;
|
||||
$route159: "Shabnam", "Route159", serif;
|
||||
$playfair: "Vazir", "Playfair Display", serif;
|
||||
$lora: "Vazir", "Lora", serif;
|
||||
|
||||
//Code Highlighting
|
||||
$code-keyword-color: #45244a;
|
||||
$code-source-color: #4c588c;
|
||||
$code-constant-color: scale-color(magenta, $lightness: -5%);
|
||||
$code-operator-color: scale-color($code-source-color, $lightness: -5%);
|
||||
$code-string-color: #8a571c;
|
||||
$code-comment-color: #1c4c8a;
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
/* color palette: https://coolors.co/23f0c7-ef767a-7765e3-6457a6-ffe347 */
|
||||
|
||||
@import url('./feather.css');
|
||||
@import url('./fonts/Route159/Route159.css');
|
||||
@import url('./fonts/Lora/Lora.css');
|
||||
@import url('./fonts/Playfair_Display/PlayfairDisplay.css');
|
||||
@import url("./feather.css");
|
||||
@import url("./fonts/Route159/Route159.css");
|
||||
@import url("./fonts/Lora/Lora.css");
|
||||
@import url("./fonts/Playfair_Display/PlayfairDisplay.css");
|
||||
@import url("./fonts/Vazir_WOL/Vazir_WOL.css");
|
||||
@import url("./fonts/Shabnam_WOL/Shabnam_WOL.css");
|
||||
|
||||
@import 'dark_variables';
|
||||
@import 'global';
|
||||
@import 'header';
|
||||
@import 'article';
|
||||
@import 'forms';
|
||||
@import "dark_variables";
|
||||
@import "global";
|
||||
@import "header";
|
||||
@import "article";
|
||||
@import "forms";
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
Copyright (c) 2015, Saber Rastikerdar (saber.rastikerdar@gmail.com),
|
||||
Glyphs and data from Roboto font are licensed under the Apache License, Version 2.0.
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
http://scripts.sil.org/OFL
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,49 @@
|
||||
@font-face {
|
||||
font-family: Shabnam;
|
||||
src: url("Shabnam-WOL.eot");
|
||||
src: url("Shabnam-WOL.eot?#iefix") format("embedded-opentype"),
|
||||
url("Shabnam-WOL.woff2") format("woff2"),
|
||||
url("Shabnam-WOL.woff") format("woff"),
|
||||
url("Shabnam-WOL.ttf") format("truetype");
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: Shabnam;
|
||||
src: url("Shabnam-Bold-WOL.eot");
|
||||
src: url("Shabnam-Bold-WOL.eot?#iefix") format("embedded-opentype"),
|
||||
url("Shabnam-Bold-WOL.woff2") format("woff2"),
|
||||
url("Shabnam-Bold-WOL.woff") format("woff"),
|
||||
url("Shabnam-Bold-WOL.ttf") format("truetype");
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: Shabnam;
|
||||
src: url("Shabnam-Thin-WOL.eot");
|
||||
src: url("Shabnam-Thin-WOL.eot?#iefix") format("embedded-opentype"),
|
||||
url("Shabnam-Thin-WOL.woff2") format("woff2"),
|
||||
url("Shabnam-Thin-WOL.woff") format("woff"),
|
||||
url("Shabnam-Thin-WOL.ttf") format("truetype");
|
||||
font-weight: 100;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: Shabnam;
|
||||
src: url("Shabnam-Light-WOL.eot");
|
||||
src: url("Shabnam-Light-WOL.eot?#iefix") format("embedded-opentype"),
|
||||
url("Shabnam-Light-WOL.woff2") format("woff2"),
|
||||
url("Shabnam-Light-WOL.woff") format("woff"),
|
||||
url("Shabnam-Light-WOL.ttf") format("truetype");
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: Shabnam;
|
||||
src: url("Shabnam-Medium-WOL.eot");
|
||||
src: url("Shabnam-Medium-WOL.eot?#iefix") format("embedded-opentype"),
|
||||
url("Shabnam-Medium-WOL.woff2") format("woff2"),
|
||||
url("Shabnam-Medium-WOL.woff") format("woff"),
|
||||
url("Shabnam-Medium-WOL.ttf") format("truetype");
|
||||
font-weight: 500;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
Changes by Saber Rastikerdar (saber.rastikerdar@gmail.com) are in public domain.
|
||||
Glyphs and data from Roboto font are licensed under the Apache License, Version 2.0.
|
||||
|
||||
Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.
|
||||
|
||||
Bitstream Vera Fonts Copyright
|
||||
------------------------------
|
||||
|
||||
Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is
|
||||
a trademark of Bitstream, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of the fonts accompanying this license ("Fonts") and associated
|
||||
documentation files (the "Font Software"), to reproduce and distribute the
|
||||
Font Software, including without limitation the rights to use, copy, merge,
|
||||
publish, distribute, and/or sell copies of the Font Software, and to permit
|
||||
persons to whom the Font Software is furnished to do so, subject to the
|
||||
following conditions:
|
||||
|
||||
The above copyright and trademark notices and this permission notice shall
|
||||
be included in all copies of one or more of the Font Software typefaces.
|
||||
|
||||
The Font Software may be modified, altered, or added to, and in particular
|
||||
the designs of glyphs or characters in the Fonts may be modified and
|
||||
additional glyphs or characters may be added to the Fonts, only if the fonts
|
||||
are renamed to names not containing either the words "Bitstream" or the word
|
||||
"Vera".
|
||||
|
||||
This License becomes null and void to the extent applicable to Fonts or Font
|
||||
Software that has been modified and is distributed under the "Bitstream
|
||||
Vera" names.
|
||||
|
||||
The Font Software may be sold as part of a larger software package but no
|
||||
copy of one or more of the Font Software typefaces may be sold by itself.
|
||||
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
|
||||
TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME
|
||||
FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING
|
||||
ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE
|
||||
FONT SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the names of Gnome, the Gnome
|
||||
Foundation, and Bitstream Inc., shall not be used in advertising or
|
||||
otherwise to promote the sale, use or other dealings in this Font Software
|
||||
without prior written authorization from the Gnome Foundation or Bitstream
|
||||
Inc., respectively. For further information, contact: fonts at gnome dot
|
||||
org.
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,65 @@
|
||||
@font-face {
|
||||
font-family: Vazir;
|
||||
src: url('Vazir-WOL.eot');
|
||||
src: url('Vazir-WOL.eot?#iefix') format('embedded-opentype'),
|
||||
url('Vazir-WOL.woff2') format('woff2'),
|
||||
url('Vazir-WOL.woff') format('woff'),
|
||||
url('Vazir-WOL.ttf') format('truetype');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: Vazir;
|
||||
src: url('Vazir-Bold-WOL.eot');
|
||||
src: url('Vazir-Bold-WOL.eot?#iefix') format('embedded-opentype'),
|
||||
url('Vazir-Bold-WOL.woff2') format('woff2'),
|
||||
url('Vazir-Bold-WOL.woff') format('woff'),
|
||||
url('Vazir-Bold-WOL.ttf') format('truetype');
|
||||
font-weight: bold;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: Vazir;
|
||||
src: url('Vazir-Black-WOL.eot');
|
||||
src: url('Vazir-Black-WOL.eot?#iefix') format('embedded-opentype'),
|
||||
url('Vazir-Black-WOL.woff2') format('woff2'),
|
||||
url('Vazir-Black-WOL.woff') format('woff'),
|
||||
url('Vazir-Black-WOL.ttf') format('truetype');
|
||||
font-weight: 900;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: Vazir;
|
||||
src: url('Vazir-Medium-WOL.eot');
|
||||
src: url('Vazir-Medium-WOL.eot?#iefix') format('embedded-opentype'),
|
||||
url('Vazir-Medium-WOL.woff2') format('woff2'),
|
||||
url('Vazir-Medium-WOL.woff') format('woff'),
|
||||
url('Vazir-Medium-WOL.ttf') format('truetype');
|
||||
font-weight: 500;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: Vazir;
|
||||
src: url('Vazir-Light-WOL.eot');
|
||||
src: url('Vazir-Light-WOL.eot?#iefix') format('embedded-opentype'),
|
||||
url('Vazir-Light-WOL.woff2') format('woff2'),
|
||||
url('Vazir-Light-WOL.woff') format('woff'),
|
||||
url('Vazir-Light-WOL.ttf') format('truetype');
|
||||
font-weight: 300;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: Vazir;
|
||||
src: url('Vazir-Thin-WOL.eot');
|
||||
src: url('Vazir-Thin-WOL.eot?#iefix') format('embedded-opentype'),
|
||||
url('Vazir-Thin-WOL.woff2') format('woff2'),
|
||||
url('Vazir-Thin-WOL.woff') format('woff'),
|
||||
url('Vazir-Thin-WOL.ttf') format('truetype');
|
||||
font-weight: 100;
|
||||
font-style: normal;
|
||||
}
|
||||
@@ -1,12 +1,14 @@
|
||||
/* color palette: https://coolors.co/23f0c7-ef767a-7765e3-6457a6-ffe347 */
|
||||
|
||||
@import url('./feather.css');
|
||||
@import url('./fonts/Route159/Route159.css');
|
||||
@import url('./fonts/Lora/Lora.css');
|
||||
@import url('./fonts/Playfair_Display/PlayfairDisplay.css');
|
||||
@import url("./feather.css");
|
||||
@import url("./fonts/Route159/Route159.css");
|
||||
@import url("./fonts/Lora/Lora.css");
|
||||
@import url("./fonts/Playfair_Display/PlayfairDisplay.css");
|
||||
@import url("./fonts/Vazir_WOL/Vazir_WOL.css");
|
||||
@import url("./fonts/Shabnam_WOL/Shabnam_WOL.css");
|
||||
|
||||
@import 'variables';
|
||||
@import 'global';
|
||||
@import 'header';
|
||||
@import 'article';
|
||||
@import 'forms';
|
||||
@import "variables";
|
||||
@import "global";
|
||||
@import "header";
|
||||
@import "article";
|
||||
@import "forms";
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
extern crate rsass;
|
||||
extern crate ructe;
|
||||
use ructe::Ructe;
|
||||
use std::process::{Command, Stdio};
|
||||
use std::{env, ffi::OsStr, fs::*, io::Write, path::*};
|
||||
use std::{ffi::OsStr, fs::*, io::Write, path::*};
|
||||
|
||||
fn compute_static_hash() -> String {
|
||||
//"find static/ -type f ! -path 'static/media/*' | sort | xargs stat -c'%n %Y' | openssl dgst -r"
|
||||
@@ -50,19 +48,13 @@ fn main() {
|
||||
create_dir_all(&Path::new("static").join("media")).expect("Couldn't init media directory");
|
||||
|
||||
let cache_id = &compute_static_hash()[..8];
|
||||
println!("cargo:rerun-if-changed=target/deploy/plume-front.wasm");
|
||||
copy("target/deploy/plume-front.wasm", "static/plume-front.wasm")
|
||||
.and_then(|_| read_to_string("target/deploy/plume-front.js"))
|
||||
.and_then(|js| {
|
||||
write(
|
||||
"static/plume-front.js",
|
||||
js.replace(
|
||||
"\"plume-front.wasm\"",
|
||||
&format!("\"/static/cached/{}/plume-front.wasm\"", cache_id),
|
||||
),
|
||||
)
|
||||
})
|
||||
.ok();
|
||||
println!("cargo:rerun-if-changed=plume-front/pkg/plume_front_bg.wasm");
|
||||
copy(
|
||||
"plume-front/pkg/plume_front_bg.wasm",
|
||||
"static/plume_front_bg.wasm",
|
||||
)
|
||||
.and_then(|_| copy("plume-front/pkg/plume_front.js", "static/plume_front.js"))
|
||||
.ok();
|
||||
|
||||
println!("cargo:rustc-env=CACHE_ID={}", cache_id)
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
"project_identifier": "plume"
|
||||
"api_key_env": CROWDIN_API_KEY
|
||||
"project_id": 352097
|
||||
"api_token_env": "CROWDIN_API_KEY"
|
||||
preserve_hierarchy: true
|
||||
files:
|
||||
- source: /po/plume/plume.pot
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
-- This file should undo anything in `up.sql`
|
||||
|
||||
drop table email_blocklist;
|
||||
@@ -0,0 +1,6 @@
|
||||
-- Your SQL goes here
|
||||
CREATE TABLE email_blocklist(id SERIAL PRIMARY KEY,
|
||||
email_address TEXT UNIQUE,
|
||||
note TEXT,
|
||||
notify_user BOOLEAN DEFAULT FALSE,
|
||||
notification_text TEXT);
|
||||
@@ -0,0 +1 @@
|
||||
DROP INDEX medias_index_file_path;
|
||||
@@ -0,0 +1 @@
|
||||
CREATE INDEX medias_index_file_path ON medias (file_path);
|
||||
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE instances DROP COLUMN private_key;
|
||||
ALTER TABLE instances DROP COLUMN public_key;
|
||||
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE instances ADD COLUMN private_key TEXT;
|
||||
ALTER TABLE instances ADD COLUMN public_key TEXT;
|
||||
@@ -0,0 +1,3 @@
|
||||
-- This file should undo anything in `up.sql`
|
||||
|
||||
drop table email_blocklist;
|
||||
@@ -0,0 +1,6 @@
|
||||
-- Your SQL goes here
|
||||
CREATE TABLE email_blocklist(id INTEGER PRIMARY KEY,
|
||||
email_address TEXT UNIQUE,
|
||||
note TEXT,
|
||||
notify_user BOOLEAN DEFAULT FALSE,
|
||||
notification_text TEXT);
|
||||
@@ -0,0 +1 @@
|
||||
DROP INDEX medias_index_file_path;
|
||||
@@ -0,0 +1 @@
|
||||
CREATE INDEX medias_index_file_path ON medias (file_path);
|
||||
@@ -0,0 +1,30 @@
|
||||
CREATE TABLE instances_old (
|
||||
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
public_domain VARCHAR NOT NULL,
|
||||
name VARCHAR NOT NULL,
|
||||
local BOOLEAN NOT NULL DEFAULT 'f',
|
||||
blocked BOOLEAN NOT NULL DEFAULT 'f',
|
||||
creation_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
open_registrations BOOLEAN NOT NULL DEFAULT 't',
|
||||
short_description TEXT NOT NULL DEFAULT '',
|
||||
long_description TEXT NOT NULL DEFAULT '',
|
||||
default_license TEXT NOT NULL DEFAULT 'CC-0',
|
||||
long_description_html VARCHAR NOT NULL DEFAULT '',
|
||||
short_description_html VARCHAR NOT NULL DEFAULT ''
|
||||
);
|
||||
INSERT INTO instances_old SELECT
|
||||
id,
|
||||
public_domain,
|
||||
name,
|
||||
local,
|
||||
blocked,
|
||||
creation_date,
|
||||
open_registrations,
|
||||
short_description,
|
||||
long_description,
|
||||
default_license,
|
||||
long_description_html,
|
||||
short_description_html
|
||||
FROM instances;
|
||||
DROP TABLE instances;
|
||||
ALTER TABLE instances_old RENAME TO instances;
|
||||
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE instances ADD COLUMN private_key TEXT;
|
||||
ALTER TABLE instances ADD COLUMN public_key TEXT;
|
||||
@@ -1,7 +1,8 @@
|
||||
[package]
|
||||
name = "plume-api"
|
||||
version = "0.3.0"
|
||||
version = "0.6.1-dev"
|
||||
authors = ["Plume contributors"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
serde = "1.0"
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
pre-release-hook = ["cargo", "fmt"]
|
||||
pre-release-replacements = []
|
||||
@@ -1,4 +1,3 @@
|
||||
extern crate serde;
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[package]
|
||||
name = "plume-cli"
|
||||
version = "0.3.0"
|
||||
version = "0.6.1-dev"
|
||||
authors = ["Plume contributors"]
|
||||
edition = "2018"
|
||||
|
||||
[[bin]]
|
||||
name = "plm"
|
||||
@@ -10,11 +11,11 @@ path = "src/main.rs"
|
||||
[dependencies]
|
||||
clap = "2.33"
|
||||
dotenv = "0.14"
|
||||
rpassword = "4.0"
|
||||
rpassword = "5.0.0"
|
||||
|
||||
[dependencies.diesel]
|
||||
features = ["r2d2", "chrono"]
|
||||
version = "*"
|
||||
version = "1.4.5"
|
||||
|
||||
[dependencies.plume-models]
|
||||
path = "../plume-models"
|
||||
@@ -22,3 +23,4 @@ path = "../plume-models"
|
||||
[features]
|
||||
postgres = ["plume-models/postgres", "diesel/postgres"]
|
||||
sqlite = ["plume-models/sqlite", "diesel/sqlite"]
|
||||
search-lindera = ["plume-models/search-lindera"]
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
pre-release-hook = ["cargo", "fmt"]
|
||||
pre-release-replacements = []
|
||||
@@ -1,6 +1,6 @@
|
||||
use clap::{App, Arg, ArgMatches, SubCommand};
|
||||
|
||||
use plume_models::{instance::*, safe_string::SafeString, Connection};
|
||||
use plume_models::{instance::NewInstance, Connection};
|
||||
use std::env;
|
||||
|
||||
pub fn command<'a, 'b>() -> App<'a, 'b> {
|
||||
@@ -53,19 +53,5 @@ fn new<'a>(args: &ArgMatches<'a>, conn: &Connection) {
|
||||
.unwrap_or_else(|| String::from("CC-BY-SA"));
|
||||
let open_reg = !args.is_present("private");
|
||||
|
||||
Instance::insert(
|
||||
conn,
|
||||
NewInstance {
|
||||
public_domain: domain,
|
||||
name,
|
||||
local: true,
|
||||
long_description: SafeString::new(""),
|
||||
short_description: SafeString::new(""),
|
||||
default_license: license,
|
||||
open_registrations: open_reg,
|
||||
short_description_html: String::new(),
|
||||
long_description_html: String::new(),
|
||||
},
|
||||
)
|
||||
.expect("Couldn't save instance");
|
||||
NewInstance::new_local(conn, domain, name, open_reg, license).expect("Couldn't save instance");
|
||||
}
|
||||
|
||||
@@ -1,9 +1,3 @@
|
||||
extern crate clap;
|
||||
extern crate diesel;
|
||||
extern crate dotenv;
|
||||
extern crate plume_models;
|
||||
extern crate rpassword;
|
||||
|
||||
use clap::App;
|
||||
use diesel::Connection;
|
||||
use plume_models::{instance::Instance, Connection as Conn, CONFIG};
|
||||
|
||||
@@ -82,7 +82,7 @@ fn init<'a>(args: &ArgMatches<'a>, conn: &Connection) {
|
||||
}
|
||||
};
|
||||
if can_do || force {
|
||||
let searcher = Searcher::create(&path).unwrap();
|
||||
let searcher = Searcher::create(&path, &CONFIG.search_tokenizers).unwrap();
|
||||
refill(args, conn, Some(searcher));
|
||||
} else {
|
||||
eprintln!(
|
||||
@@ -98,14 +98,15 @@ fn refill<'a>(args: &ArgMatches<'a>, conn: &Connection, searcher: Option<Searche
|
||||
Some(path) => Path::new(path).join("search_index"),
|
||||
None => Path::new(&CONFIG.search_index).to_path_buf(),
|
||||
};
|
||||
let searcher = searcher.unwrap_or_else(|| Searcher::open(&path).unwrap());
|
||||
let searcher =
|
||||
searcher.unwrap_or_else(|| Searcher::open(&path, &CONFIG.search_tokenizers).unwrap());
|
||||
|
||||
searcher.fill(conn).expect("Couldn't import post");
|
||||
println!("Commiting result");
|
||||
searcher.commit();
|
||||
}
|
||||
|
||||
fn unlock<'a>(args: &ArgMatches<'a>) {
|
||||
fn unlock(args: &ArgMatches) {
|
||||
let path = match args.value_of("path") {
|
||||
None => Path::new(&CONFIG.search_index),
|
||||
Some(x) => Path::new(x),
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
use clap::{App, Arg, ArgMatches, SubCommand};
|
||||
|
||||
use plume_models::{instance::Instance, users::*, Connection};
|
||||
use rpassword;
|
||||
use std::io::{self, Write};
|
||||
|
||||
pub fn command<'a, 'b>() -> App<'a, 'b> {
|
||||
@@ -132,7 +131,7 @@ fn new<'a>(args: &ArgMatches<'a>, conn: &Connection) {
|
||||
role,
|
||||
&bio,
|
||||
email,
|
||||
User::hash_pass(&password).expect("Couldn't hash password"),
|
||||
Some(User::hash_pass(&password).expect("Couldn't hash password")),
|
||||
)
|
||||
.expect("Couldn't save new user");
|
||||
}
|
||||
|
||||
+10
-5
@@ -1,7 +1,8 @@
|
||||
[package]
|
||||
name = "plume-common"
|
||||
version = "0.3.0"
|
||||
version = "0.6.1-dev"
|
||||
authors = ["Plume contributors"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
activitypub = "0.1.1"
|
||||
@@ -13,13 +14,16 @@ heck = "0.3.0"
|
||||
hex = "0.3"
|
||||
hyper = "0.12.33"
|
||||
openssl = "0.10.22"
|
||||
rocket = "0.4.0"
|
||||
reqwest = "0.9"
|
||||
rocket = "=0.4.6"
|
||||
reqwest = { version = "0.9", features = ["socks"] }
|
||||
serde = "1.0"
|
||||
serde_derive = "1.0"
|
||||
serde_json = "1.0"
|
||||
shrinkwraprs = "0.2.1"
|
||||
shrinkwraprs = "0.3.0"
|
||||
syntect = "4.5.0"
|
||||
tokio = "0.1.22"
|
||||
regex-syntax = { version = "0.6.17", default-features = false, features = ["unicode-perl"] }
|
||||
tracing = "0.1.22"
|
||||
|
||||
[dependencies.chrono]
|
||||
features = ["serde"]
|
||||
@@ -27,4 +31,5 @@ version = "0.4"
|
||||
|
||||
[dependencies.pulldown-cmark]
|
||||
default-features = false
|
||||
version = "0.2.0"
|
||||
git = "https://git.joinplu.me/Plume/pulldown-cmark"
|
||||
branch = "bidi-plume"
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
pre-release-hook = ["cargo", "fmt"]
|
||||
pre-release-replacements = []
|
||||
@@ -1,6 +1,11 @@
|
||||
use reqwest::header::{HeaderValue, ACCEPT};
|
||||
use std::fmt::Debug;
|
||||
|
||||
use super::{request, sign::Signer};
|
||||
use reqwest::{
|
||||
header::{HeaderValue, HOST},
|
||||
Url,
|
||||
};
|
||||
|
||||
/// Represents an ActivityPub inbox.
|
||||
///
|
||||
/// It routes an incoming Activity through the registered handlers.
|
||||
@@ -10,7 +15,8 @@ use std::fmt::Debug;
|
||||
/// ```rust
|
||||
/// # extern crate activitypub;
|
||||
/// # use activitypub::{actor::Person, activity::{Announce, Create}, object::Note};
|
||||
/// # use plume_common::activity_pub::inbox::*;
|
||||
/// # use openssl::{hash::MessageDigest, pkey::PKey, rsa::Rsa};
|
||||
/// # use plume_common::activity_pub::{inbox::*, sign::{gen_keypair, Error as SignatureError, Result as SignatureResult, Signer}};
|
||||
/// # struct User;
|
||||
/// # impl FromId<()> for User {
|
||||
/// # type Error = ();
|
||||
@@ -59,6 +65,42 @@ use std::fmt::Debug;
|
||||
/// # Ok(())
|
||||
/// # }
|
||||
/// # }
|
||||
/// # struct MySigner {
|
||||
/// # public_key: String,
|
||||
/// # private_key: String,
|
||||
/// # }
|
||||
/// #
|
||||
/// # impl MySigner {
|
||||
/// # fn new() -> Self {
|
||||
/// # let (pub_key, priv_key) = gen_keypair();
|
||||
/// # Self {
|
||||
/// # public_key: String::from_utf8(pub_key).unwrap(),
|
||||
/// # private_key: String::from_utf8(priv_key).unwrap(),
|
||||
/// # }
|
||||
/// # }
|
||||
/// # }
|
||||
/// #
|
||||
/// # impl Signer for MySigner {
|
||||
/// # fn get_key_id(&self) -> String {
|
||||
/// # "mysigner".into()
|
||||
/// # }
|
||||
/// #
|
||||
/// # fn sign(&self, to_sign: &str) -> SignatureResult<Vec<u8>> {
|
||||
/// # let key = PKey::from_rsa(Rsa::private_key_from_pem(self.private_key.as_ref()).unwrap())
|
||||
/// # .unwrap();
|
||||
/// # let mut signer = openssl::sign::Signer::new(MessageDigest::sha256(), &key).unwrap();
|
||||
/// # signer.update(to_sign.as_bytes()).unwrap();
|
||||
/// # signer.sign_to_vec().map_err(|_| SignatureError())
|
||||
/// # }
|
||||
/// #
|
||||
/// # fn verify(&self, data: &str, signature: &[u8]) -> SignatureResult<bool> {
|
||||
/// # let key = PKey::from_rsa(Rsa::public_key_from_pem(self.public_key.as_ref()).unwrap())
|
||||
/// # .unwrap();
|
||||
/// # let mut verifier = openssl::sign::Verifier::new(MessageDigest::sha256(), &key).unwrap();
|
||||
/// # verifier.update(data.as_bytes()).unwrap();
|
||||
/// # verifier.verify(&signature).map_err(|_| SignatureError())
|
||||
/// # }
|
||||
/// # }
|
||||
/// #
|
||||
/// # let mut act = Create::default();
|
||||
/// # act.object_props.set_id_string(String::from("https://test.ap/activity")).unwrap();
|
||||
@@ -69,10 +111,11 @@ use std::fmt::Debug;
|
||||
/// # let activity_json = serde_json::to_value(act).unwrap();
|
||||
/// #
|
||||
/// # let conn = ();
|
||||
/// # let sender = MySigner::new();
|
||||
/// #
|
||||
/// let result: Result<(), ()> = Inbox::handle(&conn, activity_json)
|
||||
/// .with::<User, Announce, Message>()
|
||||
/// .with::<User, Create, Message>()
|
||||
/// let result: Result<(), ()> = Inbox::handle(&conn, &sender, activity_json)
|
||||
/// .with::<User, Announce, Message>(None)
|
||||
/// .with::<User, Create, Message>(None)
|
||||
/// .done();
|
||||
/// ```
|
||||
pub enum Inbox<'a, C, E, R>
|
||||
@@ -84,9 +127,10 @@ where
|
||||
/// # Structure
|
||||
///
|
||||
/// - the context to be passed to each handler.
|
||||
/// - the sender actor to sign request
|
||||
/// - the activity
|
||||
/// - the reason it has not been handled yet
|
||||
NotHandled(&'a C, serde_json::Value, InboxError<E>),
|
||||
NotHandled(&'a C, &'a dyn Signer, serde_json::Value, InboxError<E>),
|
||||
|
||||
/// A matching handler have been found but failed
|
||||
///
|
||||
@@ -139,36 +183,49 @@ where
|
||||
///
|
||||
/// - `ctx`: the context to pass to each handler
|
||||
/// - `json`: the JSON representation of the incoming activity
|
||||
pub fn handle(ctx: &'a C, json: serde_json::Value) -> Inbox<'a, C, E, R> {
|
||||
Inbox::NotHandled(ctx, json, InboxError::NoMatch)
|
||||
pub fn handle(
|
||||
ctx: &'a C,
|
||||
sender: &'a dyn Signer,
|
||||
json: serde_json::Value,
|
||||
) -> Inbox<'a, C, E, R> {
|
||||
Inbox::NotHandled(ctx, sender, json, InboxError::NoMatch)
|
||||
}
|
||||
|
||||
/// Registers an handler on this Inbox.
|
||||
pub fn with<A, V, M>(self) -> Inbox<'a, C, E, R>
|
||||
pub fn with<A, V, M>(self, proxy: Option<&reqwest::Proxy>) -> Inbox<'a, C, E, R>
|
||||
where
|
||||
A: AsActor<&'a C> + FromId<C, Error = E>,
|
||||
V: activitypub::Activity,
|
||||
M: AsObject<A, V, &'a C, Error = E> + FromId<C, Error = E>,
|
||||
M::Output: Into<R>,
|
||||
{
|
||||
if let Inbox::NotHandled(ctx, mut act, e) = self {
|
||||
if let Inbox::NotHandled(ctx, sender, mut act, e) = self {
|
||||
if serde_json::from_value::<V>(act.clone()).is_ok() {
|
||||
let act_clone = act.clone();
|
||||
let act_id = match act_clone["id"].as_str() {
|
||||
Some(x) => x,
|
||||
None => return Inbox::NotHandled(ctx, act, InboxError::InvalidID),
|
||||
None => return Inbox::NotHandled(ctx, sender, act, InboxError::InvalidID),
|
||||
};
|
||||
|
||||
// Get the actor ID
|
||||
let actor_id = match get_id(act["actor"].clone()) {
|
||||
Some(x) => x,
|
||||
None => return Inbox::NotHandled(ctx, act, InboxError::InvalidActor(None)),
|
||||
None => {
|
||||
return Inbox::NotHandled(ctx, sender, act, InboxError::InvalidActor(None))
|
||||
}
|
||||
};
|
||||
|
||||
if Self::is_spoofed_activity(&actor_id, &act) {
|
||||
return Inbox::NotHandled(ctx, sender, act, InboxError::InvalidObject(None));
|
||||
}
|
||||
|
||||
// Transform this actor to a model (see FromId for details about the from_id function)
|
||||
let actor = match A::from_id(
|
||||
ctx,
|
||||
sender,
|
||||
&actor_id,
|
||||
serde_json::from_value(act["actor"].clone()).ok(),
|
||||
proxy,
|
||||
) {
|
||||
Ok(a) => a,
|
||||
// If the actor was not found, go to the next handler
|
||||
@@ -176,26 +233,40 @@ where
|
||||
if let Some(json) = json {
|
||||
act["actor"] = json;
|
||||
}
|
||||
return Inbox::NotHandled(ctx, act, InboxError::InvalidActor(Some(e)));
|
||||
return Inbox::NotHandled(
|
||||
ctx,
|
||||
sender,
|
||||
act,
|
||||
InboxError::InvalidActor(Some(e)),
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
// Same logic for "object"
|
||||
let obj_id = match get_id(act["object"].clone()) {
|
||||
Some(x) => x,
|
||||
None => return Inbox::NotHandled(ctx, act, InboxError::InvalidObject(None)),
|
||||
None => {
|
||||
return Inbox::NotHandled(ctx, sender, act, InboxError::InvalidObject(None))
|
||||
}
|
||||
};
|
||||
let obj = match M::from_id(
|
||||
ctx,
|
||||
sender,
|
||||
&obj_id,
|
||||
serde_json::from_value(act["object"].clone()).ok(),
|
||||
proxy,
|
||||
) {
|
||||
Ok(o) => o,
|
||||
Err((json, e)) => {
|
||||
if let Some(json) = json {
|
||||
act["object"] = json;
|
||||
}
|
||||
return Inbox::NotHandled(ctx, act, InboxError::InvalidObject(Some(e)));
|
||||
return Inbox::NotHandled(
|
||||
ctx,
|
||||
sender,
|
||||
act,
|
||||
InboxError::InvalidObject(Some(e)),
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -207,7 +278,7 @@ where
|
||||
} else {
|
||||
// If the Activity type is not matching the expected one for
|
||||
// this handler, try with the next one.
|
||||
Inbox::NotHandled(ctx, act, e)
|
||||
Inbox::NotHandled(ctx, sender, act, e)
|
||||
}
|
||||
} else {
|
||||
self
|
||||
@@ -218,10 +289,30 @@ where
|
||||
pub fn done(self) -> Result<R, E> {
|
||||
match self {
|
||||
Inbox::Handled(res) => Ok(res),
|
||||
Inbox::NotHandled(_, _, err) => Err(E::from(err)),
|
||||
Inbox::NotHandled(_, _, _, err) => Err(E::from(err)),
|
||||
Inbox::Failed(err) => Err(err),
|
||||
}
|
||||
}
|
||||
|
||||
fn is_spoofed_activity(actor_id: &str, act: &serde_json::Value) -> bool {
|
||||
use serde_json::Value::{Array, Object, String};
|
||||
|
||||
let attributed_to = act["object"].get("attributedTo");
|
||||
if attributed_to.is_none() {
|
||||
return false;
|
||||
}
|
||||
let attributed_to = attributed_to.unwrap();
|
||||
match attributed_to {
|
||||
Array(v) => v.iter().all(|i| match i {
|
||||
String(s) => s != actor_id,
|
||||
Object(obj) => obj.get("id").map_or(true, |s| s != actor_id),
|
||||
_ => false,
|
||||
}),
|
||||
String(s) => s != actor_id,
|
||||
Object(obj) => obj.get("id").map_or(true, |s| s != actor_id),
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the ActivityPub ID of a JSON value.
|
||||
@@ -265,45 +356,60 @@ pub trait FromId<C>: Sized {
|
||||
/// If absent, the ID will be dereferenced.
|
||||
fn from_id(
|
||||
ctx: &C,
|
||||
sender: &dyn Signer,
|
||||
id: &str,
|
||||
object: Option<Self::Object>,
|
||||
proxy: Option<&reqwest::Proxy>,
|
||||
) -> Result<Self, (Option<serde_json::Value>, Self::Error)> {
|
||||
match Self::from_db(ctx, id) {
|
||||
Ok(x) => Ok(x),
|
||||
_ => match object {
|
||||
Some(o) => Self::from_activity(ctx, o).map_err(|e| (None, e)),
|
||||
None => Self::from_activity(ctx, Self::deref(id)?).map_err(|e| (None, e)),
|
||||
None => Self::from_activity(ctx, Self::deref(id, sender, proxy.cloned())?)
|
||||
.map_err(|e| (None, e)),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
/// Dereferences an ID
|
||||
fn deref(id: &str) -> Result<Self::Object, (Option<serde_json::Value>, Self::Error)> {
|
||||
reqwest::ClientBuilder::new()
|
||||
.connect_timeout(Some(std::time::Duration::from_secs(5)))
|
||||
.build()
|
||||
.map_err(|_| (None, InboxError::DerefError.into()))?
|
||||
.get(id)
|
||||
.header(
|
||||
ACCEPT,
|
||||
HeaderValue::from_str(
|
||||
&super::ap_accept_header()
|
||||
.into_iter()
|
||||
.collect::<Vec<_>>()
|
||||
.join(", "),
|
||||
)
|
||||
fn deref(
|
||||
id: &str,
|
||||
sender: &dyn Signer,
|
||||
proxy: Option<reqwest::Proxy>,
|
||||
) -> Result<Self::Object, (Option<serde_json::Value>, Self::Error)> {
|
||||
let mut headers = request::headers();
|
||||
let url = Url::parse(&id).map_err(|_| (None, InboxError::InvalidID.into()))?;
|
||||
if !url.has_host() {
|
||||
return Err((None, InboxError::InvalidID.into()));
|
||||
}
|
||||
let host_header_value = HeaderValue::from_str(&url.host_str().expect("Unreachable"))
|
||||
.map_err(|_| (None, InboxError::DerefError.into()))?;
|
||||
headers.insert(HOST, host_header_value);
|
||||
if let Some(proxy) = proxy {
|
||||
reqwest::ClientBuilder::new().proxy(proxy)
|
||||
} else {
|
||||
reqwest::ClientBuilder::new()
|
||||
}
|
||||
.connect_timeout(Some(std::time::Duration::from_secs(5)))
|
||||
.build()
|
||||
.map_err(|_| (None, InboxError::DerefError.into()))?
|
||||
.get(id)
|
||||
.headers(headers.clone())
|
||||
.header(
|
||||
"Signature",
|
||||
request::signature(sender, &headers, ("get", url.path(), url.query()))
|
||||
.map_err(|_| (None, InboxError::DerefError.into()))?,
|
||||
)
|
||||
.send()
|
||||
.map_err(|_| (None, InboxError::DerefError))
|
||||
.and_then(|mut r| {
|
||||
let json: serde_json::Value = r
|
||||
.json()
|
||||
.map_err(|_| (None, InboxError::InvalidObject(None)))?;
|
||||
serde_json::from_value(json.clone())
|
||||
.map_err(|_| (Some(json), InboxError::InvalidObject(None)))
|
||||
})
|
||||
.map_err(|(json, e)| (json, e.into()))
|
||||
)
|
||||
.send()
|
||||
.map_err(|_| (None, InboxError::DerefError))
|
||||
.and_then(|mut r| {
|
||||
let json: serde_json::Value = r
|
||||
.json()
|
||||
.map_err(|_| (None, InboxError::InvalidObject(None)))?;
|
||||
serde_json::from_value(json.clone())
|
||||
.map_err(|_| (Some(json), InboxError::InvalidObject(None)))
|
||||
})
|
||||
.map_err(|(json, e)| (json, e.into()))
|
||||
}
|
||||
|
||||
/// Builds a `Self` from its ActivityPub representation
|
||||
@@ -422,8 +528,10 @@ where
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::super::sign::{gen_keypair, Error as SignatureError, Result as SignatureResult};
|
||||
use super::*;
|
||||
use activitypub::{activity::*, actor::Person, object::Note};
|
||||
use openssl::{hash::MessageDigest, pkey::PKey, rsa::Rsa};
|
||||
|
||||
struct MyActor;
|
||||
impl FromId<()> for MyActor {
|
||||
@@ -521,11 +629,48 @@ mod tests {
|
||||
act
|
||||
}
|
||||
|
||||
struct MySigner {
|
||||
public_key: String,
|
||||
private_key: String,
|
||||
}
|
||||
|
||||
impl MySigner {
|
||||
fn new() -> Self {
|
||||
let (pub_key, priv_key) = gen_keypair();
|
||||
Self {
|
||||
public_key: String::from_utf8(pub_key).unwrap(),
|
||||
private_key: String::from_utf8(priv_key).unwrap(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Signer for MySigner {
|
||||
fn get_key_id(&self) -> String {
|
||||
"mysigner".into()
|
||||
}
|
||||
|
||||
fn sign(&self, to_sign: &str) -> SignatureResult<Vec<u8>> {
|
||||
let key = PKey::from_rsa(Rsa::private_key_from_pem(self.private_key.as_ref()).unwrap())
|
||||
.unwrap();
|
||||
let mut signer = openssl::sign::Signer::new(MessageDigest::sha256(), &key).unwrap();
|
||||
signer.update(to_sign.as_bytes()).unwrap();
|
||||
signer.sign_to_vec().map_err(|_| SignatureError())
|
||||
}
|
||||
|
||||
fn verify(&self, data: &str, signature: &[u8]) -> SignatureResult<bool> {
|
||||
let key = PKey::from_rsa(Rsa::public_key_from_pem(self.public_key.as_ref()).unwrap())
|
||||
.unwrap();
|
||||
let mut verifier = openssl::sign::Verifier::new(MessageDigest::sha256(), &key).unwrap();
|
||||
verifier.update(data.as_bytes()).unwrap();
|
||||
verifier.verify(&signature).map_err(|_| SignatureError())
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_inbox_basic() {
|
||||
let act = serde_json::to_value(build_create()).unwrap();
|
||||
let res: Result<(), ()> = Inbox::handle(&(), act)
|
||||
.with::<MyActor, Create, MyObject>()
|
||||
let res: Result<(), ()> = Inbox::handle(&(), &MySigner::new(), act)
|
||||
.with::<MyActor, Create, MyObject>(None)
|
||||
.done();
|
||||
assert!(res.is_ok());
|
||||
}
|
||||
@@ -533,11 +678,11 @@ mod tests {
|
||||
#[test]
|
||||
fn test_inbox_multi_handlers() {
|
||||
let act = serde_json::to_value(build_create()).unwrap();
|
||||
let res: Result<(), ()> = Inbox::handle(&(), act)
|
||||
.with::<MyActor, Announce, MyObject>()
|
||||
.with::<MyActor, Delete, MyObject>()
|
||||
.with::<MyActor, Create, MyObject>()
|
||||
.with::<MyActor, Like, MyObject>()
|
||||
let res: Result<(), ()> = Inbox::handle(&(), &MySigner::new(), act)
|
||||
.with::<MyActor, Announce, MyObject>(None)
|
||||
.with::<MyActor, Delete, MyObject>(None)
|
||||
.with::<MyActor, Create, MyObject>(None)
|
||||
.with::<MyActor, Like, MyObject>(None)
|
||||
.done();
|
||||
assert!(res.is_ok());
|
||||
}
|
||||
@@ -546,9 +691,9 @@ mod tests {
|
||||
fn test_inbox_failure() {
|
||||
let act = serde_json::to_value(build_create()).unwrap();
|
||||
// Create is not handled by this inbox
|
||||
let res: Result<(), ()> = Inbox::handle(&(), act)
|
||||
.with::<MyActor, Announce, MyObject>()
|
||||
.with::<MyActor, Like, MyObject>()
|
||||
let res: Result<(), ()> = Inbox::handle(&(), &MySigner::new(), act)
|
||||
.with::<MyActor, Announce, MyObject>(None)
|
||||
.with::<MyActor, Like, MyObject>(None)
|
||||
.done();
|
||||
assert!(res.is_err());
|
||||
}
|
||||
@@ -595,14 +740,14 @@ mod tests {
|
||||
fn test_inbox_actor_failure() {
|
||||
let act = serde_json::to_value(build_create()).unwrap();
|
||||
|
||||
let res: Result<(), ()> = Inbox::handle(&(), act.clone())
|
||||
.with::<FailingActor, Create, MyObject>()
|
||||
let res: Result<(), ()> = Inbox::handle(&(), &MySigner::new(), act.clone())
|
||||
.with::<FailingActor, Create, MyObject>(None)
|
||||
.done();
|
||||
assert!(res.is_err());
|
||||
|
||||
let res: Result<(), ()> = Inbox::handle(&(), act.clone())
|
||||
.with::<FailingActor, Create, MyObject>()
|
||||
.with::<MyActor, Create, MyObject>()
|
||||
let res: Result<(), ()> = Inbox::handle(&(), &MySigner::new(), act.clone())
|
||||
.with::<FailingActor, Create, MyObject>(None)
|
||||
.with::<MyActor, Create, MyObject>(None)
|
||||
.done();
|
||||
assert!(res.is_ok());
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
use activitypub::{Activity, Link, Object};
|
||||
use array_tool::vec::Uniq;
|
||||
use reqwest::r#async::ClientBuilder;
|
||||
use reqwest::{header::HeaderValue, r#async::ClientBuilder, Url};
|
||||
use rocket::{
|
||||
http::Status,
|
||||
request::{FromRequest, Request},
|
||||
response::{Responder, Response},
|
||||
Outcome,
|
||||
};
|
||||
use serde_json;
|
||||
use tokio::prelude::*;
|
||||
use tracing::{debug, warn};
|
||||
|
||||
use self::sign::Signable;
|
||||
|
||||
@@ -64,7 +64,7 @@ impl<T> ActivityStream<T> {
|
||||
}
|
||||
|
||||
impl<'r, O: Object> Responder<'r> for ActivityStream<O> {
|
||||
fn respond_to(self, request: &Request) -> Result<Response<'r>, Status> {
|
||||
fn respond_to(self, request: &Request<'_>) -> Result<Response<'r>, Status> {
|
||||
let mut json = serde_json::to_value(&self.0).map_err(|_| Status::InternalServerError)?;
|
||||
json["@context"] = context();
|
||||
serde_json::to_string(&json).respond_to(request).map(|r| {
|
||||
@@ -108,7 +108,7 @@ impl<'a, 'r> FromRequest<'a, 'r> for ApRequest {
|
||||
.unwrap_or(Outcome::Forward(()))
|
||||
}
|
||||
}
|
||||
pub fn broadcast<S, A, T, C>(sender: &S, act: A, to: Vec<T>)
|
||||
pub fn broadcast<S, A, T, C>(sender: &S, act: A, to: Vec<T>, proxy: Option<reqwest::Proxy>)
|
||||
where
|
||||
S: sign::Signer,
|
||||
A: Activity,
|
||||
@@ -132,31 +132,54 @@ where
|
||||
|
||||
let mut rt = tokio::runtime::current_thread::Runtime::new()
|
||||
.expect("Error while initializing tokio runtime for federation");
|
||||
let client = ClientBuilder::new()
|
||||
.connect_timeout(std::time::Duration::from_secs(5))
|
||||
.build()
|
||||
.expect("Can't build client");
|
||||
for inbox in boxes {
|
||||
let body = signed.to_string();
|
||||
let mut headers = request::headers();
|
||||
let url = Url::parse(&inbox);
|
||||
if url.is_err() {
|
||||
warn!("Inbox is invalid URL: {:?}", &inbox);
|
||||
continue;
|
||||
}
|
||||
let url = url.unwrap();
|
||||
if !url.has_host() {
|
||||
warn!("Inbox doesn't have host: {:?}", &inbox);
|
||||
continue;
|
||||
};
|
||||
let host_header_value = HeaderValue::from_str(&url.host_str().expect("Unreachable"));
|
||||
if host_header_value.is_err() {
|
||||
warn!("Header value is invalid: {:?}", url.host_str());
|
||||
continue;
|
||||
}
|
||||
headers.insert("Host", host_header_value.unwrap());
|
||||
headers.insert("Digest", request::Digest::digest(&body));
|
||||
rt.spawn(
|
||||
client
|
||||
.post(&inbox)
|
||||
.headers(headers.clone())
|
||||
.header(
|
||||
"Signature",
|
||||
request::signature(sender, &headers)
|
||||
.expect("activity_pub::broadcast: request signature error"),
|
||||
)
|
||||
.body(body)
|
||||
.send()
|
||||
.and_then(|r| r.into_body().concat2())
|
||||
.map(move |response| {
|
||||
println!("Successfully sent activity to inbox ({})", inbox);
|
||||
println!("Response: \"{:?}\"\n", response)
|
||||
})
|
||||
.map_err(|e| println!("Error while sending to inbox ({:?})", e)),
|
||||
if let Some(proxy) = proxy.clone() {
|
||||
ClientBuilder::new().proxy(proxy)
|
||||
} else {
|
||||
ClientBuilder::new()
|
||||
}
|
||||
.connect_timeout(std::time::Duration::from_secs(5))
|
||||
.build()
|
||||
.expect("Can't build client")
|
||||
.post(&inbox)
|
||||
.headers(headers.clone())
|
||||
.header(
|
||||
"Signature",
|
||||
request::signature(sender, &headers, ("post", url.path(), url.query()))
|
||||
.expect("activity_pub::broadcast: request signature error"),
|
||||
)
|
||||
.body(body)
|
||||
.send()
|
||||
.and_then(move |r| {
|
||||
if r.status().is_success() {
|
||||
debug!("Successfully sent activity to inbox ({})", &inbox);
|
||||
} else {
|
||||
warn!("Error while sending to inbox ({:?})", &r)
|
||||
}
|
||||
r.into_body().concat2()
|
||||
})
|
||||
.map(move |response| debug!("Response: \"{:?}\"\n", response))
|
||||
.map_err(|e| warn!("Error while sending to inbox ({:?})", e)),
|
||||
);
|
||||
}
|
||||
rt.run().unwrap();
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
use base64;
|
||||
use chrono::{offset::Utc, DateTime};
|
||||
use openssl::hash::{Hasher, MessageDigest};
|
||||
use reqwest::header::{HeaderMap, HeaderValue, ACCEPT, CONTENT_TYPE, DATE, USER_AGENT};
|
||||
use std::ops::Deref;
|
||||
use std::time::SystemTime;
|
||||
use tracing::warn;
|
||||
|
||||
use activity_pub::sign::Signer;
|
||||
use activity_pub::{ap_accept_header, AP_CONTENT_TYPE};
|
||||
use crate::activity_pub::sign::Signer;
|
||||
use crate::activity_pub::{ap_accept_header, AP_CONTENT_TYPE};
|
||||
|
||||
const PLUME_USER_AGENT: &str = concat!("Plume/", env!("CARGO_PKG_VERSION"));
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Error();
|
||||
|
||||
pub struct Digest(String);
|
||||
|
||||
impl Digest {
|
||||
@@ -62,16 +65,16 @@ impl Digest {
|
||||
base64::decode(&self.0[pos..]).expect("Digest::value: invalid encoding error")
|
||||
}
|
||||
|
||||
pub fn from_header(dig: &str) -> Result<Self, ()> {
|
||||
pub fn from_header(dig: &str) -> Result<Self, Error> {
|
||||
if let Some(pos) = dig.find('=') {
|
||||
let pos = pos + 1;
|
||||
if base64::decode(&dig[pos..]).is_ok() {
|
||||
Ok(Digest(dig.to_owned()))
|
||||
} else {
|
||||
Err(())
|
||||
Err(Error())
|
||||
}
|
||||
} else {
|
||||
Err(())
|
||||
Err(Error())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,27 +113,47 @@ pub fn headers() -> HeaderMap {
|
||||
headers
|
||||
}
|
||||
|
||||
pub fn signature<S: Signer>(signer: &S, headers: &HeaderMap) -> Result<HeaderValue, ()> {
|
||||
let signed_string = headers
|
||||
type Method<'a> = &'a str;
|
||||
type Path<'a> = &'a str;
|
||||
type Query<'a> = &'a str;
|
||||
type RequestTarget<'a> = (Method<'a>, Path<'a>, Option<Query<'a>>);
|
||||
|
||||
pub fn signature(
|
||||
signer: &dyn Signer,
|
||||
headers: &HeaderMap,
|
||||
request_target: RequestTarget,
|
||||
) -> Result<HeaderValue, Error> {
|
||||
let (method, path, query) = request_target;
|
||||
let origin_form = if let Some(query) = query {
|
||||
format!("{}?{}", path, query)
|
||||
} else {
|
||||
path.to_string()
|
||||
};
|
||||
|
||||
let mut headers_vec = Vec::with_capacity(headers.len());
|
||||
for (h, v) in headers.iter() {
|
||||
let v = v.to_str();
|
||||
if v.is_err() {
|
||||
warn!("invalid header error: {:?}", v.unwrap_err());
|
||||
return Err(Error());
|
||||
}
|
||||
headers_vec.push((h.as_str().to_lowercase(), v.expect("Unreachable")));
|
||||
}
|
||||
let request_target = format!("{} {}", method.to_lowercase(), origin_form);
|
||||
headers_vec.push(("(request-target)".to_string(), &request_target));
|
||||
|
||||
let signed_string = headers_vec
|
||||
.iter()
|
||||
.map(|(h, v)| {
|
||||
format!(
|
||||
"{}: {}",
|
||||
h.as_str().to_lowercase(),
|
||||
v.to_str()
|
||||
.expect("request::signature: invalid header error")
|
||||
)
|
||||
})
|
||||
.map(|(h, v)| format!("{}: {}", h, v))
|
||||
.collect::<Vec<String>>()
|
||||
.join("\n");
|
||||
let signed_headers = headers
|
||||
let signed_headers = headers_vec
|
||||
.iter()
|
||||
.map(|(h, _)| h.as_str())
|
||||
.map(|(h, _)| h.as_ref())
|
||||
.collect::<Vec<&str>>()
|
||||
.join(" ")
|
||||
.to_lowercase();
|
||||
.join(" ");
|
||||
|
||||
let data = signer.sign(&signed_string).map_err(|_| ())?;
|
||||
let data = signer.sign(&signed_string).map_err(|_| Error())?;
|
||||
let sign = base64::encode(&data);
|
||||
|
||||
HeaderValue::from_str(&format!(
|
||||
@@ -138,5 +161,63 @@ pub fn signature<S: Signer>(signer: &S, headers: &HeaderMap) -> Result<HeaderVal
|
||||
key_id = signer.get_key_id(),
|
||||
signed_headers = signed_headers,
|
||||
signature = sign
|
||||
)).map_err(|_| ())
|
||||
)).map_err(|_| Error())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::signature;
|
||||
use crate::activity_pub::sign::{
|
||||
gen_keypair, Error as SignatureError, Result as SignatureResult, Signer,
|
||||
};
|
||||
use openssl::{hash::MessageDigest, pkey::PKey, rsa::Rsa};
|
||||
use reqwest::header::HeaderMap;
|
||||
|
||||
struct MySigner {
|
||||
public_key: String,
|
||||
private_key: String,
|
||||
}
|
||||
|
||||
impl MySigner {
|
||||
fn new() -> Self {
|
||||
let (pub_key, priv_key) = gen_keypair();
|
||||
Self {
|
||||
public_key: String::from_utf8(pub_key).unwrap(),
|
||||
private_key: String::from_utf8(priv_key).unwrap(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Signer for MySigner {
|
||||
fn get_key_id(&self) -> String {
|
||||
"mysigner".into()
|
||||
}
|
||||
|
||||
fn sign(&self, to_sign: &str) -> SignatureResult<Vec<u8>> {
|
||||
let key = PKey::from_rsa(Rsa::private_key_from_pem(self.private_key.as_ref()).unwrap())
|
||||
.unwrap();
|
||||
let mut signer = openssl::sign::Signer::new(MessageDigest::sha256(), &key).unwrap();
|
||||
signer.update(to_sign.as_bytes()).unwrap();
|
||||
signer.sign_to_vec().map_err(|_| SignatureError())
|
||||
}
|
||||
|
||||
fn verify(&self, data: &str, signature: &[u8]) -> SignatureResult<bool> {
|
||||
let key = PKey::from_rsa(Rsa::public_key_from_pem(self.public_key.as_ref()).unwrap())
|
||||
.unwrap();
|
||||
let mut verifier = openssl::sign::Verifier::new(MessageDigest::sha256(), &key).unwrap();
|
||||
verifier.update(data.as_bytes()).unwrap();
|
||||
verifier.verify(&signature).map_err(|_| SignatureError())
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_signature_request_target() {
|
||||
let signer = MySigner::new();
|
||||
let headers = HeaderMap::new();
|
||||
let result = signature(&signer, &headers, ("post", "/inbox", None)).unwrap();
|
||||
let fields: Vec<&str> = result.to_str().unwrap().split(",").collect();
|
||||
assert_eq!(r#"headers="(request-target)""#, fields[2]);
|
||||
let sign = &fields[3][11..(fields[3].len() - 1)];
|
||||
assert!(signer.verify("post /inbox", sign.as_bytes()).is_ok());
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user