Compare commits

...

18 commits
toc ... main

Author SHA1 Message Date
7432ffd5f9
clickable badge 2024-09-19 15:53:28 +02:00
764a632ae6
/api/v1/websites 2024-09-19 15:50:37 +02:00
396bff909e
update dependencies 2024-09-14 21:01:30 +02:00
fb44c25e47
clippy 2024-09-14 20:17:11 +02:00
a7aec1b94e
add countdown 2024-08-29 23:31:35 +02:00
8cedeb531d
cleanup using https://github.com/actions/checkout/issues/1830#issuecomment-2314758792 answer 2024-08-28 16:43:30 +02:00
912f16e0c3
remove jas 2024-08-13 13:21:25 +02:00
999d68ab60
includes images in releases 2024-08-13 13:01:20 +02:00
2d9fc0d559
only run workflow manually 2024-08-13 11:55:12 +02:00
8c386d5ac6
use forgejo actions (#72)
Some checks failed
Publish latest version / build (push) Has been cancelled
2024-08-11 16:49:06 +02:00
95b92699ed
update dependencies
All checks were successful
ci/woodpecker/push/publish Pipeline was successful
2024-07-23 10:26:19 +02:00
2dc54a6f76
turn out to be weird with blockquote
All checks were successful
ci/woodpecker/push/publish Pipeline was successful
2024-07-15 10:24:51 +02:00
deb54372a2
update comrak
All checks were successful
ci/woodpecker/push/publish Pipeline was successful
2024-07-13 00:29:07 +02:00
485797c64f
update comrak
Some checks are pending
ci/woodpecker/push/publish Pipeline is pending approval
2024-07-12 17:52:38 +02:00
5b43730150
update dependencie "cached"
All checks were successful
ci/woodpecker/push/publish Pipeline was successful
2024-07-10 23:02:49 +02:00
b145510d83
custom selection color
All checks were successful
ci/woodpecker/push/publish Pipeline was successful
2024-07-10 22:58:35 +02:00
847ec0d3c3
sursis
All checks were successful
ci/woodpecker/push/publish Pipeline was successful
2024-07-10 19:56:36 +02:00
e0b59130ee
macron
All checks were successful
ci/woodpecker/push/publish Pipeline was successful
2024-06-29 13:06:59 +02:00
12 changed files with 477 additions and 270 deletions

View file

@ -0,0 +1,47 @@
name: Publish latest version
on:
workflow_dispatch:
jobs:
build:
container:
image: ghcr.io/catthehacker/ubuntu:act-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Checkout LFS
run: |
# Replace double auth header, see https://github.com/actions/checkout/issues/1830
AUTH=$(git config --local http.${{ github.server_url }}/.extraheader)
git config --local --unset http.${{ github.server_url }}/.extraheader
git config --local http.${{ github.server_url }}/${{ github.repository }}.git/info/lfs/objects/batch.extraheader "$AUTH"
# Get files
git lfs fetch
git lfs checkout
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Sanitize metadata
id: meta
uses: docker/metadata-action@v5
with:
tags: latest
images: git.mylloon.fr/${{ github.repository }}
- name: Login to Registry
uses: docker/login-action@v3
with:
registry: ${{ github.server_url }}
username: ${{ github.actor }}
password: ${{ secrets.TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}

View file

@ -1,15 +0,0 @@
steps:
publish:
image: woodpeckerci/plugin-docker-buildx:2
settings:
labels:
platform: linux/amd64
repo: git.mylloon.fr/${CI_REPO,,}
auto_tag: true
registry: git.mylloon.fr
username: ${CI_REPO_OWNER}
password:
from_secret: cb_token
when:
event: push
branch: main

588
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -10,9 +10,9 @@ publish = false
license = "AGPL-3.0-or-later"
[dependencies]
actix-web = { version = "4.6", default-features = false, features = ["macros", "compress-brotli"] }
actix-web = { version = "4.9", default-features = false, features = ["macros", "compress-brotli"] }
actix-files = "0.6"
cached = { version = "0.51", features = ["async", "ahash"] }
cached = { version = "0.53", features = ["async", "ahash"] }
ramhorns = "1.0"
toml = "0.8"
serde = { version = "1.0", features = ["derive"] }
@ -21,16 +21,17 @@ serde_json = "1.0"
minify-html = "0.15"
minify-js = "0.6"
glob = "0.3"
comrak = "0.24"
comrak = "0.28"
reqwest = { version = "0.12", features = ["json"] }
chrono = { version = "0.4.38", default-features = false, features = ["clock"]}
chrono-tz = "0.9"
chrono-tz = "0.10"
rss = { version = "2.0", features = ["atom"] }
lol_html = "1.2"
base64 = "0.22"
mime_guess = "2.0"
urlencoding = "2.1"
regex = "1.10"
cyborgtime = "2.1.1"
[lints.clippy]
pedantic = "warn"

View file

@ -3,7 +3,7 @@
Easy WebPage generator
[![dependency status](https://deps.rs/repo/gitea/git.mylloon.fr/Anri/mylloon.fr/status.svg)](https://deps.rs/repo/gitea/git.mylloon.fr/Anri/mylloon.fr)
[![status-badge](https://ci.mylloon.fr/api/badges/Anri/mylloon.fr/status.svg)](https://ci.mylloon.fr/Anri/mylloon.fr)
[![status-badge](https://git.mylloon.fr/Anri/mylloon.fr/badges/workflows/publish.yml/badge.svg)](https://git.mylloon.fr/Anri/mylloon.fr/actions?workflow=publish.yml)
- See [issues](https://git.mylloon.fr/Anri/mylloon.fr/issues)
- See [documentation](https://git.mylloon.fr/Anri/mylloon.fr/src/branch/main/Documentation.md)

View file

@ -42,7 +42,14 @@ async fn main() -> Result<()> {
.add(("Server", format!("ewp/{}", env!("CARGO_PKG_VERSION"))))
.add(("Permissions-Policy", "interest-cohort=()")),
)
.service(web::scope("/api").service(web::scope("v1").service(api_v1::love)))
.service(
web::scope("/api").service(
web::scope("v1")
.service(api_v1::love)
.service(api_v1::btf)
.service(api_v1::websites),
),
)
.service(index::page)
.service(agreements::security)
.service(agreements::humans)

View file

@ -122,7 +122,7 @@ pub struct File {
}
/// Options used for parser and compiler MD --> HTML
pub fn get_options() -> ComrakOptions {
pub fn get_options<'a>() -> ComrakOptions<'a> {
let mut options = comrak::Options::default();
// Extension
@ -139,12 +139,18 @@ pub fn get_options() -> ComrakOptions {
options.extension.multiline_block_quotes = true;
options.extension.math_dollars = true;
options.extension.math_code = false;
options.extension.wikilinks_title_after_pipe = false;
options.extension.wikilinks_title_before_pipe = false;
options.extension.underline = true;
options.extension.spoiler = false;
options.extension.greentext = false;
// Parser
options.parse.smart = true; // could be boring
options.parse.default_info_string = Some("plaintext".into());
options.parse.relaxed_tasklist_matching = true;
options.parse.relaxed_autolinks = true;
// options.render.broken_link_callback = ...;
// Renderer
options.render.hardbreaks = false; // could be true? change by metadata could be good for compatibility
@ -155,7 +161,13 @@ pub fn get_options() -> ComrakOptions {
options.render.escape = false;
options.render.list_style = ListStyleType::Dash;
options.render.sourcepos = false;
options.render.experimental_inline_sourcepos = false;
options.render.escaped_char_spans = false;
options.render.ignore_setext = true;
options.render.ignore_empty_links = true;
options.render.gfm_quirks = true;
options.render.prefer_fenced = false;
options.render.figure_with_caption = false;
options
}
@ -167,7 +179,7 @@ fn custom_img_size(html: &str) -> String {
RewriteStrSettings {
element_content_handlers: vec![element!("img[alt]", |el| {
let alt = el.get_attribute("alt").unwrap();
let possible_piece = alt.split(|c| c == '|').collect::<Vec<&str>>();
let possible_piece = alt.split('|').collect::<Vec<&str>>();
if possible_piece.len() > 1 {
let data = possible_piece.last().unwrap().trim();

View file

@ -1,15 +1,53 @@
use std::time::Duration;
use actix_web::{get, HttpResponse, Responder};
use chrono::Utc;
use cyborgtime::format_duration;
use serde::Serialize;
/// Response
/// Response for /love
#[derive(Serialize)]
struct Info {
struct InfoLove {
unix_epoch: u32,
}
#[get("/love")]
pub async fn love() -> impl Responder {
HttpResponse::Ok().json(Info {
HttpResponse::Ok().json(InfoLove {
unix_epoch: 1_605_576_600,
})
}
/// Response for /backtofrance
#[derive(Serialize)]
struct InfoBTF {
unix_epoch: u64,
countdown: String,
}
#[get("/backtofrance")]
pub async fn btf() -> impl Responder {
let target = 1_736_618_100;
let current_time: u64 = Utc::now().timestamp().try_into().unwrap();
let info = InfoBTF {
unix_epoch: target,
countdown: if current_time > target {
"Already happened".to_owned()
} else {
let duration_epoch = target - current_time;
let duration = Duration::from_secs(duration_epoch);
format_duration(duration).to_string()
},
};
HttpResponse::Ok().json(info)
}
#[get("/websites")]
pub async fn websites() -> impl Responder {
HttpResponse::Ok().json((
"http://www.bocal.cs.univ-paris8.fr/~akennel/",
"https://anri.up8.site/",
))
}

BIN
static/badges/friends/jas.webp (Stored with Git LFS)

Binary file not shown.

View file

@ -12,6 +12,7 @@
--background: #f1f1f1;
--font-color: #18181b;
--link-color: #df5a9c;
--selection-color: #c5c5c560;
}
}
@ -21,5 +22,6 @@
--background: #171e26;
--font-color: #bcbcc5;
--link-color: #ff80bf;
--selection-color: #c5c5c530;
}
}

View file

@ -4,6 +4,10 @@ html {
font-family: var(--font-family);
}
::selection {
background-color: var(--selection-color);
}
body,
a {
color: var(--font-color);

View file

@ -12,12 +12,13 @@ window.addEventListener("load", () => {
-webkit-background-clip: text; /* Chromium fix */
color: transparent;
`;
const mono = "font-family: monospace";
const tags = [
new Tag("Comment fonctionne un PC 😵‍💫"),
new Tag("undefined", "font-family: monospace"),
new Tag("/api/v1/love", "font-family: monospace"),
new Tag("A rater son master 🎊"),
new Tag("undefined", mono),
new Tag("/api/v1/love", mono),
new Tag("/api/v1/websites", mono),
new Tag("Peak D2 sur Valo 🤡"),
new Tag(
"0x520",
@ -61,6 +62,7 @@ window.addEventListener("load", () => {
text-shadow: 0px 0px 20px light-dark(var(--font-color), transparent);
`
),
new Tag("s/centre/droite/g", mono),
];
const random = Math.round(Math.random() * (tags.length - 1));