Compare commits
2 Commits
9f6bbef4b2
...
36796b9f50
Author | SHA1 | Date | |
---|---|---|---|
36796b9f50
|
|||
8726de8b3b
|
@ -5,6 +5,7 @@
|
||||
(import bleach [clean])
|
||||
(import validators [domain :as domain?])
|
||||
(require hyrule.destructure [setv+])
|
||||
(import subprocess [check-output])
|
||||
|
||||
(defn create-comment [request]
|
||||
(setv now (datetime.now))
|
||||
@ -20,7 +21,13 @@
|
||||
(when (not (dir? f"./www/data/comments/{url-comment-dir}"))
|
||||
(mkdir f"./www/data/comments/{url-comment-dir}"))
|
||||
|
||||
(setv+ {{comment "comment" name "name" site "site"} "body"} request)
|
||||
(setv+ {{comment "comment" name "name" site "site" commit "commit"} "body"} request)
|
||||
|
||||
(when (!= (. (check-output "git log -1 --format=%h" :shell True :executable "/bin/bash") (decode) (strip)) commit)
|
||||
(print (. (check-output "git log -1 --format=%h" :shell True :executable "/bin/bash") (decode) (strip)) commit)
|
||||
(return (dict
|
||||
:code 303
|
||||
:headers {"Location" (. request (get "headers") (get "Referer"))})))
|
||||
|
||||
(when (.startswith site "//")
|
||||
(setv site (.replace site "//" "")))
|
||||
|
@ -248,7 +248,7 @@ section.comments {
|
||||
flex-direction: column;
|
||||
gap: 2ch;
|
||||
|
||||
> form {
|
||||
div > form {
|
||||
display: grid;
|
||||
grid-template-rows: 12ch 20px;
|
||||
grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr));
|
||||
@ -256,7 +256,7 @@ section.comments {
|
||||
> textarea {
|
||||
resize: none;
|
||||
grid-row: 1;
|
||||
grid-column: 1 / 4;
|
||||
grid-column: 1 / 5;
|
||||
}
|
||||
|
||||
> #name {
|
||||
@ -271,6 +271,10 @@ section.comments {
|
||||
grid-row: 2
|
||||
}
|
||||
|
||||
> #commit {
|
||||
grid-row: 2
|
||||
}
|
||||
|
||||
> * {
|
||||
border-radius: 0;
|
||||
background: var(--alt-bg);
|
||||
|
@ -2,11 +2,16 @@
|
||||
|
||||
(defn comments [route]
|
||||
`(section (:class comments)
|
||||
(h2 comments)
|
||||
(form (:id comment :method post :action ~f"/comment?route={route}" :autocomplete off)
|
||||
(textarea (:id comment :name comment :placeholder comment :required True :maxlength 2048))
|
||||
(input (:id name :type text :name name :placeholder username :required True :maxlength 32))
|
||||
(input (:id website :type text :name site :placeholder "website (not required)" :maxlength 256))
|
||||
(input (:id submit :type submit :value post)))
|
||||
(div
|
||||
(h2 comments)
|
||||
(p "as an anti-bot measure, in order for $VIEWER's comment to be stored on the server, $VIEWER" (span (:style "font-weight: bold") " MUST ")
|
||||
"enter the commit hash of the current deployment found in the bottom right of the page footer. failure to do so will result in the comment being disregarded.")
|
||||
|
||||
(form (:id comment :method post :action ~f"/comment?route={route}" :autocomplete off)
|
||||
(textarea (:id comment :name comment :placeholder comment :required True :maxlength 2048))
|
||||
(input (:id name :type text :name name :placeholder username :required True :maxlength 32))
|
||||
(input (:id website :type text :name site :placeholder "website (not required)" :maxlength 256))
|
||||
(input (:id commit :type text :name commit :placeholder "commit" :maxlength 8))
|
||||
(input (:id submit :type submit :value post))))
|
||||
|
||||
(~f"$[ls -r ./www/data/comments/{(quote-plus route :safe "")} | xargs -I# cat ./www/data/comments/{(quote-plus route :safe "")}/#]")))
|
||||
|
@ -18,4 +18,5 @@
|
||||
(div (:style "flex-direction: row; width: 14ch; gap: 2ch; margin-right: 5px;")
|
||||
(a (:href "https://stellophiliac.github.io/roboring/0x6e6174/previous") "<-")
|
||||
(a (:href "https://stellophiliac.github.io/roboring") "roboring")
|
||||
(a (:href "https://stellophiliac.github.io/roboring/0x6e6174/next") "->"))))))
|
||||
(a (:href "https://stellophiliac.github.io/roboring/0x6e6174/next") "->"))))
|
||||
(span ~(run "git log -1 --format=%h"))))
|
||||
|
Reference in New Issue
Block a user