From 9ca4fa5b8ae33a7c2ab381f6fe2bcc34d7b97337 Mon Sep 17 00:00:00 2001 From: silverwizard Date: Wed, 1 Feb 2023 23:46:56 -0500 Subject: [PATCH] Embedded code manually --- Articles/index.html | 25 +++ Articles/style.css | 474 +++++++++++++++++++++++++++++++++++++++++++ src/index.rs | 28 --- src/main.rs | 24 ++- src/style.rs | 475 -------------------------------------------- 5 files changed, 514 insertions(+), 512 deletions(-) create mode 100644 Articles/index.html create mode 100644 Articles/style.css delete mode 100644 src/index.rs delete mode 100644 src/style.rs diff --git a/Articles/index.html b/Articles/index.html new file mode 100644 index 0000000..7d43460 --- /dev/null +++ b/Articles/index.html @@ -0,0 +1,25 @@ +

Obscuritus

+ +

Hello!

+ +

I hope you're not looking for anything too cool here - as this is mostly my musing regarding RPGs, Sysadminning, or homegames. The more I end up doing, the happier I'll be - at some point I'll do more of this.

+ +

If you're looking for old issues of the Obscuritus magazine I printed for my ancient Dresden Files game - I still have them, at that link.

+ +

If you're looking for things I've made for print: +I've currently got nothing to put out - hopefully will change

+ +

If you're interested - my h-card is:

+ +

+ +
+ http://obscuritus.ca +
+ + silverwizard@obscuritus.ca +
+ xmpp:silverwizard@obscuritus.ca +
+ http://convenient.email/profile/silverwizard?tab=profile +

diff --git a/Articles/style.css b/Articles/style.css new file mode 100644 index 0000000..f40e124 --- /dev/null +++ b/Articles/style.css @@ -0,0 +1,474 @@ +@font-face { + font-family: 'journal'; + src: url('Gravity.ttf'); +} + +* { transition: all 0.5s ease;} + + +html,body { +min-height:100%; +width:100%; +margin:0; +} + +body { +background-color:#ddd; +color:#000; +font-family:sans-serif; +margin:0; +padding:0; +} + +a { +color:#369; +text-decoration:none; +} + +a:hover { +text-decoration:underline; +} + +.header { +background-image: -moz-linear-gradient(top, #ffffff, #000000); +background-image: -o-linear-gradient(top, #ffffff, #000000); +background-image: -webkit-linear-gradient(top, #ffffff, #000000); +background-image: linear-gradient(top, #ffffff, #000000); +background-color:#ccc; +border:0; +text-align:center; +margin-left:auto; +margin-right:auto; +line-height:.75em; +padding:.5em; +} + +.header a { +border:0; +color:#111; +text-decoration:none; +} + +.headerTitle { +border:0; +font-size:1.5em; +font-weight:700; +margin:0 0 0 .5em; +padding:.25em; +} + +.headerTitle a { +border:0; +text-decoration:none; +color:#444; +} + +.headerTitle a:hover { +border:0; +text-decoration:underline; +} + +.headerSubtitle { +margin-left:1em; +font-size:.5em; +font-style:italic; +text-align:right; +text-shadow:0 0 0 #fff; +} + +code { +background-color:#ddd; +border:0; +padding:0; +font-size:1.15em; +} + +pre { +background-color:#ddd; +font-family:monospace; +max-height:26em; +overflow-y:auto; +border:1px #ccc dotted; +margin:0 .11em 0 1em; +padding:.2em; +} + +blockquote { +font-family:monospace; +text-align:justify; +margin:.2em; +margin-left:3em; +margin-right:3em; +padding:.2em .75em; +font-size:1.2em; +} + +blockquote blockquote { +border:0; +text-align:right; +text-decoration:underline; +font-size:1em; +} + +table { +border-color:#aaa; +border-style:solid; +border-width:1px; +} + +td { +vertical-align:middle; +border-color:transparent; +border-style:solid; +border-width:1px; +} + +.topOfPage a { +background-color:#ddd; +font-size:2em; +position:fixed; +top:50%; +right:1em; +border-radius:.25em; +border:1px solid #ccc; +opacity:0.6; +margin:0 auto; +padding:.2em; +} + +.topOfPage a:hover { +transition:all .5s ease; +text-decoration:none; +opacity:1; +background-color:#aaa; +color:#f0f0f0; +border:1px solid #ddd; +} + +#top { +border-bottom:1px solid #ccc; +} + +#menu { +background-image: linear-gradient(right, #f0f0f0, #000000); +float: left; +border:0; +border-radius: 10px; +overflow:hidden; +text-align:center; +max-width:15%; +margin:0 auto; +border:solid 1px #ccc; +} + +#menu a { +display:inline; +text-decoration:none; +padding:0 .5em; +} + +#menu ul { +list-style-type:none; +list-style-image:none; +background-color:#ddd; +margin:0; +padding:.3em; +} + +#menu li { +display:inline; +line-height:1.2em; +white-space:nowrap; +} + +#menu ul li a { +background-color:transparent; +padding:.1em 1ex; +} + +#menu ul li a:hover { +color:#111; +text-decoration:none; +text-shadow:2px 2px 4px #999; +} + +#menu a.thisPage { +font-weight:700; +color:#444; +font-size:1em; +} + +#main { +color:#111; +background-color:#f0f0f0; +font-family:serif; +font-size:.85em; +text-align:justify; +margin-left:auto; +margin-right:auto; +width:65%; +max-width:65%; +border:solid 1px #ccc; +padding:1em 2em; +margin-bottom: 8em; /*footer height*/ +} + +li {list-style-type: square;} + +#main ul li { +padding:.2em 1em; +} + +#main ul ul ul { +list-style-type:none; +} + +h1 { +text-align:center; +font-size:2em; +color:#444; +border-bottom:1px solid #aaa; +text-shadow:2px 2px 4px #999; +margin:0px .5em 0px 0ex; +} + +h2 { +font-size:1.7em; +color:#444; +border-bottom:1px dotted #aaa; +margin:1em 1em 0px 0ex; +} + +h3 { +font-size:1.45em; +color:#444; +margin:.9em .2em .2ex 0px; +} + +h4 { +font-size:1.2em; +color:#444; +margin:.8em .3em .2ex 0px; +} + +.center { +background-image: -moz-linear-gradient(top, #ffffff, #000000); +background-image: -o-linear-gradient(top, #ffffff, #000000); +background-image: -webkit-linear-gradient(top, #ffffff, #000000); +background-image: linear-gradient(top, #ffffff, #000000); +margin-left:auto; +margin-right:auto; +width:70%; +text-align:center; +} + +.left { +float:left; +margin:0; +padding:0; +} + +.right { +float:right; +margin:0; +padding:0; +} + +#footer { +color:#999999; +border-radius: 28px; +background-image: -moz-linear-gradient(top, #000000, transparent); +background-image: -o-linear-gradient(top, #000000, transparent); +background-image: -webkit-linear-gradient(top, #000000, transparent); +background-image: linear-gradient(top, #000000, transparent); +background-clip: padding-box; +height:3em; +background-color:#ddd; +font-size:.8em; +text-align:center; +position:fixed; +bottom:0px; +right:0px; +z-index:1; +margin:0 auto; +padding:.2em; +width:100%; +opacity:0.91; +} + +#footer:hover { +opacity:1; +} + +#footer img { +margin-left:.2em; +margin-right:.2em; +vertical-align:middle; +} + +#footer .left { +text-align:left; +float:left; +clear:left; +} + +#footer .right { +text-align:right; +} + +abbr,acronym { +border-bottom:1px dotted #333; +cursor:help; +} + +img,table,td,blockquote,code,pre,textarea,input,iframe,object,embed,video { +max-width:100%; +} + +hr { +color:#aaa; +background-color:#aaa; +height:1px; +border:0; +margin-top:0; +margin-bottom:1.5em; +} + +code,pre,samp { +white-space:pre-wrap; +} + +#extrait { +margin-top:1em; +font-family:sans-serif; +font-size:12px; +column-count:2; +-moz-column-count:2; +column-gap:30px; +-moz-column-gap:30px; +} + +#extrait h1 { +color:#444; +border-bottom:0; +text-shadow:0 0 0 #fff; +font-size:14px; +text-align:center; +} + +#extrait h2 {font-size:11px;} +#extrait h3 {font-size:10px;} + +*,textarea,table,td,th,code,pre,samp { +word-wrap:break-word; +hyphens:auto; +} + +p img, p a img { + overflow: hidden; + padding: 10px; + margin-left:auto; + margin-right:auto; + display:block; +} + +p a img:hover { + box-shadow: 2px 2px 6px #999; + text-shadow:2px 2px 6px #999; +} + +#ad { +position:absolute; +width:350px; +top:10%; +right:-370px; +border:1px solid #ccc; +padding: 20px; +background-color:#ccc; +word-wrap:break-word; +hyphens:auto; +} + +#ad:hover { +right:0px; +} + +#imagewall img{ +clear:both; +} + + +form {text-align:center;} +input {text-align:center;} + + +.ca-menu{ + clear:both; + padding:0; + text-shadow: 2px 2px 2px rgba(0,0,0,0.5); + word-wrap:break-word; + hyphens:auto; + margin-left:auto; + margin-right:auto; + text-align:center; +} +.ca-menu li{ + width: 140px; + height: 100px; + position: relative; + display: inline-block; +} +.ca-menu li:last-child{ + margin-right: 0px; + margin-left: 0px; +} +.ca-menu li a{ + text-align: left; + width: 100%; + height: 100%; + position: relative; + display: block; + color: #444; +} +.ca-icon{ + font-family: monospace; + font-size: 6em; + color: #aaa; + position: absolute; + width: 100%; + left: 0px; + text-align: center; + opacity:1; +} +.ca-main{ + font-family: sans; + font-size: 0; + position: absolute; + width: 140px; + text-align: center; + opacity:0; + top:10px; +} +.ca-desc{ + font-family: sans; + font-size: 0; + position: absolute; + width: 140px; + text-align: center; + opacity:0; + top:35px; +} +.ca-menu li:hover .ca-icon{ + font-size:0; + opacity:0; +} +.ca-menu li:hover .ca-main{ + font-size: 1.4em; + opacity: 1; + text-shadow: 0px 0px 0px rgba(0,0,0,0); +} +.ca-menu li:hover .ca-desc{ + font-size: 0.9em; + opacity: 1; + text-shadow: 0px 0px 0px rgba(0,0,0,0); +} diff --git a/src/index.rs b/src/index.rs deleted file mode 100644 index a8cea42..0000000 --- a/src/index.rs +++ /dev/null @@ -1,28 +0,0 @@ -#![no_main] - -pub static INDEX: &str = " - -

Obscuritus

-

Hello!

- -

I hope you're not looking for anything too cool here - as this is mostly my musing regarding RPGs, Sysadminning, or homegames. The more I end up doing, the happier I'll be - at some point I'll do more of this.

- -

If you're looking for old issues of the Obscuritus magazine I printed for my ancient Dresden Files game - I still have them, at that link.

- -

If you're looking for things I've made for print: -I've currently got nothing to put out - hopefully will change

- -

If you're interested - my h-card is:

- -

- -
- http://www.obscuritus.ca -
- - silverwizard@obscuritus.ca -
- -
-
http://convenient.email/profile/silverwizard?tab=profile -

"; diff --git a/src/main.rs b/src/main.rs index a01cdbe..1f67214 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,14 +3,20 @@ use std::{ net::{TcpListener, TcpStream}, str, }; +use rust_embed::RustEmbed; -#[path = "./index.rs"] -mod index; -#[path = "./style.rs"] -mod style; +#[derive(RustEmbed)] +#[folder = "./Articles"] +struct Asset; fn main() { let listener = TcpListener::bind("0.0.0.0:7878").unwrap(); + + for file in Asset::iter() { + let page = Asset::get(&file.to_string()).unwrap(); + println!("{:?}", std::str::from_utf8(page.data.as_ref())); + } + for stream in listener.incoming() { let stream = stream.unwrap(); @@ -23,16 +29,16 @@ fn handle_connection(mut stream: TcpStream) { let buf_reader = BufReader::new(&mut stream); let request_line = buf_reader.lines().next().unwrap().unwrap(); let mut content = "Error 404

Not Found

"; + let mut page; let mut status_line = "HTTP/1.1 404 NOT FOUND"; if request_line == "GET / HTTP/1.1" { status_line = "HTTP/1.1 200 OK"; - content = "Sean's Got A Webserver

EVERYBODY RUN

"; - }else if request_line == "GET /index.html HTTP/1.1" { - status_line = "HTTP/1.1 200 OK"; - content = index::INDEX; + page = Asset::get("index.html").unwrap(); + content = std::str::from_utf8(page.data.as_ref()).unwrap(); }else if request_line == "GET /style.css HTTP/1.1" { status_line = "HTTP/1.1 200 OK"; - content = style::STYLE; + page = Asset::get("style.css").unwrap(); + content = std::str::from_utf8(page.data.as_ref()).unwrap(); } let status_line = "HTTP/1.1 200 OK"; let length = content.len(); diff --git a/src/style.rs b/src/style.rs deleted file mode 100644 index f9328be..0000000 --- a/src/style.rs +++ /dev/null @@ -1,475 +0,0 @@ -#![no_main] -pub static STYLE: &str = "@font-face { - font-family: 'journal'; - src: url('Gravity.ttf'); - } - - * { transition: all 0.5s ease;} - - - html,body { - min-height:100%; - width:100%; - margin:0; - } - - body { - background-color:#ddd; - color:#000; - font-family:sans-serif; - margin:0; - padding:0; - } - - a { - color:#369; - text-decoration:none; - } - - a:hover { - text-decoration:underline; - } - - .header { - background-image: -moz-linear-gradient(top, #ffffff, #000000); - background-image: -o-linear-gradient(top, #ffffff, #000000); - background-image: -webkit-linear-gradient(top, #ffffff, #000000); - background-image: linear-gradient(top, #ffffff, #000000); - background-color:#ccc; - border:0; - text-align:center; - margin-left:auto; - margin-right:auto; - line-height:.75em; - padding:.5em; - } - - .header a { - border:0; - color:#111; - text-decoration:none; - } - - .headerTitle { - border:0; - font-size:1.5em; - font-weight:700; - margin:0 0 0 .5em; - padding:.25em; - } - - .headerTitle a { - border:0; - text-decoration:none; - color:#444; - } - - .headerTitle a:hover { - border:0; - text-decoration:underline; - } - - .headerSubtitle { - margin-left:1em; - font-size:.5em; - font-style:italic; - text-align:right; - text-shadow:0 0 0 #fff; - } - - code { - background-color:#ddd; - border:0; - padding:0; - font-size:1.15em; - } - - pre { - background-color:#ddd; - font-family:monospace; - max-height:26em; - overflow-y:auto; - border:1px #ccc dotted; - margin:0 .11em 0 1em; - padding:.2em; - } - - blockquote { - font-family:monospace; - text-align:justify; - margin:.2em; - margin-left:3em; - margin-right:3em; - padding:.2em .75em; - font-size:1.2em; - } - - blockquote blockquote { - border:0; - text-align:right; - text-decoration:underline; - font-size:1em; - } - - table { - border-color:#aaa; - border-style:solid; - border-width:1px; - } - - td { - vertical-align:middle; - border-color:transparent; - border-style:solid; - border-width:1px; - } - - .topOfPage a { - background-color:#ddd; - font-size:2em; - position:fixed; - top:50%; - right:1em; - border-radius:.25em; - border:1px solid #ccc; - opacity:0.6; - margin:0 auto; - padding:.2em; - } - - .topOfPage a:hover { - transition:all .5s ease; - text-decoration:none; - opacity:1; - background-color:#aaa; - color:#f0f0f0; - border:1px solid #ddd; - } - - #top { - border-bottom:1px solid #ccc; - } - - #menu { - background-image: linear-gradient(right, #f0f0f0, #000000); - float: left; - border:0; - border-radius: 10px; - overflow:hidden; - text-align:center; - max-width:15%; - margin:0 auto; - border:solid 1px #ccc; - } - - #menu a { - display:inline; - text-decoration:none; - padding:0 .5em; - } - - #menu ul { - list-style-type:none; - list-style-image:none; - background-color:#ddd; - margin:0; - padding:.3em; - } - - #menu li { - display:inline; - line-height:1.2em; - white-space:nowrap; - } - - #menu ul li a { - background-color:transparent; - padding:.1em 1ex; - } - - #menu ul li a:hover { - color:#111; - text-decoration:none; - text-shadow:2px 2px 4px #999; - } - - #menu a.thisPage { - font-weight:700; - color:#444; - font-size:1em; - } - - #main { - color:#111; - background-color:#f0f0f0; - font-family:serif; - font-size:.85em; - text-align:justify; - margin-left:auto; - margin-right:auto; - width:65%; - max-width:65%; - border:solid 1px #ccc; - padding:1em 2em; - margin-bottom: 8em; /*footer height*/ - } - - li {list-style-type: square;} - - #main ul li { - padding:.2em 1em; - } - - #main ul ul ul { - list-style-type:none; - } - - h1 { - text-align:center; - font-size:2em; - color:#444; - border-bottom:1px solid #aaa; - text-shadow:2px 2px 4px #999; - margin:0px .5em 0px 0ex; - } - - h2 { - font-size:1.7em; - color:#444; - border-bottom:1px dotted #aaa; - margin:1em 1em 0px 0ex; - } - - h3 { - font-size:1.45em; - color:#444; - margin:.9em .2em .2ex 0px; - } - - h4 { - font-size:1.2em; - color:#444; - margin:.8em .3em .2ex 0px; - } - - .center { - background-image: -moz-linear-gradient(top, #ffffff, #000000); - background-image: -o-linear-gradient(top, #ffffff, #000000); - background-image: -webkit-linear-gradient(top, #ffffff, #000000); - background-image: linear-gradient(top, #ffffff, #000000); - margin-left:auto; - margin-right:auto; - width:70%; - text-align:center; - } - - .left { - float:left; - margin:0; - padding:0; - } - - .right { - float:right; - margin:0; - padding:0; - } - - #footer { - color:#999999; - border-radius: 28px; - background-image: -moz-linear-gradient(top, #000000, transparent); - background-image: -o-linear-gradient(top, #000000, transparent); - background-image: -webkit-linear-gradient(top, #000000, transparent); - background-image: linear-gradient(top, #000000, transparent); - background-clip: padding-box; - height:3em; - background-color:#ddd; - font-size:.8em; - text-align:center; - position:fixed; - bottom:0px; - right:0px; - z-index:1; - margin:0 auto; - padding:.2em; - width:100%; - opacity:0.91; - } - - #footer:hover { - opacity:1; - } - - #footer img { - margin-left:.2em; - margin-right:.2em; - vertical-align:middle; - } - - #footer .left { - text-align:left; - float:left; - clear:left; - } - - #footer .right { - text-align:right; - } - - abbr,acronym { - border-bottom:1px dotted #333; - cursor:help; - } - - img,table,td,blockquote,code,pre,textarea,input,iframe,object,embed,video { - max-width:100%; - } - - hr { - color:#aaa; - background-color:#aaa; - height:1px; - border:0; - margin-top:0; - margin-bottom:1.5em; - } - - code,pre,samp { - white-space:pre-wrap; - } - - #extrait { - margin-top:1em; - font-family:sans-serif; - font-size:12px; - column-count:2; - -moz-column-count:2; - column-gap:30px; - -moz-column-gap:30px; - } - - #extrait h1 { - color:#444; - border-bottom:0; - text-shadow:0 0 0 #fff; - font-size:14px; - text-align:center; - } - - #extrait h2 {font-size:11px;} - #extrait h3 {font-size:10px;} - - *,textarea,table,td,th,code,pre,samp { - word-wrap:break-word; - hyphens:auto; - } - - p img, p a img { - overflow: hidden; - padding: 10px; - margin-left:auto; - margin-right:auto; - display:block; - } - - p a img:hover { - box-shadow: 2px 2px 6px #999; - text-shadow:2px 2px 6px #999; - } - - #ad { - position:absolute; - width:350px; - top:10%; - right:-370px; - border:1px solid #ccc; - padding: 20px; - background-color:#ccc; - word-wrap:break-word; - hyphens:auto; - } - - #ad:hover { - right:0px; - } - - #imagewall img{ - clear:both; - } - - - form {text-align:center;} - input {text-align:center;} - - - .ca-menu{ - clear:both; - padding:0; - text-shadow: 2px 2px 2px rgba(0,0,0,0.5); - word-wrap:break-word; - hyphens:auto; - margin-left:auto; - margin-right:auto; - text-align:center; - } - .ca-menu li{ - width: 140px; - height: 100px; - position: relative; - display: inline-block; - } - .ca-menu li:last-child{ - margin-right: 0px; - margin-left: 0px; - } - .ca-menu li a{ - text-align: left; - width: 100%; - height: 100%; - position: relative; - display: block; - color: #444; - } - .ca-icon{ - font-family: monospace; - font-size: 6em; - color: #aaa; - position: absolute; - width: 100%; - left: 0px; - text-align: center; - opacity:1; - } - .ca-main{ - font-family: sans; - font-size: 0; - position: absolute; - width: 140px; - text-align: center; - opacity:0; - top:10px; - } - .ca-desc{ - font-family: sans; - font-size: 0; - position: absolute; - width: 140px; - text-align: center; - opacity:0; - top:35px; - } - .ca-menu li:hover .ca-icon{ - font-size:0; - opacity:0; - } - .ca-menu li:hover .ca-main{ - font-size: 1.4em; - opacity: 1; - text-shadow: 0px 0px 0px rgba(0,0,0,0); - } - .ca-menu li:hover .ca-desc{ - font-size: 0.9em; - opacity: 1; - text-shadow: 0px 0px 0px rgba(0,0,0,0); - }";