Compare commits

..

60 commits

Author SHA1 Message Date
02b20ba677 Merge pull request 'fix: remove secrets' (#68) from fix-secrets into master
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Reviewed-on: realaravinth/libmedium#68
2024-09-26 14:57:30 +05:30
ec522a5bb2
fix: remove secrets
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
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
Some checks failed
ci/woodpecker/manual/woodpecker Pipeline was successful
ci/woodpecker/push/woodpecker Pipeline failed
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
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-09-11 14:11:30 +00:00
Renovate Bot
91c46a64ae fix(deps): update rust crate serde to v1.0.210
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
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
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-08-15 16:04:57 +00:00
Renovate Bot
c41f5649e6 fix(deps): update rust crate serde_json to v1.0.125
Some checks failed
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline failed
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
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
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
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
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-08-12 20:35:30 +00:00
Renovate Bot
888354ed5c fix(deps): update rust crate serde_json to v1.0.124
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-08-11 21:34:25 +00:00
Renovate Bot
4665d2ff87 fix(deps): update rust crate actix-http to v3.9.0
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
2024-08-10 03:05:08 +00:00
Renovate Bot
2b5e82878e fix(deps): update rust crate actix-web to v4.9.0
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
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
Some checks failed
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline failed
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
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
Some checks failed
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline failed
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
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
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
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
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
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
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
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
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
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
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
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
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
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
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
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
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
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
Some checks are pending
ci/woodpecker/push/woodpecker Pipeline is pending
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
Some checks are pending
ci/woodpecker/push/woodpecker Pipeline is pending
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
Some checks are pending
ci/woodpecker/push/woodpecker Pipeline is pending
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
Some checks are pending
ci/woodpecker/push/woodpecker Pipeline is pending
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
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-25 05:03:40 +00:00
Renovate Bot
e3a862905d fix(deps): update rust crate lazy_static to v1.5.0
Some checks failed
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline failed
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-21 23:07:46 +00:00
Renovate Bot
825b01cfa6 fix(deps): update rust crate actix-web to v4.8.0
Some checks failed
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline failed
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-20 01:03:58 +00:00
Renovate Bot
19996e67f3 fix(deps): update rust crate actix-http to v3.8.0
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-19 23:34:01 +00:00
Renovate Bot
4d7283c3da fix(deps): update rust crate url to v2.5.2
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
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
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
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
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
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
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
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
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
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
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
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
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
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
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
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
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
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
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
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
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: realaravinth/libmedium#38
2024-06-07 14:52:22 +05:30
0b3a43088b
fix: escape contents of code blocks
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
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
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Reviewed-on: realaravinth/libmedium#37
2024-06-07 01:15:18 +05:30
883c609412
fix: weird rendering issue on mobile viewports
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
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
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-05 10:31:53 +00:00
8ee266d846
Merge pull request #35 from SudoVanilla/patch-1
All checks were successful
ci/woodpecker/manual/woodpecker Pipeline was successful
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
Some checks are pending
ci/woodpecker/push/woodpecker Pipeline is pending
ci/woodpecker/pr/woodpecker Pipeline is pending
ci/woodpecker/manual/woodpecker Pipeline was successful
2024-06-04 14:07:27 +05:30
b53ac22ba4 Merge pull request 'chore: rm GH actions' (#35) from chore-rm-gh-actions into master
Some checks are pending
ci/woodpecker/push/woodpecker Pipeline is pending
Reviewed-on: realaravinth/libmedium#35
2024-06-04 14:06:55 +05:30
SudoVanilla
d3b4ae0952
Update SudoVanilla's instance 2024-06-02 23:13:05 -04:00
9 changed files with 479 additions and 417 deletions

View file

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

797
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" actix-web = "4.0.1"
bincode = "1.3.3" bincode = "1.3.3"
chrono = "0.4.23" chrono = "0.4.23"
config = "0.13" config = "0.14"
derive_more = "0.99" derive_more = "0.99"
futures = "0.3.17" futures = "0.3.17"
lazy_static = "1.4" lazy_static = "1.4"

View file

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

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) { match self.posts.get(id) {
Ok(Some(v)) => { Ok(Some(v)) => {
let cached: PostResp = bincode::deserialize(&v[..]).unwrap(); let cached: PostResp = bincode::deserialize(&v[..]).unwrap();
PostUrl { Some(PostUrl {
slug: cached.unique_slug, slug: cached.unique_slug,
username: cached.creator.username, username: cached.creator.username,
} })
} }
_ => { _ => {
let vars = get_post_light::Variables { id: id.to_owned() }; let vars = get_post_light::Variables { id: id.to_owned() };
@ -180,10 +180,16 @@ impl Data {
let res = post_graphql::<GetPostLight, _>(&self.client, URL, vars) let res = post_graphql::<GetPostLight, _>(&self.client, URL, vars)
.await .await
.unwrap(); .unwrap();
let res = res.data.expect("missing response data").post.unwrap(); if res.data.is_none() {
PostUrl { None
slug: res.unique_slug, } else {
username: res.creator.username, 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> { ) -> Vec<String> {
let mut paragraphs: Vec<String> = Vec::with_capacity(data.content.body_model.paragraphs.len()); let mut paragraphs: Vec<String> = Vec::with_capacity(data.content.body_model.paragraphs.len());
let mut state = ListState::default(); let mut state = ListState::default();
let mut no_render_html = false;
for (pindex, p) in data.content.body_model.paragraphs.iter().enumerate() { for (pindex, p) in data.content.body_model.paragraphs.iter().enumerate() {
let mut pos = PositionMap::default(); let mut pos = PositionMap::default();
if p.type_ == "H3" && pindex == 0 { if p.type_ == "H3" && pindex == 0 {
@ -383,33 +384,42 @@ pub fn apply_markup(
} }
let mut content = String::with_capacity(p.text.len()); let mut content = String::with_capacity(p.text.len());
content += &Markup::start(p, gists, pindex, &mut state); let start = &Markup::start(p, gists, pindex, &mut state);
content += start;
if start == "<pre>" {
no_render_html = true;
}
pos.arr.sort(); pos.arr.sort();
let mut page = String::default();
if let Some(first) = pos.arr.first() { if let Some(first) = pos.arr.first() {
//content += p.text.substring(cur, *first as usize); page += p.text.slice(cur..*first as usize);
content += p.text.slice(cur..*first as usize);
cur = incr_cur(cur, *first); cur = incr_cur(cur, *first);
for point in pos.arr.iter() { for point in pos.arr.iter() {
//content.push(p.text.substring(start, start + point);
// if *point != 0 {
if cur != *point as usize { if cur != *point as usize {
// content += p.text.substring(cur, *point as usize); page += p.text.slice(cur..*point as usize);
content += p.text.slice(cur..*point as usize);
} }
// } // }
let pos_markups = pos.map.get(point).unwrap(); let pos_markups = pos.map.get(point).unwrap();
for m in pos_markups.iter() { for m in pos_markups.iter() {
content += &m.apply_markup(pindex); page += &m.apply_markup(pindex);
} }
cur = incr_cur(cur, *point); cur = incr_cur(cur, *point);
} }
log::debug!("LAST"); log::debug!("LAST");
content += p.text.slice(cur..); page += p.text.slice(cur..);
content += &Markup::end(p, pindex, &mut state); let end = &Markup::end(p, pindex, &mut state);
if end == "</pre>" {
no_render_html = false;
}
content += &page;
content += end;
} else { } else {
log::debug!("LAST WITH NO MARKUP"); log::debug!("LAST WITH NO MARKUP");
content += p.text.slice(cur..); page += p.text.slice(cur..);
if no_render_html {
page = page.replace("<", "&lt;").replace(">", "&gt;");
}
content += &page;
content += &Markup::end(p, pindex, &mut state); content += &Markup::end(p, pindex, &mut state);
} }
paragraphs.push(content); 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")] #[actix_web_codegen_const_routes::get(path = "crate::V1_API_ROUTES.proxy.by_post_id")]
async fn by_post_id(path: web::Path<String>, data: AppData) -> impl Responder { async fn by_post_id(path: web::Path<String>, data: AppData) -> impl Responder {
let post_data = data.get_post_light(&path).await; match data.get_post_light(&path).await {
HttpResponse::Found() None => HttpResponse::NotFound().body("Post not found"),
.append_header(( Some(post_data) => HttpResponse::Found()
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()
.append_header(( .append_header((
header::LOCATION, header::LOCATION,
crate::V1_API_ROUTES crate::V1_API_ROUTES
.proxy .proxy
.get_page(&post_data.username, &post_data.slug), .get_page(&post_data.username, &post_data.slug),
)) ))
.finish() .finish(),
}
}
#[actix_web_codegen_const_routes::get(path = "crate::V1_API_ROUTES.proxy.top_level_post")]
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 { } else {
HttpResponse::NotFound().body("Post not found, please file bug report") HttpResponse::NotFound().body("Post not found, please file bug report")
} }

View file

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

View file

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