From b76c70aec392e8423fde6a29fb5b2a7a9f6a045f Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 6 May 2025 20:30:33 +0200 Subject: Rename pug files to match access url. --- server.js | 60 ++++++++++++++-------------- views/account_change_about.pug | 27 +++++++++++++ views/account_change_mail.pug | 26 ++++++++++++ views/account_change_name.pug | 26 ++++++++++++ views/account_change_password.pug | 26 ++++++++++++ views/account_delete.pug | 28 +++++++++++++ views/account_forgot_password.pug | 25 ++++++++++++ views/account_reset_password.pug | 31 +++++++++++++++ views/account_webhook.pug | 68 ++++++++++++++++++++++++++++++++ views/change_about.pug | 27 ------------- views/change_mail.pug | 26 ------------ views/change_name.pug | 26 ------------ views/change_password.pug | 26 ------------ views/contacts_search.pug | 31 +++++++++++++++ views/create-index.pug | 16 -------- views/create.pug | 83 --------------------------------------- views/create_index.pug | 16 ++++++++ views/create_title.pug | 83 +++++++++++++++++++++++++++++++++++++++ views/delete_account.pug | 28 ------------- views/forgot_password.pug | 25 ------------ views/info.pug | 41 ------------------- views/profile.pug | 4 ++ views/reset_password.pug | 31 --------------- views/search_user.pug | 31 --------------- views/stats_title.pug | 2 +- views/title.pug | 41 +++++++++++++++++++ views/webhook.pug | 68 -------------------------------- 27 files changed, 464 insertions(+), 458 deletions(-) create mode 100644 views/account_change_about.pug create mode 100644 views/account_change_mail.pug create mode 100644 views/account_change_name.pug create mode 100644 views/account_change_password.pug create mode 100644 views/account_delete.pug create mode 100644 views/account_forgot_password.pug create mode 100644 views/account_reset_password.pug create mode 100644 views/account_webhook.pug delete mode 100644 views/change_about.pug delete mode 100644 views/change_mail.pug delete mode 100644 views/change_name.pug delete mode 100644 views/change_password.pug create mode 100644 views/contacts_search.pug delete mode 100644 views/create-index.pug delete mode 100644 views/create.pug create mode 100644 views/create_index.pug create mode 100644 views/create_title.pug delete mode 100644 views/delete_account.pug delete mode 100644 views/forgot_password.pug delete mode 100644 views/info.pug delete mode 100644 views/reset_password.pug delete mode 100644 views/search_user.pug create mode 100644 views/title.pug delete mode 100644 views/webhook.pug diff --git a/server.js b/server.js index cfaced7..9ba77f2 100644 --- a/server.js +++ b/server.js @@ -139,9 +139,11 @@ if (process.env.MAIL_HOST && process.env.MAIL_PORT && process.env.MAIL_FROM) { console.log("Mail notifications enabled: ", mailer.options) } else { console.log("Mail notifications disabled.") - mailer = { - sendMail(mail) { - console.log("MAIL (DEBUG):", mail) + if (DEBUG) { + mailer = { + sendMail(mail) { + console.log("MAIL (DEBUG):", mail) + } } } } @@ -541,7 +543,7 @@ app.get("/", function (req, res) { }) app.get("/create", function (req, res) { - res.render("create-index.pug") + res.render("create_index.pug") }) app.get("/about", function (req, res) { @@ -639,7 +641,7 @@ app.post("/account/mail/verify", must_be_logged_in, function (req, res) { app.get("/account/forgot-password", function (req, res) { if (req.user) return res.redirect("/") - res.render("forgot_password.pug") + res.render("account_forgot_password.pug") }) app.post("/account/forgot-password", must_pass_altcha, function (req, res) { @@ -650,7 +652,7 @@ app.post("/account/forgot-password", must_pass_altcha, function (req, res) { mail_password_reset_token(user, token) return res.redirect("/account/reset-password?mail=" + mail) } - res.render("forgot_password.pug", { flash: "User not found." }) + res.render("account_forgot_password.pug", { flash: "User not found." }) }) app.get("/account/reset-password", function (req, res) { @@ -658,7 +660,7 @@ app.get("/account/reset-password", function (req, res) { return res.redirect("/") var mail = req.query.mail var token = req.query.token - res.render("reset_password.pug", { mail, token }) + res.render("account_reset_password.pug", { mail, token }) }) app.post("/account/reset-password", must_pass_altcha, function (req, res) { @@ -666,7 +668,7 @@ app.post("/account/reset-password", must_pass_altcha, function (req, res) { let token = req.body.token let password = req.body.password function err(msg) { - res.render("reset_password.pug", { mail: mail, token: token, flash: msg }) + res.render("account_reset_password.pug", { mail: mail, token: token, flash: msg }) } let user = SQL_SELECT_LOGIN_BY_MAIL.get(mail) if (!user) @@ -684,7 +686,7 @@ app.post("/account/reset-password", must_pass_altcha, function (req, res) { }) app.get("/account/change-password", must_be_logged_in, function (req, res) { - res.render("change_password.pug") + res.render("account_change_password.pug") }) app.post("/account/change-password", must_be_logged_in, function (req, res) { @@ -693,9 +695,9 @@ app.post("/account/change-password", must_be_logged_in, function (req, res) { // Get full user record including password and salt let user = SQL_SELECT_LOGIN.get(req.user.user_id) if (!is_valid_password(newpass)) - return res.render("change_password.pug", { flash: "New password is invalid!" }) + return res.render("account_change_password.pug", { flash: "New password is invalid!" }) if (!verify_password(req.user, oldpass)) - return res.render("change_password.pug", { flash: "Wrong password!" }) + return res.render("account_change_password.pug", { flash: "Wrong password!" }) let salt = crypto.randomBytes(32).toString("hex") let hash = hash_password(newpass, salt) SQL_UPDATE_USER_PASSWORD.run(user.user_id, hash, salt) @@ -717,7 +719,7 @@ function may_delete_account(user_id) { app.get("/account/delete", must_be_logged_in, function (req, res) { if (!may_delete_account(req.user.user_id)) return res.status(401).send("You may not delete your account while you have unfinished games.") - res.render("delete_account.pug") + res.render("account_delete.pug") }) const SQL_SELECT_GAME_ROLE_FOR_DELETED_USER = SQL(` @@ -733,7 +735,7 @@ app.post("/account/delete", must_be_logged_in, function (req, res) { let user = SQL_SELECT_LOGIN.get(req.user.user_id) let hash = hash_password(password, user.salt) if (hash !== user.password) - return res.render("delete_account.pug", { flash: "Wrong password!" }) + return res.render("account_delete.pug", { flash: "Wrong password!" }) let list = SQL_SELECT_GAME_ROLE_FOR_DELETED_USER.all(req.user.user_id) for (let item of list) @@ -771,12 +773,12 @@ app.get("/account/mail/unsubscribe", must_be_logged_in, function (req, res) { app.get("/account/webhook", must_be_logged_in, function (req, res) { let webhook = SQL_SELECT_WEBHOOK.get(req.user.user_id) - res.render("webhook.pug", { webhook: webhook }) + res.render("account_webhook.pug", { webhook: webhook }) }) app.post("/account/webhook/delete", must_be_logged_in, function (req, res) { SQL_DELETE_WEBHOOK.run(req.user.user_id) - res.redirect("/webhook") + res.redirect("/account/webhook") }) app.post("/account/webhook/update", must_be_logged_in, function (req, res) { @@ -787,38 +789,38 @@ app.post("/account/webhook/update", must_be_logged_in, function (req, res) { const webhook = SQL_SELECT_WEBHOOK_SEND.get(req.user.user_id) if (webhook) send_webhook(req.user.user_id, webhook, "Test message!", 0) - res.setHeader("refresh", "3; url=/webhook") + res.setHeader("refresh", "3; url=/account/webhook") res.send("Testing Webhook. Please wait...") }) app.get("/account/change-name", must_be_logged_in, function (req, res) { - res.render("change_name.pug") + res.render("account_change_name.pug") }) app.post("/account/change-name", must_be_logged_in, function (req, res) { let newname = clean_user_name(req.body.newname) if (!is_valid_user_name(newname)) - return res.render("change_name.pug", { flash: "Invalid user name!" }) + return res.render("account_change_name.pug", { flash: "Invalid user name!" }) if (SQL_EXISTS_USER_NAME.get(newname)) - return res.render("change_name.pug", { flash: "That name is already taken!" }) + return res.render("account_change_name.pug", { flash: "That name is already taken!" }) if (!verify_password(req.user, req.body.password)) - return res.render("change_name.pug", { flash: "Wrong password!" }) + return res.render("account_change_name.pug", { flash: "Wrong password!" }) SQL_UPDATE_USER_NAME.run(newname, req.user.user_id) return res.redirect("/profile") }) app.get("/account/change-mail", must_be_logged_in, function (req, res) { - res.render("change_mail.pug") + res.render("account_change_mail.pug") }) app.post("/account/change-mail", must_be_logged_in, function (req, res) { let newmail = req.body.newmail if (!is_valid_email(newmail) || is_forbidden_mail(newmail)) - return res.render("change_mail.pug", { flash: "Invalid mail address!" }) + return res.render("account_change_mail.pug", { flash: "Invalid mail address!" }) if (SQL_EXISTS_USER_MAIL.get(newmail)) - return res.render("change_mail.pug", { flash: "That mail address is already taken!" }) + return res.render("account_change_mail.pug", { flash: "That mail address is already taken!" }) if (!verify_password(req.user, req.body.password)) - return res.render("change_mail.pug", { flash: "Wrong password!" }) + return res.render("account_change_mail.pug", { flash: "Wrong password!" }) SQL_UPDATE_USER_MAIL.run(newmail, req.user.user_id) SQL_UPDATE_USER_VERIFIED.run(0, req.user.user_id) SQL_UPDATE_USER_NOTIFY.run(0, req.user.user_id) @@ -827,7 +829,7 @@ app.post("/account/change-mail", must_be_logged_in, function (req, res) { app.get("/account/change-about", must_be_logged_in, function (req, res) { let about = SQL_SELECT_USER_ABOUT.get(req.user.user_id) - res.render("change_about.pug", { about }) + res.render("account_change_about.pug", { about }) }) app.post("/account/change-about", must_be_logged_in, function (req, res) { @@ -909,13 +911,13 @@ app.get("/contacts/search", must_be_logged_in, function (req, res) { if (!q.includes("%")) q = "%" + q + "%" let results = SQL_SELECT_USER_BY_SEARCH.all(q) - res.render("search_user.pug", { + res.render("contacts_search.pug", { user: req.user, search: req.query.q, results }) } else { - res.render("search_user.pug", { + res.render("contacts_search.pug", { user: req.user, search: null, results: null, @@ -1823,7 +1825,7 @@ function get_title_page(req, res, title_id) { let active_pools = TM_POOL_LIST_TITLE_ACTIVE.all(title_id) let finished_pools = TM_POOL_LIST_TITLE_FINISHED.all(title_id) - res.render("info.pug", { + res.render("title.pug", { user: req.user, title: title, open_games, @@ -1844,7 +1846,7 @@ app.get("/create/:title_id", function (req, res) { let title = TITLE_TABLE[title_id] if (!title) return res.status(404).send("Invalid title.") - res.render("create.pug", { + res.render("create_title.pug", { user: req.user, title: title, limit: req.user ? check_create_game_limit(req.user) : null, diff --git a/views/account_change_about.pug b/views/account_change_about.pug new file mode 100644 index 0000000..7a0531e --- /dev/null +++ b/views/account_change_about.pug @@ -0,0 +1,27 @@ +//- vim:ts=4:sw=4: +doctype html +html + head + include head + title Change profile text + style. + input, textarea { width: min(45rem,100%) } + body + include header + article + h1 Change profile text + form(method="post") + p Name: #{user.name} + p Mail: #{user.mail} + p + textarea( + name="about" + rows=20 + cols=80 + maxlength=32000 + autofocus + ) + | + | #{about} + p + button(type="submit") Submit diff --git a/views/account_change_mail.pug b/views/account_change_mail.pug new file mode 100644 index 0000000..4d0605a --- /dev/null +++ b/views/account_change_mail.pug @@ -0,0 +1,26 @@ +//- vim:ts=4:sw=4: +doctype html +html + head + include head + title Change mail address + body + include header + article + h1 Change mail address + if flash + p.error= flash + + form(method="post") + p Name: #{user.name} + p Mail: #{user.mail} + p + label New mail address: + br + input(type="text" name="newmail" required) + p + label Password: + br + input(type="password" name="password" required) + p + button(type="submit") Change mail diff --git a/views/account_change_name.pug b/views/account_change_name.pug new file mode 100644 index 0000000..b1845ab --- /dev/null +++ b/views/account_change_name.pug @@ -0,0 +1,26 @@ +//- vim:ts=4:sw=4: +doctype html +html + head + include head + title Change name + body + include header + article + h1 Change name + if flash + p.error= flash + + form(method="post") + p Name: #{user.name} + p Mail: #{user.mail} + p + label New name: + br + input(type="text" name="newname" required) + p + label Password: + br + input(type="password" name="password" required) + p + button(type="submit") Change name diff --git a/views/account_change_password.pug b/views/account_change_password.pug new file mode 100644 index 0000000..ca8e973 --- /dev/null +++ b/views/account_change_password.pug @@ -0,0 +1,26 @@ +//- vim:ts=4:sw=4: +doctype html +html + head + include head + title Change password + body + include header + article + h1 Change password + if flash + p.error= flash + + form(method="post") + p Name: #{user.name} + p Mail: #{user.mail} + p + label Old Password: + br + input(type="password" name="password" required) + p + label New Password: + br + input(type="password" name="newpass" required) + p + button(type="submit") Change password diff --git a/views/account_delete.pug b/views/account_delete.pug new file mode 100644 index 0000000..54c3bc4 --- /dev/null +++ b/views/account_delete.pug @@ -0,0 +1,28 @@ +//- vim:ts=4:sw=4: +doctype html +html + head + include head + title Delete account + body + include header + article + h1 Delete account + if flash + p.error= flash + + form(method="post") + p Name: #{user.name} + p Mail: #{user.mail} + p + label Password: + br + input(type="password" name="password" required) + p + label Type DELETE to confirm: + br + input(type="text" name="confirm" pattern="^DELETE$" required) + p.warning WARNING: Deleting your account is permanent! + p All your games and messages will be lost forever. + p + button(type="submit") Delete! diff --git a/views/account_forgot_password.pug b/views/account_forgot_password.pug new file mode 100644 index 0000000..0913857 --- /dev/null +++ b/views/account_forgot_password.pug @@ -0,0 +1,25 @@ +//- vim:ts=4:sw=4: +doctype html +html + head + include head + title Forgot password + +altcha_script() + body + include header + article + h1 Forgot password + if flash + p.error= flash + + if user + p You're already logged in! + else + form(method="post") + p + label Mail: + br + input(type="email" name="mail" required) + +altcha_widget() + p + button(type="submit") Forgot password diff --git a/views/account_reset_password.pug b/views/account_reset_password.pug new file mode 100644 index 0000000..8707ebc --- /dev/null +++ b/views/account_reset_password.pug @@ -0,0 +1,31 @@ +//- vim:ts=4:sw=4: +doctype html +html + head + include head + title Reset password + body + include header + article + h1 Reset password + if flash + p.error= flash + + p You should have received a password reset token in your mail. + + form(method="post") + p + label Mail: + br + input(type="email" name="mail" size=32 value=mail required) + p + label New Password: + br + input(type="password" name="password" size=32 required) + p + label Token: + br + input(type="text" name="token" size=32 value=token style="font-family:monospace" required) + +altcha_widget() + p + button(type="submit") Reset password diff --git a/views/account_webhook.pug b/views/account_webhook.pug new file mode 100644 index 0000000..b9817ef --- /dev/null +++ b/views/account_webhook.pug @@ -0,0 +1,68 @@ +//- vim:ts=4:sw=4: +doctype html +html(lang="en") + head + include head + title Webhook + body + include header + article + + h1 Webhook + + - var url = webhook && webhook.url || "" + - var format = webhook && webhook.format || "" + - var prefix = webhook && webhook.prefix || "" + + form(action="/account/webhook/update" method="post") + if webhook && webhook.error + p.error ERROR: #{webhook.error} + p Webhook URL: + br + input#url(type="text" name="url" size=120 placeholder="https://discord.com/api/webhooks/..." value=url required) + p Webhook format: + br + input#format(type="text" name="format" size=40 placeholder="content" value=format) + + p Message prefix: + br + input#prefix(type="text" name="prefix" size=40 placeholder="<@123456789>" value=prefix) + + if webhook + button(type="submit") Update + else + button(type="submit") Create + + if webhook + form(action="/account/webhook/delete" method="post") + button(type="submit") Delete + + h2 Discord Notifications + + p You can send notifications to a given channel on a Discord server. + + ol + li Create your own server or use an existing server where you have administrator privileges. + li Get the webhook URL for the Discord channel and enter it into the Webhook URL field. + li Enter "content" into the Webhook format field. + li Find your Discord User ID. This is not your username, it is a number. + li Enter your Discord User ID into the Message prefix field as "<@12345>". + + h2 Slack Notifications + + p You can send notifications to a Slack workspace. + + ol + li Join or set up a Slack workspace with a webhook integration. + li Find the Webhook URL and enter it into the Webhook URL field. + li Enter "text" into the Webhook format field. + li Find your Slack User ID. This is a number with "U" in front of it. + li Enter your Slack User ID into the Message prefix field as "<@U12345>". + + h2 Custom Notifications + + p. + You can integrate with any server that accepts inbound webhooks by setting the webhook URL to the appropriate endpoint. + If the format field is blank, the payload is sent as plain text. + Otherwise, the payload is a JSON object where the format field specifies which JSON property holds the message. + Use "content" for Discord and "text" for Slack. diff --git a/views/change_about.pug b/views/change_about.pug deleted file mode 100644 index 7a0531e..0000000 --- a/views/change_about.pug +++ /dev/null @@ -1,27 +0,0 @@ -//- vim:ts=4:sw=4: -doctype html -html - head - include head - title Change profile text - style. - input, textarea { width: min(45rem,100%) } - body - include header - article - h1 Change profile text - form(method="post") - p Name: #{user.name} - p Mail: #{user.mail} - p - textarea( - name="about" - rows=20 - cols=80 - maxlength=32000 - autofocus - ) - | - | #{about} - p - button(type="submit") Submit diff --git a/views/change_mail.pug b/views/change_mail.pug deleted file mode 100644 index 4d0605a..0000000 --- a/views/change_mail.pug +++ /dev/null @@ -1,26 +0,0 @@ -//- vim:ts=4:sw=4: -doctype html -html - head - include head - title Change mail address - body - include header - article - h1 Change mail address - if flash - p.error= flash - - form(method="post") - p Name: #{user.name} - p Mail: #{user.mail} - p - label New mail address: - br - input(type="text" name="newmail" required) - p - label Password: - br - input(type="password" name="password" required) - p - button(type="submit") Change mail diff --git a/views/change_name.pug b/views/change_name.pug deleted file mode 100644 index b1845ab..0000000 --- a/views/change_name.pug +++ /dev/null @@ -1,26 +0,0 @@ -//- vim:ts=4:sw=4: -doctype html -html - head - include head - title Change name - body - include header - article - h1 Change name - if flash - p.error= flash - - form(method="post") - p Name: #{user.name} - p Mail: #{user.mail} - p - label New name: - br - input(type="text" name="newname" required) - p - label Password: - br - input(type="password" name="password" required) - p - button(type="submit") Change name diff --git a/views/change_password.pug b/views/change_password.pug deleted file mode 100644 index ca8e973..0000000 --- a/views/change_password.pug +++ /dev/null @@ -1,26 +0,0 @@ -//- vim:ts=4:sw=4: -doctype html -html - head - include head - title Change password - body - include header - article - h1 Change password - if flash - p.error= flash - - form(method="post") - p Name: #{user.name} - p Mail: #{user.mail} - p - label Old Password: - br - input(type="password" name="password" required) - p - label New Password: - br - input(type="password" name="newpass" required) - p - button(type="submit") Change password diff --git a/views/contacts_search.pug b/views/contacts_search.pug new file mode 100644 index 0000000..308cc41 --- /dev/null +++ b/views/contacts_search.pug @@ -0,0 +1,31 @@ +//- vim:ts=4:sw=4: +doctype html +html + head + include head + title User Search Results + body + include header + article + + h1 User Search Results + + if results && search + if results.length > 0 + table.half.striped + thead + tr + th Name + th Last seen + tbody + each who in results + tr + td + a.black(href="/user/"+who.name)= who.name + td.w= human_date(who.atime) + else + p.error Nobody found matching "#{search}". + + p + form(method="get" action="/contacts/search") + input(type="text" name="q" size=40 placeholder="Find user..." value=search required) diff --git a/views/create-index.pug b/views/create-index.pug deleted file mode 100644 index c508be7..0000000 --- a/views/create-index.pug +++ /dev/null @@ -1,16 +0,0 @@ -//- vim:ts=4:sw=4: -doctype html -html - head - include head - title Create game - body - include header - article - h1 Create a new game - - ul - each title in TITLE_LIST - unless title.is_hidden - li - a(href="/create/"+title.title_id)= title.title_name diff --git a/views/create.pug b/views/create.pug deleted file mode 100644 index c4c5c2a..0000000 --- a/views/create.pug +++ /dev/null @@ -1,83 +0,0 @@ -//- vim:ts=4:sw=4: -doctype html -html - head - include head - title= title.title_name - body - include header - article - - h1= title.title_name - - div.logo - +gamecover(title.title_id) - - if limit - p.error= limit - if !user - p.error You are not logged in! - - form(method="post" action="/create/"+title.title_id) - if Array.isArray(rules.scenarios) - if rules.scenarios.length > 1 - p Scenario: - br - select(name="scenario") - each scenario in rules.scenarios - if scenario === rules.default_scenario - option(value=scenario selected)= scenario - else - option(value=scenario)= scenario - else - input(type="hidden" name="scenario" value=rules.scenarios[0]) - else - p Scenario: - br - select(name="scenario") - each list, name in rules.scenarios - if name === "" - each scenario in list - if scenario === rules.default_scenario - option(value=scenario selected)= scenario - else - option(value=scenario)= scenario - else - optgroup(label=name) - each scenario in list - if scenario === rules.default_scenario - option(value=scenario selected)= scenario - else - option(value=scenario)= scenario - - | !{ title.create_html } - - if user - p Notice: - br - input(type="text" autocomplete="off" name="notice" size=45 placeholder="What are you looking for?") - - p Pace: - each text, pace in PACE_TEXT - br - label - input(type="radio" name="pace" value=pace checked=pace===0) - | #{PACE_ICON[pace]} #{text} - - p - label - input(type="checkbox" name="is_random" value="true") - | Random player roles - - p - label - input(type="checkbox" name="is_private" value="true") - | Private - - if !limit - p - button(type="submit") Create - - else - p Login or sign up to play. - diff --git a/views/create_index.pug b/views/create_index.pug new file mode 100644 index 0000000..c508be7 --- /dev/null +++ b/views/create_index.pug @@ -0,0 +1,16 @@ +//- vim:ts=4:sw=4: +doctype html +html + head + include head + title Create game + body + include header + article + h1 Create a new game + + ul + each title in TITLE_LIST + unless title.is_hidden + li + a(href="/create/"+title.title_id)= title.title_name diff --git a/views/create_title.pug b/views/create_title.pug new file mode 100644 index 0000000..c4c5c2a --- /dev/null +++ b/views/create_title.pug @@ -0,0 +1,83 @@ +//- vim:ts=4:sw=4: +doctype html +html + head + include head + title= title.title_name + body + include header + article + + h1= title.title_name + + div.logo + +gamecover(title.title_id) + + if limit + p.error= limit + if !user + p.error You are not logged in! + + form(method="post" action="/create/"+title.title_id) + if Array.isArray(rules.scenarios) + if rules.scenarios.length > 1 + p Scenario: + br + select(name="scenario") + each scenario in rules.scenarios + if scenario === rules.default_scenario + option(value=scenario selected)= scenario + else + option(value=scenario)= scenario + else + input(type="hidden" name="scenario" value=rules.scenarios[0]) + else + p Scenario: + br + select(name="scenario") + each list, name in rules.scenarios + if name === "" + each scenario in list + if scenario === rules.default_scenario + option(value=scenario selected)= scenario + else + option(value=scenario)= scenario + else + optgroup(label=name) + each scenario in list + if scenario === rules.default_scenario + option(value=scenario selected)= scenario + else + option(value=scenario)= scenario + + | !{ title.create_html } + + if user + p Notice: + br + input(type="text" autocomplete="off" name="notice" size=45 placeholder="What are you looking for?") + + p Pace: + each text, pace in PACE_TEXT + br + label + input(type="radio" name="pace" value=pace checked=pace===0) + | #{PACE_ICON[pace]} #{text} + + p + label + input(type="checkbox" name="is_random" value="true") + | Random player roles + + p + label + input(type="checkbox" name="is_private" value="true") + | Private + + if !limit + p + button(type="submit") Create + + else + p Login or sign up to play. + diff --git a/views/delete_account.pug b/views/delete_account.pug deleted file mode 100644 index 54c3bc4..0000000 --- a/views/delete_account.pug +++ /dev/null @@ -1,28 +0,0 @@ -//- vim:ts=4:sw=4: -doctype html -html - head - include head - title Delete account - body - include header - article - h1 Delete account - if flash - p.error= flash - - form(method="post") - p Name: #{user.name} - p Mail: #{user.mail} - p - label Password: - br - input(type="password" name="password" required) - p - label Type DELETE to confirm: - br - input(type="text" name="confirm" pattern="^DELETE$" required) - p.warning WARNING: Deleting your account is permanent! - p All your games and messages will be lost forever. - p - button(type="submit") Delete! diff --git a/views/forgot_password.pug b/views/forgot_password.pug deleted file mode 100644 index 0913857..0000000 --- a/views/forgot_password.pug +++ /dev/null @@ -1,25 +0,0 @@ -//- vim:ts=4:sw=4: -doctype html -html - head - include head - title Forgot password - +altcha_script() - body - include header - article - h1 Forgot password - if flash - p.error= flash - - if user - p You're already logged in! - else - form(method="post") - p - label Mail: - br - input(type="email" name="mail" required) - +altcha_widget() - p - button(type="submit") Forgot password diff --git a/views/info.pug b/views/info.pug deleted file mode 100644 index 32837e9..0000000 --- a/views/info.pug +++ /dev/null @@ -1,41 +0,0 @@ -//- vim:ts=4:sw=4: -doctype html -html - head - include head - +social(title.title_name, "Play " + title.title_name + " on the web.", title.title_id) - title= title.title_name - body - include header - article - h1= title.title_name - - div.logo - +gamecover(title.title_id) - - | !{ title.about_html } - - p Read more about the game on #[a(href="https://boardgamegeek.com/boardgame/"+title.bgg) boardgamegeek.com]. - - h2 Open - if open_games.length > 0 - +gamelist(open_games, true) - else - p No open games right now. - - p - a(href="/create/"+title.title_id) Create a new game - - if replacement_games.length > 0 - h2 Open (missing players) - +gamelist(replacement_games, true) - - +tourlist(seeds, active_pools, finished_pools) - - if active_games.length > 0 - h2 Recently active - +gamelist(active_games, true) - - if finished_games.length > 0 - h2 Recently finished - +gamelist(finished_games, true) diff --git a/views/profile.pug b/views/profile.pug index 2f9218d..0542a64 100644 --- a/views/profile.pug +++ b/views/profile.pug @@ -31,6 +31,8 @@ html p Enable mail notifications if mail.notify p Disable mail notifications + else + p.error Mail notifications are disabled on this server. if ENABLE_WEBHOOKS if !webhook @@ -43,6 +45,8 @@ html dl dt Configure webhook dd= new URL(webhook.url).hostname + else + p.error Webhook notifications are disabled on this server. h3 Account diff --git a/views/reset_password.pug b/views/reset_password.pug deleted file mode 100644 index 8707ebc..0000000 --- a/views/reset_password.pug +++ /dev/null @@ -1,31 +0,0 @@ -//- vim:ts=4:sw=4: -doctype html -html - head - include head - title Reset password - body - include header - article - h1 Reset password - if flash - p.error= flash - - p You should have received a password reset token in your mail. - - form(method="post") - p - label Mail: - br - input(type="email" name="mail" size=32 value=mail required) - p - label New Password: - br - input(type="password" name="password" size=32 required) - p - label Token: - br - input(type="text" name="token" size=32 value=token style="font-family:monospace" required) - +altcha_widget() - p - button(type="submit") Reset password diff --git a/views/search_user.pug b/views/search_user.pug deleted file mode 100644 index 308cc41..0000000 --- a/views/search_user.pug +++ /dev/null @@ -1,31 +0,0 @@ -//- vim:ts=4:sw=4: -doctype html -html - head - include head - title User Search Results - body - include header - article - - h1 User Search Results - - if results && search - if results.length > 0 - table.half.striped - thead - tr - th Name - th Last seen - tbody - each who in results - tr - td - a.black(href="/user/"+who.name)= who.name - td.w= human_date(who.atime) - else - p.error Nobody found matching "#{search}". - - p - form(method="get" action="/contacts/search") - input(type="text" name="q" size=40 placeholder="Find user..." value=search required) diff --git a/views/stats_title.pug b/views/stats_title.pug index 2107b93..aed6e63 100644 --- a/views/stats_title.pug +++ b/views/stats_title.pug @@ -19,7 +19,7 @@ html tbody each row in ratings tr - td #{row.name} + td #{row.name} td.r= row.rating td.r= row.count td.r= row.last diff --git a/views/title.pug b/views/title.pug new file mode 100644 index 0000000..32837e9 --- /dev/null +++ b/views/title.pug @@ -0,0 +1,41 @@ +//- vim:ts=4:sw=4: +doctype html +html + head + include head + +social(title.title_name, "Play " + title.title_name + " on the web.", title.title_id) + title= title.title_name + body + include header + article + h1= title.title_name + + div.logo + +gamecover(title.title_id) + + | !{ title.about_html } + + p Read more about the game on #[a(href="https://boardgamegeek.com/boardgame/"+title.bgg) boardgamegeek.com]. + + h2 Open + if open_games.length > 0 + +gamelist(open_games, true) + else + p No open games right now. + + p + a(href="/create/"+title.title_id) Create a new game + + if replacement_games.length > 0 + h2 Open (missing players) + +gamelist(replacement_games, true) + + +tourlist(seeds, active_pools, finished_pools) + + if active_games.length > 0 + h2 Recently active + +gamelist(active_games, true) + + if finished_games.length > 0 + h2 Recently finished + +gamelist(finished_games, true) diff --git a/views/webhook.pug b/views/webhook.pug deleted file mode 100644 index b9817ef..0000000 --- a/views/webhook.pug +++ /dev/null @@ -1,68 +0,0 @@ -//- vim:ts=4:sw=4: -doctype html -html(lang="en") - head - include head - title Webhook - body - include header - article - - h1 Webhook - - - var url = webhook && webhook.url || "" - - var format = webhook && webhook.format || "" - - var prefix = webhook && webhook.prefix || "" - - form(action="/account/webhook/update" method="post") - if webhook && webhook.error - p.error ERROR: #{webhook.error} - p Webhook URL: - br - input#url(type="text" name="url" size=120 placeholder="https://discord.com/api/webhooks/..." value=url required) - p Webhook format: - br - input#format(type="text" name="format" size=40 placeholder="content" value=format) - - p Message prefix: - br - input#prefix(type="text" name="prefix" size=40 placeholder="<@123456789>" value=prefix) - - if webhook - button(type="submit") Update - else - button(type="submit") Create - - if webhook - form(action="/account/webhook/delete" method="post") - button(type="submit") Delete - - h2 Discord Notifications - - p You can send notifications to a given channel on a Discord server. - - ol - li Create your own server or use an existing server where you have administrator privileges. - li Get the webhook URL for the Discord channel and enter it into the Webhook URL field. - li Enter "content" into the Webhook format field. - li Find your Discord User ID. This is not your username, it is a number. - li Enter your Discord User ID into the Message prefix field as "<@12345>". - - h2 Slack Notifications - - p You can send notifications to a Slack workspace. - - ol - li Join or set up a Slack workspace with a webhook integration. - li Find the Webhook URL and enter it into the Webhook URL field. - li Enter "text" into the Webhook format field. - li Find your Slack User ID. This is a number with "U" in front of it. - li Enter your Slack User ID into the Message prefix field as "<@U12345>". - - h2 Custom Notifications - - p. - You can integrate with any server that accepts inbound webhooks by setting the webhook URL to the appropriate endpoint. - If the format field is blank, the payload is sent as plain text. - Otherwise, the payload is a JSON object where the format field specifies which JSON property holds the message. - Use "content" for Discord and "text" for Slack. -- cgit v1.2.3