Finished code. It's a spaghetti ball now.
Diff
.gitignore | 2 ++
html/404.html | 18 ++++++++++++++++++
html/paste.html | 16 +++++++++++++---
html/url.html | 16 +++++++++++++---
src/templating.rs | 1 +
html/static/style.css | 15 +++++++++++++++
target/debug/url_shortener | 0
7 files changed, 57 insertions(+), 11 deletions(-)
@@ -1,3 +1,5 @@
target/
.vscode/
.vscode
target
config.toml
@@ -1,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="/static/style.css">
<title>7800.io: URL Shortener</title>
</head>
<body>
<h1>URL Shortener</h1>
<main>
<div id="ui">
<p>Your entry was not found.</p>
<div class="url">
<span class="domain">{domain}</span>/{shortened}
</div>
</div>
</main>
</body>
</html>
@@ -1,12 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<title>Paste</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="static/style.css" />
<link rel="stylesheet" href="/static/style.css">
<title>7800.io: Pastebin</title>
</head>
<body>
<h1>Paste</h1>
<p>Your paste is accessible at {{domain}}/{{shortened}}</p>
<h1>URL Shortener</h1>
<main>
<div id="ui">
<p>Text pasted successfully</p>
<div class="url">
<span class="domain">{domain}</span>/{shortened}
</div>
</div>
</main>
</body>
</html>
@@ -1,12 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<title>URL shortened</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="static/style.css" />
<link rel="stylesheet" href="/static/style.css">
<title>7800.io: URL Shortener</title>
</head>
<body>
<h1>URL shortened successfully</h1>
<p>Your url is accessible at {domain}/{shortened}</p>
<h1>URL Shortener</h1>
<main>
<div id="ui">
<p>URL shortened successfully</p>
<div class="url">
<span class="domain">{domain}</span>/{shortened}
</div>
</div>
</main>
</body>
</html>
@@ -73,6 +73,7 @@
}
pub async fn get_necessary_value(key: String, key_value: u8, app_data: web::Data<AppData>, schema: &mut TemplateSchema) -> String {
println!("Evaluating {}:{}", key, key_value);
match key.as_str() {
"content" =>
@@ -70,7 +70,6 @@
border-radius: 1em;
}
.text {
display: block;
font-family: monospace;
@@ -79,6 +78,7 @@
border: 2px dashed white;
padding: 0.5em 1em;
margin: 1em 0;
width: 100%;
}
@@ -98,4 +98,17 @@
textarea {
width: 20em;
height: 10em;
}
.url {
font-family: monospace !important;
color: white !important;
display: block;
text-transform: none !important;
margin-bottom: 1em;
}
.domain {
color: lightgray !important;
}
Binary files a/target/debug/url_shortener and a/target/debug/url_shortener differ