+ {% when (axum_messages::Level::Error) %}
+
+ {% else %}
+
+ {% endmatch %}
+ {{ message }}
+
+ {% endfor %}
+
+ {% endblock %}
{% block content %}
Placeholder content
{% endblock %}
diff --git a/templates/error.html b/templates/errors/base.html
similarity index 77%
rename from templates/error.html
rename to templates/errors/base.html
index 8878005..9267b41 100644
--- a/templates/error.html
+++ b/templates/errors/base.html
@@ -1,6 +1,6 @@
{# SPDX-License-Identifier: CC0-1.0
#
- # templates/error.html
+ # templates/errors/base.html
#
# This file is a component of ShadyURL by Elizabeth Myers.
#
@@ -11,17 +11,19 @@
# You should have received a copy of the CC0 legalcode along with this
# work. If not, see
.
#}
-{% extends "base.html" %}
+{% extends "../base.html" %}
{% block head_addition %}
{% endblock %}
{% block title %}Error{% endblock %}
{% block header %}
Error
-
{{ error_code }}
+
{% block error_code %}An error occurred{% endblock %}
{% endblock %}
+{% block messages %}{% endblock %}
{% block content %}
- {{ reason }}
+{% block error_content %}
+{% endblock %}
diff --git a/templates/errors/code/400.html b/templates/errors/code/400.html
new file mode 100644
index 0000000..be39817
--- /dev/null
+++ b/templates/errors/code/400.html
@@ -0,0 +1,16 @@
+{# SPDX-License-Identifier: CC0-1.0
+ #
+ # templates/errors/code/400.html
+ #
+ # This file is a component of ShadyURL by Elizabeth Myers.
+ #
+ # To the extent possible under law, the person who associated CC0 with
+ # ShadyURL has waived all copyright and related or neighboring rights
+ # to ShadyURL.
+ #
+ # You should have received a copy of the CC0 legalcode along with this
+ # work. If not, see .
+ #}
+{% extends "./errors/base.html" %}
+{% block error_code %}400{% endblock %}
+{% block error_content %}Bad Request: {{ error_reason }}{% endblock %}
diff --git a/templates/errors/code/403.html b/templates/errors/code/403.html
new file mode 100644
index 0000000..ba29e47
--- /dev/null
+++ b/templates/errors/code/403.html
@@ -0,0 +1,16 @@
+{# SPDX-License-Identifier: CC0-1.0
+ #
+ # templates/errors/code/403.html
+ #
+ # This file is a component of ShadyURL by Elizabeth Myers.
+ #
+ # To the extent possible under law, the person who associated CC0 with
+ # ShadyURL has waived all copyright and related or neighboring rights
+ # to ShadyURL.
+ #
+ # You should have received a copy of the CC0 legalcode along with this
+ # work. If not, see .
+ #}
+{% extends "./errors/base.html" %}
+{% block error_code %}403{% endblock %}
+{% block error_content %}Unauthorized{% endblock %}
diff --git a/templates/errors/code/404.html b/templates/errors/code/404.html
new file mode 100644
index 0000000..2296c19
--- /dev/null
+++ b/templates/errors/code/404.html
@@ -0,0 +1,16 @@
+{# SPDX-License-Identifier: CC0-1.0
+ #
+ # templates/errors/code/404.html
+ #
+ # This file is a component of ShadyURL by Elizabeth Myers.
+ #
+ # To the extent possible under law, the person who associated CC0 with
+ # ShadyURL has waived all copyright and related or neighboring rights
+ # to ShadyURL.
+ #
+ # You should have received a copy of the CC0 legalcode along with this
+ # work. If not, see .
+ #}
+{% extends "./errors/base.html" %}
+{% block error_code %}404{% endblock %}
+{% block error_content %}Not Found{% endblock %}
diff --git a/templates/errors/code/500.html b/templates/errors/code/500.html
new file mode 100644
index 0000000..00514a9
--- /dev/null
+++ b/templates/errors/code/500.html
@@ -0,0 +1,16 @@
+{# SPDX-License-Identifier: CC0-1.0
+ #
+ # templates/errors/code/500.html
+ #
+ # This file is a component of ShadyURL by Elizabeth Myers.
+ #
+ # To the extent possible under law, the person who associated CC0 with
+ # ShadyURL has waived all copyright and related or neighboring rights
+ # to ShadyURL.
+ #
+ # You should have received a copy of the CC0 legalcode along with this
+ # work. If not, see .
+ #}
+{% extends "./errors/base.html" %}
+{% block error_code %}500{% endblock %}
+{% block error_content %}Internal Server Error: {{ error_reason }}{% endblock %}
diff --git a/templates/post_error.html b/templates/errors/form/url.html
similarity index 50%
rename from templates/post_error.html
rename to templates/errors/form/url.html
index e33847d..9dbf11b 100644
--- a/templates/post_error.html
+++ b/templates/errors/form/url.html
@@ -1,6 +1,6 @@
{# SPDX-License-Identifier: CC0-1.0
#
- # templates/post_error.html
+ # templates/errors/form/url.html
#
# This file is a component of ShadyURL by Elizabeth Myers.
#
@@ -11,17 +11,9 @@
# You should have received a copy of the CC0 legalcode along with this
# work. If not, see .
#}
-{% extends "base.html" %}
-{% block path %}makeurl{% endblock %}
-{% block head_addition %}{% endblock %}
-{% block title %}Error{% endblock %}
-{% block header %}
-
Error!
-{% endblock %}
-{% block content %}
-
- Could not make your URL {{ url|escape }} shady: {{ reason }}
-
- Go home
-
+{% extends "./errors/base.html" %}
+{% block error_code %}Problem with submission{% endblock %}
+{% block error_content %}
+ Could not make your URL ({{ url|escape }}shady:
+ {{ error_reason }}
{% endblock %}
diff --git a/templates/index.html b/templates/index.html
index 9645a03..0033729 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -13,6 +13,14 @@
#}
{% extends "base.html" %}
{% block title %}{{ sitename }}{% endblock %}
+{% block head_addition %}
+
+
+
+
+
+
+{% endblock %}
{% block header %}
{{ sitename }}
Make your URLs shady
@@ -20,9 +28,8 @@
Make your URLs shady
{% block content %}
-
diff --git a/templates/post.html b/templates/submit.html
similarity index 97%
rename from templates/post.html
rename to templates/submit.html
index 9c953fd..903efa4 100644
--- a/templates/post.html
+++ b/templates/submit.html
@@ -1,6 +1,6 @@
{# SPDX-License-Identifier: CC0-1.0
#
- # templates/post.html
+ # templates/submit.html
#
# This file is a component of ShadyURL by Elizabeth Myers.
#
diff --git a/utils/password_hash.sh b/utils/password_hash.sh
deleted file mode 100755
index a1197d8..0000000
--- a/utils/password_hash.sh
+++ /dev/null
@@ -1,135 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: CC0-1.0
-#
-# utils/password_hash.sh
-#
-# This file is a component of ShadyURL by Elizabeth Myers.
-#
-# To the extent possible under law, the person who associated CC0 with
-# ShadyURL has waived all copyright and related or neighboring rights
-# to ShadyURL.
-#
-# You should have received a copy of the CC0 legalcode along with this
-# work. If not, see .
-
-usage()
-{
- echo "Usage: $0 [-t N] [-m N] [-p N] [-h]" >&2
-}
-
-cleanup()
-{
- stty "$1"
-}
-
-bail()
-{
- echo "$1" >&2
- exit 1
-}
-
-gen_randint()
-{
- # Needed on macOS
- export LC_ALL="C"
-
- range0="$1"
- range1="$2"
- i=""
- until [ -n "$i" ] && [ "$i" -gt "$range0" -a "$i" -lt "$range1" ]
- do
- # status=none isn't portable, so do this
- i="$(dd if=/dev/random bs=1 count=1 2>/dev/null | od -tu1 -An | xargs)"
- done
- echo "$i"
-}
-
-gen_salt()
-{
- # Needed on macOS
- export LC_ALL="C"
-
- saltlen="$(gen_randint "12" "24")" || bail "Could not get random int"
- (tr -dc '[:print:]' $tty
- stty -echo
- read pw1 || bail "Could not read password"
- stty "$orig_stty"
-
- printf "\nRetype Password: " >$tty
- stty -echo
- read pw2 || bail "Could not read password"
- stty "$orig_stty"
- echo >$tty
-
- [ "$pw1" == "$pw2" ] || bail "Passwords didn't match"
- passwd="$pw1"
-
- salt="$(gen_salt)" || bail "Could not generate salt"
- else
- passwd="$1"
- fi
-
- (printf "$passwd" | argon2 "$salt" -id -e -m "$MEMORY" -t "$ITERATIONS" -p "$PARALLELISM" -v 13) || bail "Could not generate argon2 hash"
-}
-
-# Defaults
-ITERATIONS=12
-MEMORY=16
-PARALLELISM=4
-
-args=`getopt t:m:p:h $*`
-if [ $? -ne 0 ]; then
- usage "$0"
- exit 2
-fi
-set -- $args
-while :; do
- case "$1" in
- -t)
- printf "%d" "$2" &>/dev/null || bail "-t must be an integer"
- ITERATIONS="$2"
- shift; shift
- ;;
- -m)
- printf "%d" "$2" &>/dev/null || bail "-m must be an integer"
- MEMORY="$2"
- shift; shift
- ;;
- -p)
- printf "%d" "$2" &>/dev/null || bail "-p must be an integer"
- PARALLELISM="$2"
- shift; shift
- ;;
- -h)
- usage "$0"
- exit
- ;;
- --)
- shift; break
- ;;
- esac
-done
-
-passwd="$(gen_hash "$ITERATIONS" "$MEMORY" "$PARALLELISM")" || bail "Could not generate password"
-printf "\nPASSWORD_HASH='%s'\n" "${passwd}"