Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
Org Flux
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stephen D
Org Flux
Commits
f2e12599
Commit
f2e12599
authored
1 week ago
by
Stephen D
Browse files
Options
Downloads
Patches
Plain Diff
web badge support
parent
0f35cbad
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#8889
failed
1 week ago
Stage: test
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
Cargo.lock
+27
-9
27 additions, 9 deletions
Cargo.lock
src/assets/style.css
+13
-0
13 additions, 0 deletions
src/assets/style.css
src/blog.rs
+20
-2
20 additions, 2 deletions
src/blog.rs
src/config.rs
+9
-0
9 additions, 0 deletions
src/config.rs
src/misc.rs
+3
-0
3 additions, 0 deletions
src/misc.rs
with
72 additions
and
11 deletions
Cargo.lock
+
27
−
9
View file @
f2e12599
# This file is automatically @generated by Cargo.
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
# It is not intended for manual editing.
version =
3
version =
4
[[package]]
[[package]]
name = "addr2line"
name = "addr2line"
...
@@ -241,9 +241,12 @@ dependencies = [
...
@@ -241,9 +241,12 @@ dependencies = [
[[package]]
[[package]]
name = "deranged"
name = "deranged"
version = "0.3.
8
"
version = "0.3.
11
"
source = "registry+https://github.com/rust-lang/crates.io-index"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2696e8a945f658fd14dc3b87242e6b80cd0f36ff04ea560fa39082368847946"
checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4"
dependencies = [
"powerfmt",
]
[[package]]
[[package]]
name = "digest"
name = "digest"
...
@@ -877,6 +880,12 @@ dependencies = [
...
@@ -877,6 +880,12 @@ dependencies = [
"minimal-lexical",
"minimal-lexical",
]
]
[[package]]
name = "num-conv"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
[[package]]
[[package]]
name = "num-integer"
name = "num-integer"
version = "0.1.45"
version = "0.1.45"
...
@@ -1085,6 +1094,12 @@ dependencies = [
...
@@ -1085,6 +1094,12 @@ dependencies = [
"miniz_oxide",
"miniz_oxide",
]
]
[[package]]
name = "powerfmt"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
[[package]]
[[package]]
name = "ppv-lite86"
name = "ppv-lite86"
version = "0.2.17"
version = "0.2.17"
...
@@ -1509,12 +1524,14 @@ dependencies = [
...
@@ -1509,12 +1524,14 @@ dependencies = [
[[package]]
[[package]]
name = "time"
name = "time"
version = "0.3.
28
"
version = "0.3.
37
"
source = "registry+https://github.com/rust-lang/crates.io-index"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "
17f6bb557fd245c28e6411aa56b6403c689ad95061f50e4be16c274e70a17e48
"
checksum = "
35e7868883861bd0e56d9ac6efcaaca0d6d5d82a2a7ec8209ff492c07cf37b21
"
dependencies = [
dependencies = [
"deranged",
"deranged",
"itoa",
"itoa",
"num-conv",
"powerfmt",
"serde",
"serde",
"time-core",
"time-core",
"time-macros",
"time-macros",
...
@@ -1522,16 +1539,17 @@ dependencies = [
...
@@ -1522,16 +1539,17 @@ dependencies = [
[[package]]
[[package]]
name = "time-core"
name = "time-core"
version = "0.1.
1
"
version = "0.1.
2
"
source = "registry+https://github.com/rust-lang/crates.io-index"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "
7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb
"
checksum = "
ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3
"
[[package]]
[[package]]
name = "time-macros"
name = "time-macros"
version = "0.2.1
4
"
version = "0.2.1
9
"
source = "registry+https://github.com/rust-lang/crates.io-index"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "
1a942f44339478ef67935ab2bbaec2fb0322496cf3cbe84b261e06ac3814c572
"
checksum = "
2834e6017e3e5e4b9834939793b282bc03b37a3336245fa820e35e233e2a85de
"
dependencies = [
dependencies = [
"num-conv",
"time-core",
"time-core",
]
]
...
...
This diff is collapsed.
Click to expand it.
src/assets/style.css
+
13
−
0
View file @
f2e12599
...
@@ -60,3 +60,16 @@ code {
...
@@ -60,3 +60,16 @@ code {
color
:
#e83e8c
;
color
:
#e83e8c
;
word-break
:
break-word
;
word-break
:
break-word
;
}
}
.badge
{
image-rendering
:
auto
;
image-rendering
:
crisp-edges
;
image-rendering
:
pixelated
;
image-rendering
:
-webkit-optimize-contrast
;
margin
:
2px
;
}
.badges
{
width
:
550px
;
margin
:
3em
auto
;
}
This diff is collapsed.
Click to expand it.
src/blog.rs
+
20
−
2
View file @
f2e12599
...
@@ -46,8 +46,26 @@ impl Blog {
...
@@ -46,8 +46,26 @@ impl Blog {
let
name
=
&
self
.config.name
;
let
name
=
&
self
.config.name
;
let
description
=
&
self
.config.description
;
let
description
=
&
self
.config.description
;
let
mut
content
=
format!
(
let
mut
content
=
r#"<div class="centered"><h1>{name}</h1>{description}</div><h2>Recent Posts <a href="/posts.rss"><img src="/rss.svg" width="16em" /></a></h2><table>"#
format!
(
r#"<div class="centered"><h1>{name}</h1>{description}<div class="badges">"#
);
for
b
in
&
self
.config.badge
{
if
let
Some
(
href
)
=
&
b
.href
{
content
.push_str
(
&
format!
(
r#"<a href="{}">"#
,
href
));
}
content
.push_str
(
&
format!
(
r#"<img class="badge" src="/img/badges/{}" alt="{}" />"#
,
b
.name
,
b
.alt
));
if
b
.href
.is_some
()
{
content
.push_str
(
"</a>"
)
}
}
content
.push_str
(
r#"</div></div><h2>Recent Posts <a href="/posts.rss"><img src="/rss.svg" width="16em" /></a></h2><table>"#
);
);
for
post
in
&
self
.posts
{
for
post
in
&
self
.posts
{
...
...
This diff is collapsed.
Click to expand it.
src/config.rs
+
9
−
0
View file @
f2e12599
...
@@ -16,6 +16,13 @@ pub struct Logo {
...
@@ -16,6 +16,13 @@ pub struct Logo {
pub
alt
:
String
,
pub
alt
:
String
,
}
}
#[derive(Deserialize,
Clone)]
pub
struct
Badge
{
pub
name
:
String
,
pub
href
:
Option
<
String
>
,
pub
alt
:
String
,
}
#[derive(Deserialize,
Clone)]
#[derive(Deserialize,
Clone)]
pub
struct
Config
{
pub
struct
Config
{
pub
name
:
String
,
pub
name
:
String
,
...
@@ -23,6 +30,8 @@ pub struct Config {
...
@@ -23,6 +30,8 @@ pub struct Config {
pub
path
:
String
,
pub
path
:
String
,
pub
root
:
String
,
pub
root
:
String
,
pub
logo
:
Option
<
Logo
>
,
pub
logo
:
Option
<
Logo
>
,
#[serde(default)]
pub
badge
:
Vec
<
Badge
>
,
pub
metrics
:
Metrics
,
pub
metrics
:
Metrics
,
}
}
...
...
This diff is collapsed.
Click to expand it.
src/misc.rs
+
3
−
0
View file @
f2e12599
...
@@ -59,6 +59,9 @@ fn content_type(ext: &str) -> anyhow::Result<&'static str> {
...
@@ -59,6 +59,9 @@ fn content_type(ext: &str) -> anyhow::Result<&'static str> {
"mp4"
=>
"video/mp4"
,
"mp4"
=>
"video/mp4"
,
"ico"
=>
"image/x-icon"
,
"ico"
=>
"image/x-icon"
,
"svg"
=>
"image/svg+xml"
,
"svg"
=>
"image/svg+xml"
,
"png"
=>
"image/png"
,
"gif"
=>
"image/gif"
,
"webp"
=>
"image/webp"
,
_
=>
bail!
(
"Unsure how to handle extension {ext}"
),
_
=>
bail!
(
"Unsure how to handle extension {ext}"
),
};
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment