Compare commits

...

87 commits

Author SHA1 Message Date
02b20ba677 Merge pull request 'fix: remove secrets' (#68) from fix-secrets into master
Reviewed-on: realaravinth/libmedium#68
2024-09-26 14:57:30 +05:30
ec522a5bb2
fix: remove secrets
ref: https://github.com/woodpecker-ci/woodpecker/issues/4140
2024-09-26 14:57:01 +05:30
7e5469ad2e Merge pull request 'fix(deps): update rust crate serde_json to v1.0.128' (#66) from renovate/serde_json-1.x-lockfile into master
Reviewed-on: realaravinth/libmedium#66
2024-09-12 22:09:18 +05:30
2a4f8ce539 Merge pull request 'fix(deps): update rust crate serde to v1.0.210' (#65) from renovate/serde-monorepo into master
Reviewed-on: realaravinth/libmedium#65
2024-09-12 22:09:15 +05:30
Renovate Bot
74bf91b976 fix(deps): update rust crate serde_json to v1.0.128 2024-09-11 14:11:30 +00:00
Renovate Bot
91c46a64ae fix(deps): update rust crate serde to v1.0.210 2024-09-11 14:11:23 +00:00
2cec7c2ad2 Merge pull request 'fix(deps): update rust crate serde_json to v1.0.125' (#61) from renovate/serde_json-1.x-lockfile into master
Reviewed-on: https://git.batsense.net///realaravinth/libmedium/pulls/61
2024-08-19 13:51:38 +05:30
c64b40c616 Merge pull request 'fix(deps): update rust crate serde to v1.0.208' (#62) from renovate/serde-monorepo into master
Reviewed-on: https://git.batsense.net///realaravinth/libmedium/pulls/62
2024-08-19 13:51:27 +05:30
c249ebeb8b Merge pull request 'fix(deps): update rust crate actix-http to v3.9.0' (#59) from renovate/actix-http-3.x-lockfile into master
Reviewed-on: https://git.batsense.net///realaravinth/libmedium/pulls/59
2024-08-19 13:50:59 +05:30
Renovate Bot
1db3171069 fix(deps): update rust crate serde to v1.0.208 2024-08-15 16:04:57 +00:00
Renovate Bot
c41f5649e6 fix(deps): update rust crate serde_json to v1.0.125 2024-08-15 06:04:55 +00:00
84bb01dbb3 Merge pull request 'fix(deps): update rust crate serde to v1.0.207' (#57) from renovate/serde-monorepo into master
Reviewed-on: https://git.batsense.net///realaravinth/libmedium/pulls/57
2024-08-13 15:34:28 +05:30
1b8c15aded Merge branch 'master' into renovate/actix-http-3.x-lockfile 2024-08-13 15:31:29 +05:30
aae35112cd Merge pull request 'fix(deps): update rust crate actix-web to v4.9.0' (#58) from renovate/actix-web-4.x-lockfile into master
Reviewed-on: https://git.batsense.net///realaravinth/libmedium/pulls/58
2024-08-13 15:30:43 +05:30
bfee1f132d Merge pull request 'fix(deps): update rust crate serde_json to v1.0.124' (#60) from renovate/serde_json-1.x-lockfile into master
Reviewed-on: https://git.batsense.net///realaravinth/libmedium/pulls/60
2024-08-13 15:27:57 +05:30
Renovate Bot
fc55eb4de0 fix(deps): update rust crate serde to v1.0.207 2024-08-12 20:35:30 +00:00
Renovate Bot
888354ed5c fix(deps): update rust crate serde_json to v1.0.124 2024-08-11 21:34:25 +00:00
Renovate Bot
4665d2ff87 fix(deps): update rust crate actix-http to v3.9.0 2024-08-10 03:05:08 +00:00
Renovate Bot
2b5e82878e fix(deps): update rust crate actix-web to v4.9.0 2024-08-10 02:34:29 +00:00
02280710a0 Merge pull request 'fix(deps): update rust crate serde_json to v1.0.122' (#55) from renovate/serde_json-1.x-lockfile into master
Reviewed-on: https://git.batsense.net///realaravinth/libmedium/pulls/55
2024-08-02 11:48:44 +05:30
Renovate Bot
b0183fa2b3 fix(deps): update rust crate serde_json to v1.0.122 2024-08-01 21:35:48 +00:00
da71fc1d08 Merge pull request 'fix(deps): update rust crate serde_json to v1.0.121' (#54) from renovate/serde_json-1.x-lockfile into master
Reviewed-on: realaravinth/libmedium#54
2024-07-29 16:10:59 +05:30
Renovate Bot
ae52cc555f fix(deps): update rust crate serde_json to v1.0.121 2024-07-28 21:33:27 +00:00
eb5f3067c1 Merge pull request 'update get_post_light to return none when no data is found, so not found error can happen' (#53) from halkeye/libmedium:handle-post-not-found into master
Reviewed-on: realaravinth/libmedium#53
Reviewed-by: Aravinth Manivannan <realaravinth@batsense.net>
2024-07-28 16:14:19 +05:30
Gavin Mogan
3111f3e25c update get_post_light to return none when no data is found, so not found error can happen 2024-07-27 15:10:46 -07:00
8bddddea2c Merge pull request 'fix(deps): update rust crate serde to v1.0.204' (#51) from renovate/serde-monorepo into master
Reviewed-on: realaravinth/libmedium#51
2024-07-08 18:55:52 +05:30
Renovate Bot
e42bff0b5c fix(deps): update rust crate serde to v1.0.204 2024-07-06 21:05:09 +00:00
1bf1d60cd9 Merge pull request 'fix(deps): update rust crate serde_json to v1.0.120' (#50) from renovate/serde_json-1.x-lockfile into master
Reviewed-on: realaravinth/libmedium#50
2024-07-02 11:34:44 +05:30
Renovate Bot
b261bee2f1 fix(deps): update rust crate serde_json to v1.0.120 2024-07-01 17:36:03 +00:00
64313eca1f Merge pull request 'fix(deps): update rust crate log to v0.4.22' (#49) from renovate/log-0.x-lockfile into master
Reviewed-on: realaravinth/libmedium#49
2024-06-30 22:07:49 +05:30
Renovate Bot
b373dcd75a fix(deps): update rust crate log to v0.4.22 2024-06-28 00:33:31 +00:00
b6f916f5f9 Merge pull request 'fix(deps): update rust crate serde_json to v1.0.118' (#48) from renovate/serde_json-1.x-lockfile into master
Reviewed-on: realaravinth/libmedium#48
2024-06-26 00:37:53 +05:30
3cf66d941f Merge pull request 'fix(deps): update rust crate lazy_static to v1.5.0' (#46) from renovate/lazy_static-1.x-lockfile into master
Reviewed-on: realaravinth/libmedium#46
2024-06-26 00:37:45 +05:30
fce6090bfa Merge pull request 'fix(deps): update rust crate actix-web to v4.8.0' (#45) from renovate/actix-web-4.x-lockfile into master
Reviewed-on: realaravinth/libmedium#45
2024-06-26 00:37:41 +05:30
6586c02cbf Merge pull request 'fix(deps): update rust crate actix-http to v3.8.0' (#44) from renovate/actix-http-3.x-lockfile into master
Reviewed-on: realaravinth/libmedium#44
2024-06-26 00:37:38 +05:30
8b9819008a Merge pull request 'fix(deps): update rust crate url to v2.5.2' (#43) from renovate/url-2.x-lockfile into master
Reviewed-on: realaravinth/libmedium#43
2024-06-26 00:37:35 +05:30
Renovate Bot
fa38ee17e2 fix(deps): update rust crate serde_json to v1.0.118 2024-06-25 05:03:40 +00:00
Renovate Bot
e3a862905d fix(deps): update rust crate lazy_static to v1.5.0 2024-06-21 23:07:46 +00:00
Renovate Bot
825b01cfa6 fix(deps): update rust crate actix-web to v4.8.0 2024-06-20 01:03:58 +00:00
Renovate Bot
19996e67f3 fix(deps): update rust crate actix-http to v3.8.0 2024-06-19 23:34:01 +00:00
Renovate Bot
4d7283c3da fix(deps): update rust crate url to v2.5.2 2024-06-18 20:34:38 +00:00
d621853a1d Merge pull request 'fix(deps): update rust crate derive_more to v0.99.18' (#42) from renovate/derive_more-0.x-lockfile into master
Reviewed-on: realaravinth/libmedium#42
2024-06-15 21:07:31 +05:30
Renovate Bot
b0b09176c5 fix(deps): update rust crate derive_more to v0.99.18 2024-06-15 13:04:29 +00:00
2ca90b1d3f Merge pull request 'fix(deps): update rust crate url to v2.5.1' (#41) from renovate/url-2.x-lockfile into master
Reviewed-on: realaravinth/libmedium#41
2024-06-10 19:07:18 +05:30
Renovate Bot
b8c3e17404 fix(deps): update rust crate url to v2.5.1 2024-06-10 13:04:16 +00:00
8fc0f8f0d5 Merge pull request 'fix(deps): update rust crate actix-rt to v2.10.0' (#40) from renovate/actix-rt-2.x-lockfile into master
Reviewed-on: realaravinth/libmedium#40
2024-06-10 01:07:50 +05:30
Renovate Bot
ecbcf02d4d fix(deps): update rust crate actix-rt to v2.10.0 2024-06-09 17:33:42 +00:00
ea24dca77d Merge pull request 'fix(deps): update rust crate actix-web to v4.7.0' (#39) from renovate/actix-web-4.x-lockfile into master
Reviewed-on: realaravinth/libmedium#39
2024-06-09 13:38:03 +05:30
Renovate Bot
3714d29a23 fix(deps): update rust crate actix-web to v4.7.0 2024-06-09 00:05:02 +00:00
4f6d4b709e Merge pull request 'fix(deps): update rust crate config to 0.14' (#24) from renovate/config-0.x into master
Reviewed-on: realaravinth/libmedium#24
2024-06-07 15:29:50 +05:30
95616fef4a Merge pull request 'fix: escape contents of code blocks' (#38) from fix-gh-36 into master
Reviewed-on: realaravinth/libmedium#38
2024-06-07 14:52:22 +05:30
0b3a43088b
fix: escape contents of code blocks
closes: https://github.com/realaravinth/libmedium/issues/36
2024-06-07 14:20:25 +05:30
ac503b0b06 Merge pull request 'fix: weird rendering issue on mobile viewports' (#37) from fix-gh-36 into master
Reviewed-on: realaravinth/libmedium#37
2024-06-07 01:15:18 +05:30
883c609412
fix: weird rendering issue on mobile viewports
closes: https://github.com/realaravinth/libmedium/issues/36
2024-06-07 00:43:01 +05:30
Renovate Bot
d44cf2d5c6 fix(deps): update rust crate config to 0.14 2024-06-05 10:31:53 +00:00
8ee266d846
Merge pull request #35 from SudoVanilla/patch-1
Update SudoVanilla's instance
2024-06-05 15:59:59 +05:30
c07c5798d9 Merge pull request 'chore: update deps' (#36) from chore-update-deps into master
Reviewed-on: realaravinth/libmedium#36
2024-06-05 15:37:21 +05:30
63ef7f75ba
chore: update deps 2024-06-04 14:07:27 +05:30
b53ac22ba4 Merge pull request 'chore: rm GH actions' (#35) from chore-rm-gh-actions into master
Reviewed-on: realaravinth/libmedium#35
2024-06-04 14:06:55 +05:30
88c7914f96
chore: rm GH actions 2024-06-04 14:05:05 +05:30
a9dc57e77a Merge pull request 'fix(deps): update rust crate syntect to v5.2.0' (#27) from renovate/syntect-5.x-lockfile into master
Reviewed-on: realaravinth/libmedium#27
2024-06-04 13:31:56 +05:30
cad6e4cff9 Merge pull request 'fix(deps): update rust crate url to v2.5.0' (#28) from renovate/url-2.x-lockfile into master
Reviewed-on: realaravinth/libmedium#28
2024-06-04 13:31:45 +05:30
220295bfde Merge pull request 'fix(deps): update rust crate actix-web to v4.6.0' (#23) from renovate/actix-web-4.x-lockfile into master
Reviewed-on: realaravinth/libmedium#23
2024-06-04 12:58:09 +05:30
ecc9baf2b1 Merge pull request 'fix(deps): update rust crate actix-http to v3.7.0' (#22) from renovate/actix-http-3.x-lockfile into master
Reviewed-on: realaravinth/libmedium#22
2024-06-04 12:32:51 +05:30
534028fc7f Merge pull request 'fix(deps): update rust crate serde_json to v1.0.117' (#20) from renovate/serde_json-1.x-lockfile into master
Reviewed-on: realaravinth/libmedium#20
2024-06-04 12:09:39 +05:30
9308f4f344 Merge pull request 'fix(deps): update rust crate serde to v1.0.203' (#21) from renovate/serde-monorepo into master
Reviewed-on: realaravinth/libmedium#21
2024-06-04 11:58:54 +05:30
d7f47273b2 Merge pull request 'fix(deps): update rust crate graphql_client to 0.14.0' (#25) from renovate/graphql_client-0.x into master
Reviewed-on: realaravinth/libmedium#25
2024-06-04 11:46:00 +05:30
Renovate Bot
df5f8c38b0 fix(deps): update rust crate url to v2.5.0 2024-06-04 04:55:47 +00:00
Renovate Bot
0ae9390417 fix(deps): update rust crate syntect to v5.2.0 2024-06-04 04:55:44 +00:00
Renovate Bot
864262394d fix(deps): update rust crate graphql_client to 0.14.0 2024-06-04 04:55:37 +00:00
Renovate Bot
41e84b8a57 fix(deps): update rust crate actix-web to v4.6.0 2024-06-04 04:55:32 +00:00
Renovate Bot
3f01a5ff0a fix(deps): update rust crate actix-http to v3.7.0 2024-06-04 04:55:29 +00:00
Renovate Bot
0dc45f8fe6 fix(deps): update rust crate serde_json to v1.0.117 2024-06-04 04:55:27 +00:00
Renovate Bot
c7f50a4359 fix(deps): update rust crate serde to v1.0.203 2024-06-04 04:55:23 +00:00
a6bb64d209
feat: add renovatebot dashbaord 2024-06-04 10:23:05 +05:30
8199005f84 Merge pull request 'chore(deps): update rust crate futures to v0.3.30' (#16) from renovate/futures-0.x-lockfile into master
Reviewed-on: realaravinth/libmedium#16
2024-06-04 10:19:23 +05:30
55c368bd63 Merge pull request 'chore(deps): update rust crate log to v0.4.21' (#17) from renovate/log-0.x-lockfile into master
Reviewed-on: realaravinth/libmedium#17
2024-06-04 10:19:13 +05:30
e98a5132a0 Merge pull request 'chore(deps): update rust crate chrono to v0.4.38' (#15) from renovate/chrono-0.x-lockfile into master
Reviewed-on: realaravinth/libmedium#15
2024-06-04 10:19:00 +05:30
304cfe46cd Merge pull request 'chore(deps): update rust crate sailfish to v0.8.3' (#18) from renovate/sailfish-0.x-lockfile into master
Reviewed-on: realaravinth/libmedium#18
2024-06-04 10:18:34 +05:30
SudoVanilla
d3b4ae0952
Update SudoVanilla's instance 2024-06-02 23:13:05 -04:00
Renovate Bot
603ceeba76 chore(deps): update rust crate sailfish to v0.8.3 2024-06-03 03:02:03 +00:00
Renovate Bot
e53c128538 chore(deps): update rust crate log to v0.4.21 2024-06-03 03:01:59 +00:00
Renovate Bot
5b1a8bea86 chore(deps): update rust crate futures to v0.3.30 2024-06-02 13:26:31 +00:00
Renovate Bot
f96cb38f3d chore(deps): update rust crate chrono to v0.4.38 2024-06-02 13:26:28 +00:00
6467697558 Merge pull request 'chore: Configure Renovate' (#14) from renovate/configure into master
Reviewed-on: realaravinth/libmedium#14
2024-06-02 18:55:39 +05:30
Renovate Bot
16a6044773 Add renovate.json 2024-06-02 13:24:41 +00:00
d2dcd6b048 Merge pull request 'Added libmedium.ducks.party instance' (#13) from nyuuzyou/libmedium:master into master
Reviewed-on: realaravinth/libmedium#13
Reviewed-by: Aravinth Manivannan <realaravinth@batsense.net>
2024-04-25 16:01:19 +05:30
13 changed files with 657 additions and 672 deletions

View file

@ -1,43 +0,0 @@
name: Lint
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- master
jobs:
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt
- name: Check with rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: clippy
override: true
- name: Check with Clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --workspace --tests --all-features

View file

@ -1,49 +0,0 @@
name: Coverage
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- master
jobs:
build_and_test:
strategy:
fail-fast: false
matrix:
version:
- nightly
name: ${{ matrix.version }} - x86_64-unknown-linux-gnu
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: ⚡ Cache
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install ${{ matrix.version }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.version }}-x86_64-unknown-linux-gnu
profile: minimal
override: true
- name: Generate coverage file
if: (github.ref == 'refs/heads/master' || github.event_name == 'pull_request')
uses: actions-rs/tarpaulin@v0.1
with:
args: "-t 1200"
env:
GIT_HASH: 8e77345f1597e40c2e266cb4e6dee74888918a61
- name: Upload to Codecov
uses: codecov/codecov-action@v2
if: github.ref == 'refs/heads/master'

View file

@ -1,70 +0,0 @@
name: Build
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- master
jobs:
build_and_test:
strategy:
fail-fast: false
matrix:
version:
#- 1.51.0
- stable
# - nightly
name: ${{ matrix.version }} - x86_64-unknown-linux-gnu
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: ⚡ Cache
uses: actions/cache@v2
with:
path: |
/var/lib/docker
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Login to DockerHub
if: (github.ref == 'refs/heads/master' || github.event_name == 'push') && github.repository == 'realaravinth/libmedium'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Install ${{ matrix.version }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.version }}-x86_64-unknown-linux-gnu
profile: minimal
override: true
- name: build
run: make
- name: run tests
run: make test
- name: build and publish docker images
run: make docker-publish
- name: generate documentation
if: matrix.version == 'stable' && (github.repository == 'realaravinth/libmedium')
run: make doc
env:
GIT_HASH: 8e77345f1597e40c2e266cb4e6dee74888918a61 # dummy value
- name: Deploy to GitHub libmedium
if: matrix.version == 'stable' && (github.repository == 'realaravinth/libmedium')
uses: JamesIves/github-pages-deploy-action@3.7.1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-libmedium
FOLDER: target/doc

View file

@ -31,7 +31,6 @@ steps:
when:
event: [push, tag, deployment]
branch: master
secrets: [docker_token]
settings:
repo: realaravinth/libmedium
username: realaravinth

1054
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -16,7 +16,7 @@ actix-rt = "2"
actix-web = "4.0.1"
bincode = "1.3.3"
chrono = "0.4.23"
config = "0.13"
config = "0.14"
derive_more = "0.99"
futures = "0.3.17"
lazy_static = "1.4"
@ -34,7 +34,7 @@ sha256 = "1.5.0"
[dependencies.graphql_client]
features = ["reqwest"]
version = "0.13.0"
version = "0.14.0"
[dependencies.reqwest]
features = ["json"]

View file

@ -57,7 +57,7 @@ business.
| http://md.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion/ | N/A | Hetzner | [~vern](https://vern.cc) |
| http://vernaqj2qr2pijpgvf3od6ssc3ulz3nv52gwr3hba5l6humuzmgq.b32.i2p/ | N/A | Hetzner | [~vern](https://vern.cc) |
| https://medium.hostux.net | France | Gandi | [hostux](https://hostux.net) |
| https://read.sudovanilla.com | US | Cloudflare | [SudoVanilla](https://sudovanilla.com) |
| https://r.sudovanilla.org | US | Selfhosted | [SudoVanilla](https://sudovanilla.org) |
| https://libmedium.ducks.party | DE | Datalix | [ducks.party](https://ducks.party) |
## Deploy

12
renovate.json Normal file
View file

@ -0,0 +1,12 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:recommended", ":dependencyDashboard"],
"labels": ["renovate-bot"],
"prHourlyLimit": 0,
"timezone": "Asia/kolkata",
"prCreation": "immediate",
"vulnerabilityAlerts": {
"enabled": true,
"labels": ["renovate-bot", "renovate-security", "security"]
}
}

View file

@ -164,14 +164,14 @@ impl Data {
}
}
pub async fn get_post_light(&self, id: &str) -> PostUrl {
pub async fn get_post_light(&self, id: &str) -> Option<PostUrl> {
match self.posts.get(id) {
Ok(Some(v)) => {
let cached: PostResp = bincode::deserialize(&v[..]).unwrap();
PostUrl {
Some(PostUrl {
slug: cached.unique_slug,
username: cached.creator.username,
}
})
}
_ => {
let vars = get_post_light::Variables { id: id.to_owned() };
@ -180,10 +180,16 @@ impl Data {
let res = post_graphql::<GetPostLight, _>(&self.client, URL, vars)
.await
.unwrap();
let res = res.data.expect("missing response data").post.unwrap();
PostUrl {
slug: res.unique_slug,
username: res.creator.username,
if res.data.is_none() {
None
} else {
match res.data.expect("missing response data").post {
None => None,
Some(res) => Some(PostUrl {
slug: res.unique_slug,
username: res.creator.username,
}),
}
}
}
}

View file

@ -345,6 +345,7 @@ pub fn apply_markup(
) -> Vec<String> {
let mut paragraphs: Vec<String> = Vec::with_capacity(data.content.body_model.paragraphs.len());
let mut state = ListState::default();
let mut no_render_html = false;
for (pindex, p) in data.content.body_model.paragraphs.iter().enumerate() {
let mut pos = PositionMap::default();
if p.type_ == "H3" && pindex == 0 {
@ -383,33 +384,42 @@ pub fn apply_markup(
}
let mut content = String::with_capacity(p.text.len());
content += &Markup::start(p, gists, pindex, &mut state);
let start = &Markup::start(p, gists, pindex, &mut state);
content += start;
if start == "<pre>" {
no_render_html = true;
}
pos.arr.sort();
let mut page = String::default();
if let Some(first) = pos.arr.first() {
//content += p.text.substring(cur, *first as usize);
content += p.text.slice(cur..*first as usize);
page += p.text.slice(cur..*first as usize);
cur = incr_cur(cur, *first);
for point in pos.arr.iter() {
//content.push(p.text.substring(start, start + point);
// if *point != 0 {
if cur != *point as usize {
// content += p.text.substring(cur, *point as usize);
content += p.text.slice(cur..*point as usize);
page += p.text.slice(cur..*point as usize);
}
// }
let pos_markups = pos.map.get(point).unwrap();
for m in pos_markups.iter() {
content += &m.apply_markup(pindex);
page += &m.apply_markup(pindex);
}
cur = incr_cur(cur, *point);
}
log::debug!("LAST");
content += p.text.slice(cur..);
content += &Markup::end(p, pindex, &mut state);
page += p.text.slice(cur..);
let end = &Markup::end(p, pindex, &mut state);
if end == "</pre>" {
no_render_html = false;
}
content += &page;
content += end;
} else {
log::debug!("LAST WITH NO MARKUP");
content += p.text.slice(cur..);
page += p.text.slice(cur..);
if no_render_html {
page = page.replace("<", "&lt;").replace(">", "&gt;");
}
content += &page;
content += &Markup::end(p, pindex, &mut state);
}
paragraphs.push(content);

View file

@ -158,29 +158,33 @@ async fn assets(path: web::Path<String>, data: AppData) -> impl Responder {
#[actix_web_codegen_const_routes::get(path = "crate::V1_API_ROUTES.proxy.by_post_id")]
async fn by_post_id(path: web::Path<String>, data: AppData) -> impl Responder {
let post_data = data.get_post_light(&path).await;
HttpResponse::Found()
.append_header((
header::LOCATION,
crate::V1_API_ROUTES
.proxy
.get_page(&post_data.username, &post_data.slug),
))
.finish()
}
#[actix_web_codegen_const_routes::get(path = "crate::V1_API_ROUTES.proxy.top_level_post")]
async fn by_top_level_post(path: web::Path<String>, data: AppData) -> impl Responder {
if let Some(post_id) = path.split('-').last() {
let post_data = data.get_post_light(post_id).await;
HttpResponse::Found()
match data.get_post_light(&path).await {
None => HttpResponse::NotFound().body("Post not found"),
Some(post_data) => HttpResponse::Found()
.append_header((
header::LOCATION,
crate::V1_API_ROUTES
.proxy
.get_page(&post_data.username, &post_data.slug),
))
.finish()
.finish(),
}
}
#[actix_web_codegen_const_routes::get(path = "crate::V1_API_ROUTES.proxy.top_level_post")]
async fn by_top_level_post(path: web::Path<String>, data: AppData) -> impl Responder {
if let Some(post_id) = path.split('-').last() {
match data.get_post_light(post_id).await {
None => HttpResponse::NotFound().body("Post not found"),
Some(post_data) => HttpResponse::Found()
.append_header((
header::LOCATION,
crate::V1_API_ROUTES
.proxy
.get_page(&post_data.username, &post_data.slug),
))
.finish(),
}
} else {
HttpResponse::NotFound().body("Post not found, please file bug report")
}

View file

@ -7,7 +7,6 @@
body {
width: 100%;
display: flex;
flex-direction: column;
}
main {

View file

@ -317,7 +317,6 @@ padding: 0;
body {
width: 100%;
display: flex;
flex-direction: column;
}
main {
width: 35em;