Skip to content

Commit

Permalink
Replace askama with rinja
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Oct 1, 2024
1 parent e57eaa0 commit c800bca
Show file tree
Hide file tree
Showing 11 changed files with 82 additions and 53 deletions.
115 changes: 72 additions & 43 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ authors = [
edition = "2021"

[dependencies]
askama = { version = "0.12.1", default-features = false }
rinja = { version = "0.3.4", default-features = false }
cached = { version = "0.51.3", features = ["async"] }
clap = { version = "4.4.11", default-features = false, features = [
"std",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Redlib currently implements most of Reddit's (signed-out) functionalities but st

- [Rust](https://www.rust-lang.org/) - Programming language
- [Hyper](https://github.com/hyperium/hyper) - HTTP server and client
- [Askama](https://github.com/djc/askama) - Templating engine
- [Rinja](https://github.com/rinja-rs/rinja) - Templating engine
- [Rustls](https://github.com/rustls/rustls) - TLS library

## How is it different from other Reddit front ends?
Expand Down
2 changes: 1 addition & 1 deletion src/duplicates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::server::RequestExt;
use crate::subreddit::{can_access_quarantine, quarantine};
use crate::utils::{error, filter_posts, get_filters, nsfw_landing, parse_post, template, Post, Preferences};

use askama::Template;
use rinja::Template;
use hyper::{Body, Request, Response};
use serde_json::Value;
use std::borrow::ToOwned;
Expand Down
2 changes: 1 addition & 1 deletion src/instance_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::{
server::RequestExt,
utils::{ErrorTemplate, Preferences},
};
use askama::Template;
use rinja::Template;
use build_html::{Container, Html, HtmlContainer, Table};
use hyper::{http::Error, Body, Request, Response};
use once_cell::sync::Lazy;
Expand Down
2 changes: 1 addition & 1 deletion src/post.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::utils::{
};
use hyper::{Body, Request, Response};

use askama::Template;
use rinja::Template;
use once_cell::sync::Lazy;
use regex::Regex;
use std::collections::{HashMap, HashSet};
Expand Down
2 changes: 1 addition & 1 deletion src/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::{
subreddit::{can_access_quarantine, quarantine},
RequestExt,
};
use askama::Template;
use rinja::Template;
use hyper::{Body, Request, Response};
use once_cell::sync::Lazy;
use regex::Regex;
Expand Down
2 changes: 1 addition & 1 deletion src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::collections::HashMap;
// CRATES
use crate::server::ResponseExt;
use crate::utils::{redirect, template, Preferences};
use askama::Template;
use rinja::Template;
use cookie::Cookie;
use futures_lite::StreamExt;
use hyper::{Body, Request, Response};
Expand Down
2 changes: 1 addition & 1 deletion src/subreddit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::utils::{
catch_random, error, filter_posts, format_num, format_url, get_filters, nsfw_landing, param, redirect, rewrite_urls, setting, template, val, Post, Preferences, Subreddit,
};
use crate::{client::json, server::ResponseExt, RequestExt};
use askama::Template;
use rinja::Template;
use cookie::Cookie;
use hyper::{Body, Request, Response};

Expand Down
2 changes: 1 addition & 1 deletion src/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::client::json;
use crate::server::RequestExt;
use crate::utils::{error, filter_posts, format_url, get_filters, nsfw_landing, param, setting, template, Post, Preferences, User};
use crate::{config, utils};
use askama::Template;
use rinja::Template;
use hyper::{Body, Request, Response};
use time::{macros::format_description, OffsetDateTime};

Expand Down
2 changes: 1 addition & 1 deletion src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::config::{self, get_setting};
// CRATES
//
use crate::{client::json, server::RequestExt};
use askama::Template;
use rinja::Template;
use cookie::Cookie;
use hyper::{Body, Request, Response};
use log::error;
Expand Down

0 comments on commit c800bca

Please sign in to comment.