site-key form made resulable

This commit is contained in:
realaravinth 2021-05-01 14:41:22 +05:30
parent 7058af84d6
commit 90424219f5
No known key found for this signature in database
GPG key ID: AD9F0F08E855ED88
57 changed files with 1015 additions and 175 deletions

3
.gitignore vendored
View file

@ -5,4 +5,5 @@ tarpaulin-report.html
cobertura.xml cobertura.xml
prod/ prod/
node_modules/ node_modules/
static/bundle static-assets/bundle
static

View file

@ -2,7 +2,7 @@
default: build-frontend default: build-frontend
cargo build cargo build
run: build-frontend run: build-frontend-dev
cargo run cargo run
dev-env: dev-env:

View file

@ -1 +1 @@
{"map":{"./static-assets/img/svg/filter.svg":"./static/img/svg/filter.6D5FBD96BA2E2020663AAC4994A991295917D73F3592C07EE103647B655A2275.svg","./static-assets/img/svg/home.svg":"./static/img/svg/home.28C26C2D3E4013D24D755A589A80D8DD5C49DA5397032E3F09B76BC3A2C314ED.svg","./static-assets/img/svg/shield.svg":"./static/img/svg/shield.13AFE15DCB4882B4A940CFDC3E2088A733CD4E6F97F25B211D87C7C9D6DBA2B6.svg","./static-assets/img/svg/eye.svg":"./static/img/svg/eye.9DE4D24D3C9B055D02B94A8AD65E8C0C644852381FDD131A64448B6DA7859167.svg","./static-assets/img/svg/settings.svg":"./static/img/svg/settings.910C6241743C9C694141971BE8E1C4016A1A5BF203E4E9D676D4CE93BD518F4C.svg","./static-assets/img/svg/message-square.svg":"./static/img/svg/message-square.E246A6B2AAEFCE8A62B9BDD2D155D3B4923C3E48325EAEF099D509A2D7BB4DD1.svg","./static-assets/img/svg/eye-off.svg":"./static/img/svg/eye-off.939360B335D1D35B57C3E2070129D14ABB168E4AC137B5BE4F6F8BD450B712F5.svg","./static-assets/img/svg/toggle-left.svg":"./static/img/svg/toggle-left.E421950C5922E84015F0A86F272AE5637A2ED96E267D2C962543F5994E5D1172.svg","./static-assets/img/svg/user.svg":"./static/img/svg/user.B164ECD2C4A09DC5189F1F252487E2AC6A33646BEA67AF9C528CDA61FE5E146F.svg","./static-assets/img/svg/globe.svg":"./static/img/svg/globe.44C2A069EBD637663E938ECE7B8E4EC2A8BDE049A8A044EC68D9CB69AE8C592E.svg","./static-assets/img/svg/shield-off.svg":"./static/img/svg/shield-off.85394A6AD92D550F8EBA72AAB095E078E7A0E3359DF81174532C8D1AF53B5876.svg","./static-assets/img/svg/tag.svg":"./static/img/svg/tag.E0BC111B8E81BBFC62B6A9E7E4AC162B7085A6543D995B7A0030CB7632901BD4.svg","./static-assets/img/svg/moon.svg":"./static/img/svg/moon.1E151D68949CA3B2DC7DE34BC25B7586E4175AC3BA7F56DDBB34227334EF7155.svg","./static-assets/img/svg/key.svg":"./static/img/svg/key.F0AACBED8D0F7A279977392F92F4DA73C35E905AC73B3C83320D54856E627EEC.svg","./static-assets/img/svg/credit-card.svg":"./static/img/svg/credit-card.DF612AFE367A7B31410F2F6CD3C7B515B0F1889C0107EA695D840DFFA492E07D.svg","./static-assets/img/svg/log-out.svg":"./static/img/svg/log-out.92AB4384FD41D9AFE4735C480361BB64789CD767B7DD0FF3C6F56287B3D4498E.svg","./static-assets/img/svg/bell.svg":"./static/img/svg/bell.9DA292704EE9907EFDB870F4510C97336977CA27FBFAAD83CF46F8E22D3828F7.svg","./static-assets/img/svg/github.svg":"./static/img/svg/github.FA9EB1C66F548EC2C7598B94BA6A17275E1EA383D42B6C83351A2388C773E621.svg","./static-assets/img/svg/menu.svg":"./static/img/svg/menu.A2C4DD00686F5D23F78885AC4CE3E075FCA78DFBDEA70407667FBBD9801B7A75.svg","./static-assets/img/icon.png":"./static/img/icon.CC75A040D5F432E5DC9043D10B94BF1FC3BAE1D02A8C2030F655E642EAD4A32C.png","./static-assets/img/svg/file.svg":"./static/img/svg/file.F9E376D9F78FFD918D8D592A8B2D97EAAC14E638B5A7AE3C58DDB075375D8E0E.svg","./static-assets/bundle/main.js":"./static/bundle/main.47250AD075BB60388779EF82D1C6A084AB82B69A9061D8A4DFCF1C18C07A0C4F.js","./static-assets/bundle/main.css":"./static/bundle/main.C7B0ACE647935B5E61BD692A0EB6AFF167CAB2F80483079378CF7A18D7FF9466.css","./static-assets/img/svg/file-text.svg":"./static/img/svg/file-text.CF57DF252051E7E81C240D36AF1DB8A9DDAF282F9A5E8C338408FE88A6545A02.svg","./static-assets/img/svg/help-circle.svg":"./static/img/svg/help-circle.BE230ABD2E05EB05EF6C5B7D04D35A3A43637EF1E046DEF3D244425609B99F81.svg","./static-assets/img/icon-trans.png":"./static/img/icon-trans.7920418313D84DCDB2491E02E52E4BEF374970C216E85BD721274EE51241ECD4.png","./static-assets/img/svg/toggle-right.svg":"./static/img/svg/toggle-right.15BF49887941593CE3FE09FA73E3CAF1F4B1E8ABCB42A23D85B4FCBC24FDF5AA.svg"},"base_dir":"./static"} {"map":{"./static-assets/img/svg/eye.svg":"./static/img/svg/eye.9DE4D24D3C9B055D02B94A8AD65E8C0C644852381FDD131A64448B6DA7859167.svg","./static-assets/img/svg/message-square.svg":"./static/img/svg/message-square.E246A6B2AAEFCE8A62B9BDD2D155D3B4923C3E48325EAEF099D509A2D7BB4DD1.svg","./static-assets/img/svg/eye-off.svg":"./static/img/svg/eye-off.939360B335D1D35B57C3E2070129D14ABB168E4AC137B5BE4F6F8BD450B712F5.svg","./static-assets/img/svg/toggle-left.svg":"./static/img/svg/toggle-left.E421950C5922E84015F0A86F272AE5637A2ED96E267D2C962543F5994E5D1172.svg","./static-assets/img/icon.png":"./static/img/icon.CC75A040D5F432E5DC9043D10B94BF1FC3BAE1D02A8C2030F655E642EAD4A32C.png","./static-assets/img/svg/moon.svg":"./static/img/svg/moon.1E151D68949CA3B2DC7DE34BC25B7586E4175AC3BA7F56DDBB34227334EF7155.svg","./static-assets/img/svg/key.svg":"./static/img/svg/key.F0AACBED8D0F7A279977392F92F4DA73C35E905AC73B3C83320D54856E627EEC.svg","./static-assets/bundle/main.css":"./static/bundle/main.C5FDAAD302D069CE1344663AFE0BD75A643A34C79FE228714F8C92BDD1827666.css","./static-assets/bundle/main.js":"./static/bundle/main.F1F284AF11A2DF33C55F2263CB65458529E943F04474204EEC973F33053C7F56.js","./static-assets/img/svg/log-out.svg":"./static/img/svg/log-out.92AB4384FD41D9AFE4735C480361BB64789CD767B7DD0FF3C6F56287B3D4498E.svg","./static-assets/img/svg/file.svg":"./static/img/svg/file.F9E376D9F78FFD918D8D592A8B2D97EAAC14E638B5A7AE3C58DDB075375D8E0E.svg","./static-assets/img/svg/globe.svg":"./static/img/svg/globe.44C2A069EBD637663E938ECE7B8E4EC2A8BDE049A8A044EC68D9CB69AE8C592E.svg","./static-assets/img/svg/shield.svg":"./static/img/svg/shield.13AFE15DCB4882B4A940CFDC3E2088A733CD4E6F97F25B211D87C7C9D6DBA2B6.svg","./static-assets/img/svg/toggle-right.svg":"./static/img/svg/toggle-right.15BF49887941593CE3FE09FA73E3CAF1F4B1E8ABCB42A23D85B4FCBC24FDF5AA.svg","./static-assets/img/svg/help-circle.svg":"./static/img/svg/help-circle.BE230ABD2E05EB05EF6C5B7D04D35A3A43637EF1E046DEF3D244425609B99F81.svg","./static-assets/img/svg/home.svg":"./static/img/svg/home.28C26C2D3E4013D24D755A589A80D8DD5C49DA5397032E3F09B76BC3A2C314ED.svg","./static-assets/img/svg/settings.svg":"./static/img/svg/settings.910C6241743C9C694141971BE8E1C4016A1A5BF203E4E9D676D4CE93BD518F4C.svg","./static-assets/img/svg/github.svg":"./static/img/svg/github.FA9EB1C66F548EC2C7598B94BA6A17275E1EA383D42B6C83351A2388C773E621.svg","./static-assets/img/svg/shield-off.svg":"./static/img/svg/shield-off.85394A6AD92D550F8EBA72AAB095E078E7A0E3359DF81174532C8D1AF53B5876.svg","./static-assets/img/svg/file-text.svg":"./static/img/svg/file-text.CF57DF252051E7E81C240D36AF1DB8A9DDAF282F9A5E8C338408FE88A6545A02.svg","./static-assets/img/icon-trans.png":"./static/img/icon-trans.7920418313D84DCDB2491E02E52E4BEF374970C216E85BD721274EE51241ECD4.png","./static-assets/img/svg/credit-card.svg":"./static/img/svg/credit-card.DF612AFE367A7B31410F2F6CD3C7B515B0F1889C0107EA695D840DFFA492E07D.svg","./static-assets/img/svg/user.svg":"./static/img/svg/user.B164ECD2C4A09DC5189F1F252487E2AC6A33646BEA67AF9C528CDA61FE5E146F.svg","./static-assets/img/svg/menu.svg":"./static/img/svg/menu.A2C4DD00686F5D23F78885AC4CE3E075FCA78DFBDEA70407667FBBD9801B7A75.svg","./static-assets/img/svg/bell.svg":"./static/img/svg/bell.9DA292704EE9907EFDB870F4510C97336977CA27FBFAAD83CF46F8E22D3828F7.svg","./static-assets/img/svg/tag.svg":"./static/img/svg/tag.E0BC111B8E81BBFC62B6A9E7E4AC162B7085A6543D995B7A0030CB7632901BD4.svg","./static-assets/img/svg/filter.svg":"./static/img/svg/filter.6D5FBD96BA2E2020663AAC4994A991295917D73F3592C07EE103647B655A2275.svg"},"base_dir":"./static"}

View file

@ -40,6 +40,8 @@ pub use data::Data;
pub use settings::Settings; pub use settings::Settings;
use static_assets::FileMap; use static_assets::FileMap;
pub use crate::middleware::auth::CheckLogin;
lazy_static! { lazy_static! {
pub static ref SETTINGS: Settings = Settings::new().unwrap(); pub static ref SETTINGS: Settings = Settings::new().unwrap();
pub static ref S: String = env::var("S").unwrap(); pub static ref S: String = env::var("S").unwrap();

View file

@ -20,8 +20,6 @@ use actix_web::web::ServiceConfig;
mod auth; mod auth;
mod panel; mod panel;
pub use crate::middleware::auth::CheckLogin;
pub fn services(cfg: &mut ServiceConfig) { pub fn services(cfg: &mut ServiceConfig) {
cfg.service(panel::panel); cfg.service(panel::panel);
cfg.service(panel::sitekey::add_sitekey); cfg.service(panel::sitekey::add_sitekey);
@ -36,18 +34,52 @@ mod tests {
use actix_web::test; use actix_web::test;
use super::*; use super::*;
use crate::tests::*;
use crate::*; use crate::*;
#[actix_rt::test] #[actix_rt::test]
async fn protected_pages_templates_work() { async fn protected_pages_templates_work() {
let mut app = test::init_service(App::new().configure(services)).await; const NAME: &str = "templateuser";
const PASSWORD: &str = "longpassword";
const EMAIL: &str = "templateuser@a.com";
{
let data = Data::new().await;
delete_user(NAME, &data).await;
}
let (data, _, signin_resp) = register_and_signin(NAME, EMAIL, PASSWORD).await;
let cookies = get_cookie!(signin_resp);
let mut app = test::init_service(
App::new()
.wrap(get_identity_service())
.configure(crate::api::v1::services)
.configure(services)
.data(data.clone()),
)
.await;
let urls = vec!["/", "/sitekey/add"]; let urls = vec!["/", "/sitekey/add"];
for url in urls.iter() { for url in urls.iter() {
let resp = let resp =
test::call_service(&mut app, test::TestRequest::get().uri(url).to_request()).await; test::call_service(&mut app, test::TestRequest::get().uri(url).to_request()).await;
assert_eq!(resp.status(), StatusCode::FOUND); assert_eq!(resp.status(), StatusCode::FOUND);
let authenticated_resp = test::call_service(
&mut app,
test::TestRequest::get()
.uri(url)
.cookie(cookies.clone())
.to_request(),
)
.await;
assert_eq!(authenticated_resp.status(), StatusCode::OK);
} }
delete_user(NAME, &data).await;
} }
#[actix_rt::test] #[actix_rt::test]

View file

@ -15,13 +15,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
use actix_identity::Identity;
use actix_web::http::header;
use actix_web::{get, HttpResponse, Responder}; use actix_web::{get, HttpResponse, Responder};
use sailfish::TemplateOnce; use sailfish::TemplateOnce;
use crate::api::v1::auth::is_authenticated; use crate::CheckLogin;
pub use crate::middleware::auth::CheckLogin;
pub mod sitekey; pub mod sitekey;
@ -44,13 +41,7 @@ impl<'a> Default for IndexPage<'a> {
} }
#[get("/", wrap = "CheckLogin")] #[get("/", wrap = "CheckLogin")]
pub async fn panel(id: Identity) -> impl Responder { pub async fn panel() -> impl Responder {
if is_authenticated(&id).is_err() {
return HttpResponse::TemporaryRedirect()
.set_header(header::LOCATION, "/login")
.body("");
}
let body = IndexPage::default().render_once().unwrap(); let body = IndexPage::default().render_once().unwrap();
HttpResponse::Ok() HttpResponse::Ok()
.content_type("text/html; charset=utf-8") .content_type("text/html; charset=utf-8")

View file

@ -18,13 +18,16 @@
use actix_web::{get, HttpResponse, Responder}; use actix_web::{get, HttpResponse, Responder};
use sailfish::TemplateOnce; use sailfish::TemplateOnce;
use super::CheckLogin; use crate::CheckLogin;
#[derive(TemplateOnce, Clone)] #[derive(TemplateOnce, Clone)]
#[template(path = "panel/add-site-key/index.html")] #[template(path = "panel/add-site-key/index.html")]
pub struct IndexPage<'a> { pub struct IndexPage<'a> {
pub name: &'a str, pub name: &'a str,
pub title: &'a str, pub title: &'a str,
pub levels: usize,
pub form_title: &'a str,
pub form_description: &'a str,
} }
const TITLE: &str = "Add Site Key"; const TITLE: &str = "Add Site Key";
@ -34,6 +37,9 @@ impl<'a> Default for IndexPage<'a> {
IndexPage { IndexPage {
name: "mCaptcha", name: "mCaptcha",
title: TITLE, title: TITLE,
levels: 1,
form_description: "",
form_title: "Add Site Key",
} }
} }
} }

View file

@ -0,0 +1,19 @@
/*
* Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
mod add;
pub use add::add_sitekey;

File diff suppressed because one or more lines are too long

View file

@ -1 +1,256 @@
!function(e){var t={};function n(a){if(t[a])return t[a].exports;var r=t[a]={i:a,l:!1,exports:{}};return e[a].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,a){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(n.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(a,r,function(t){return e[t]}.bind(null,r));return a},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t,n){},function(e,t,n){},function(e,t,n){"use strict";n.r(t);const a=e=>{if(!e)throw new Error("uri is empty");if("string"!=typeof e)throw new TypeError("URI must be a string");let t=e.length;return"/"==e[t-1]&&(e=e.slice(0,t-1)),e};var r={registerUser:"/api/v1/signup",loginUser:"/api/v1/signin",signoutUser:"/api/v1/signout",deleteAccount:"/api/v1/account/delete",usernameExists:"/api/v1/account/username/exists",emailExists:"/api/v1/account/email/exists",healthCheck:"/api/v1/meta/health",buildDetails:"/api/v1/meta/build",addDomain:"/api/v1/mcaptcha/domain/add",challengeDomain:"/api/v1/mcaptcha/domain/domain/verify/challenge/get",proveDomain:"/api/v1/mcaptcha/domain/domain/verify/challenge/prove",deleteDomain:"/api/v1/mcaptcha/domain/delete",addToken:"/api/v1/mcaptcha/domain/token/add",updateTokenKey:"/api/v1/mcaptcha/domain/token/update",getTokenKey:"/api/v1/mcaptcha/domain/token/get",deleteToken:"/api/v1/mcaptcha/domain/token/delete",addTokenLevels:"/api/v1/mcaptcha/domain/token/levels/add",updateTokenLevels:"/api/v1/mcaptcha/domain/token/levels/update",deleteTokenLevels:"/api/v1/mcaptcha/domain/token/levels/delete",getTokenLevels:"/api/v1/mcaptcha/domain/token/levels/get",getTokenDuration:"/api/v1/mcaptcha/domain/token/token/get",updateTokenDuration:"/api/v1/mcaptcha/domain/token/token/update"};var o={registerUser:"/join/",loginUser:"/login/",signoutUser:"/api/v1/signout",panelHome:"/",docsHome:"/docs/"};var i=e=>({method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});const s=e=>{e.preventDefault();let t=document.getElementById("username").value;i(e,t,"username");let n=document.getElementById("password").value;fetch(r.loginUser,i({username:t,password:n})).then(e=>{e.ok?(alert("success"),window.location.assign(o.panelHome)):e.json().then(e=>alert("error: "+e.error))})};var l=async function(){let e=document.getElementById("username"),t={val:e.value},n=await fetch(r.usernameExists,i(t));if(n.ok){let t=await n.json();return t.exists&&(e.className+=" form__in-field--warn",alert("Username taken")),t.exists}{let e=await n.json();alert("error: "+e.error)}return!1};const u=async e=>{e.preventDefault();let t=document.getElementById("username").value;i(e,t,"username");let n=document.getElementById("password").value;if(n!=document.getElementById("password-check").value)return alert("passwords don't match, check again!");let a=await l();if(a)return;let s=document.getElementById("email").value;if(s.replace(/\s/g,"").length){if(a=await(async()=>{let e=document.getElementById("email"),t={val:e.value},n=await fetch(r.emailExists,i(t));if(n.ok){let t=await n.json();return t.exists&&(e.className+=" form__in-field--warn",alert("Email taken")),t.exists}{let e=await n.json();alert("error: "+e.error)}})(),a)return}else s=null;let u={username:t,password:n,email:s},c=await fetch(r.registerUser,i(u));if(c.ok)alert("success"),window.location.assign(o.loginUser);else{let e=await c.json();alert("error: "+e.error)}};n(0),n(1);const c=new class{constructor(){this.routes=[]}register(e,t){if(!e)throw new Error("uri is empty");if(!t)throw new Error("fn is empty");if("string"!=typeof e)throw new TypeError("URI must be a string");if("function"!=typeof t)throw new TypeError("a callback fn must be provided");this.routes.forEach(t=>{if(t.uri==e)throw new Error(`URI exists. provided URI: ${e}, registered config: ${t}`)});const n={uri:e=a(e),fn:t};this.routes.push(n)}route(){this.routes.forEach(e=>{let t=new RegExp(`^${e.uri}$`),n=window.location.pathname;if(n=a(n),n.match(t))return e.fn.call()})}};c.register(o.panelHome,()=>{}),c.register(o.registerUser,()=>{document.getElementById("form").addEventListener("submit",u,!0),document.getElementById("username").addEventListener("input",l,!1)}),c.register(o.loginUser,()=>{document.getElementById("form").addEventListener("submit",s,!0)}),c.route()}]); /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "./templates/index.js");
/******/ })
/************************************************************************/
/******/ ({
/***/ "./templates/api/v1/routes.js":
/*!************************************!*\
!*** ./templates/api/v1/routes.js ***!
\************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/*\n * Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n */\n\nconst ROUTES = {\n registerUser: '/api/v1/signup',\n\n loginUser: '/api/v1/signin',\n\n signoutUser: '/api/v1/signout',\n\n deleteAccount: '/api/v1/account/delete',\n\n usernameExists: '/api/v1/account/username/exists',\n\n emailExists: '/api/v1/account/email/exists',\n\n healthCheck: '/api/v1/meta/health',\n\n buildDetails: '/api/v1/meta/build',\n\n addDomain: '/api/v1/mcaptcha/domain/add',\n\n challengeDomain: '/api/v1/mcaptcha/domain/domain/verify/challenge/get',\n\n proveDomain: '/api/v1/mcaptcha/domain/domain/verify/challenge/prove',\n\n deleteDomain: '/api/v1/mcaptcha/domain/delete',\n\n addToken: '/api/v1/mcaptcha/domain/token/add',\n\n updateTokenKey: '/api/v1/mcaptcha/domain/token/update',\n\n getTokenKey: '/api/v1/mcaptcha/domain/token/get',\n\n deleteToken: '/api/v1/mcaptcha/domain/token/delete',\n\n addTokenLevels: '/api/v1/mcaptcha/domain/token/levels/add',\n\n updateTokenLevels: '/api/v1/mcaptcha/domain/token/levels/update',\n\n deleteTokenLevels: '/api/v1/mcaptcha/domain/token/levels/delete',\n\n getTokenLevels: '/api/v1/mcaptcha/domain/token/levels/get',\n\n getTokenDuration: '/api/v1/mcaptcha/domain/token/token/get',\n\n updateTokenDuration: '/api/v1/mcaptcha/domain/token/token/update',\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (ROUTES);\n\n\n//# sourceURL=webpack:///./templates/api/v1/routes.js?");
/***/ }),
/***/ "./templates/auth/login/index.js":
/*!***************************************!*\
!*** ./templates/auth/login/index.js ***!
\***************************************/
/*! exports provided: index */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"index\", function() { return index; });\n/* harmony import */ var _api_v1_routes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../api/v1/routes */ \"./templates/api/v1/routes.js\");\n/* harmony import */ var _views_v1_routes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../views/v1/routes */ \"./templates/views/v1/routes.js\");\n/* harmony import */ var _utils_genJsonPayload__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utils/genJsonPayload */ \"./templates/utils/genJsonPayload.js\");\n/*\n * Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n */\n\n\n\n\n\n\n\n//import '../forms.scss';\n\nconst login = e => {\n e.preventDefault();\n let username = document.getElementById('username').value;\n Object(_utils_genJsonPayload__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(e, username, 'username');\n\n let password = document.getElementById('password').value;\n let payload = {\n username,\n password,\n };\n\n fetch(_api_v1_routes__WEBPACK_IMPORTED_MODULE_0__[\"default\"].loginUser, Object(_utils_genJsonPayload__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(payload)).then(res => {\n if (res.ok) {\n alert('success');\n window.location.assign(_views_v1_routes__WEBPACK_IMPORTED_MODULE_1__[\"default\"].panelHome);\n } else {\n res.json().then(err => alert(`error: ${err.error}`));\n }\n });\n};\n\nconst index = () => {\n let form = document.getElementById('form');\n form.addEventListener('submit', login, true);\n};\n\n\n//# sourceURL=webpack:///./templates/auth/login/index.js?");
/***/ }),
/***/ "./templates/auth/register/emailExists.js":
/*!************************************************!*\
!*** ./templates/auth/register/emailExists.js ***!
\************************************************/
/*! exports provided: checkEmailExists */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"checkEmailExists\", function() { return checkEmailExists; });\n/* harmony import */ var _api_v1_routes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../api/v1/routes */ \"./templates/api/v1/routes.js\");\n/* harmony import */ var _utils_genJsonPayload__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utils/genJsonPayload */ \"./templates/utils/genJsonPayload.js\");\n/*\n * Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n */\n\n\n\n\n\nconst checkEmailExists = async () => {\n let email = document.getElementById('email');\n let val = email.value;\n let payload = {\n val,\n };\n\n // return fetch(ROUTES.emailExists, genJsonPayload(payload)).then(res => {\n // if (res.ok) {\n // res.json().then(data => {\n // if (data.exists) {\n // console.log(email.className);\n // email.className += ' form__in-field--warn';\n // alert('Email taken');\n // }\n //\n // return data.exists;\n // });\n // } else {\n // res.json().then(err => alert(`error: ${err.error}`));\n // }\n // });\n //\n\n let res = await fetch(_api_v1_routes__WEBPACK_IMPORTED_MODULE_0__[\"default\"].emailExists, Object(_utils_genJsonPayload__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(payload));\n if (res.ok) {\n let data = await res.json();\n if (data.exists) {\n email.className += ' form__in-field--warn';\n alert('Email taken');\n }\n return data.exists;\n } else {\n let err = await res.json();\n alert(`error: ${err.error}`);\n }\n};\n\n\n\n\n//# sourceURL=webpack:///./templates/auth/register/emailExists.js?");
/***/ }),
/***/ "./templates/auth/register/index.js":
/*!******************************************!*\
!*** ./templates/auth/register/index.js ***!
\******************************************/
/*! exports provided: index */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"index\", function() { return index; });\n/* harmony import */ var _api_v1_routes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../api/v1/routes */ \"./templates/api/v1/routes.js\");\n/* harmony import */ var _views_v1_routes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../views/v1/routes */ \"./templates/views/v1/routes.js\");\n/* harmony import */ var _utils_genJsonPayload__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utils/genJsonPayload */ \"./templates/utils/genJsonPayload.js\");\n/* harmony import */ var _userExists__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./userExists */ \"./templates/auth/register/userExists.js\");\n/* harmony import */ var _emailExists__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./emailExists */ \"./templates/auth/register/emailExists.js\");\n/*\n* Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>\n*\n* This program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Affero General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* This program is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Affero General Public License for more details.\n*\n* You should have received a copy of the GNU Affero General Public License\n* along with this program. If not, see <https://www.gnu.org/licenses/>.\n*/\n\n\n\n\n\n\n\n\n\n\n//import '../forms.scss';\n\nconst registerUser = async e => {\n e.preventDefault();\n\n let username = document.getElementById('username').value;\n Object(_utils_genJsonPayload__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(e, username, 'username');\n\n let password = document.getElementById('password').value;\n let passwordCheck = document.getElementById('password-check').value;\n if (password != passwordCheck) {\n return alert(\"passwords don't match, check again!\");\n }\n\n let exists = await Object(_userExists__WEBPACK_IMPORTED_MODULE_3__[\"default\"])();\n if (exists) {\n return;\n }\n\n let email = document.getElementById('email').value;\n if (!email.replace(/\\s/g, '').length) {\n email = null;\n } else {\n exists = await Object(_emailExists__WEBPACK_IMPORTED_MODULE_4__[\"checkEmailExists\"])();\n if (exists) {\n return;\n }\n }\n\n let payload = {\n username,\n password,\n email,\n };\n\n let res = await fetch(_api_v1_routes__WEBPACK_IMPORTED_MODULE_0__[\"default\"].registerUser, Object(_utils_genJsonPayload__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(payload));\n if (res.ok) {\n alert('success');\n window.location.assign(_views_v1_routes__WEBPACK_IMPORTED_MODULE_1__[\"default\"].loginUser);\n } else {\n let err = await res.json();\n alert(`error: ${err.error}`);\n }\n};\n\nconst index = () => {\n let form = document.getElementById('form');\n form.addEventListener('submit', registerUser, true);\n\n let username = document.getElementById('username');\n username.addEventListener('input', _userExists__WEBPACK_IMPORTED_MODULE_3__[\"default\"], false);\n};\n\n\n//# sourceURL=webpack:///./templates/auth/register/index.js?");
/***/ }),
/***/ "./templates/auth/register/userExists.js":
/*!***********************************************!*\
!*** ./templates/auth/register/userExists.js ***!
\***********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _api_v1_routes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../api/v1/routes */ \"./templates/api/v1/routes.js\");\n/* harmony import */ var _utils_genJsonPayload__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utils/genJsonPayload */ \"./templates/utils/genJsonPayload.js\");\n/*\n * Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n */\n\n\n\n\n\n//export const checkUsernameExists = async () => {\nasync function userExists() {\n let username = document.getElementById('username');\n let val = username.value;\n let payload = {\n val,\n };\n\n // return fetch(ROUTES.usernameExists, genJsonPayload(payload)).then(res => {\n // if (res.ok) {\n // res.json().then(data => {\n // if (data.exists) {\n // username.className += ' form__in-field--warn';\n // alert('Username taken');\n // }\n // return data.exists;\n // });\n // } else {\n // res.json().then(err => alert(`error: ${err.error}`));\n // }\n // });\n //\n\n let res = await fetch(_api_v1_routes__WEBPACK_IMPORTED_MODULE_0__[\"default\"].usernameExists, Object(_utils_genJsonPayload__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(payload));\n if (res.ok) {\n let data = await res.json();\n if (data.exists) {\n username.className += ' form__in-field--warn';\n alert('Username taken');\n }\n return data.exists;\n } else {\n let err = await res.json();\n alert(`error: ${err.error}`);\n }\n return false;\n}\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (userExists);\n\n\n//# sourceURL=webpack:///./templates/auth/register/userExists.js?");
/***/ }),
/***/ "./templates/index.js":
/*!****************************!*\
!*** ./templates/index.js ***!
\****************************/
/*! no exports provided */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _router__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./router */ \"./templates/router.js\");\n/* harmony import */ var _auth_login__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./auth/login */ \"./templates/auth/login/index.js\");\n/* harmony import */ var _auth_register__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./auth/register */ \"./templates/auth/register/index.js\");\n/* harmony import */ var _panel_index__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./panel/index */ \"./templates/panel/index.js\");\n/* harmony import */ var _panel_add_site_key___WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./panel/add-site-key/ */ \"./templates/panel/add-site-key/index.js\");\n/* harmony import */ var _panel_main_scss__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./panel/main.scss */ \"./templates/panel/main.scss\");\n/* harmony import */ var _panel_main_scss__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_panel_main_scss__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _views_v1_routes__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./views/v1/routes */ \"./templates/views/v1/routes.js\");\n/*\n * Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n */\n\n\n\n\n\n\n\n//import './auth/forms.scss';\n\n\n\nconst router = new _router__WEBPACK_IMPORTED_MODULE_0__[\"Router\"]();\n\nrouter.register(_views_v1_routes__WEBPACK_IMPORTED_MODULE_6__[\"default\"].panelHome, _panel_index__WEBPACK_IMPORTED_MODULE_3__[\"index\"]);\nrouter.register(_views_v1_routes__WEBPACK_IMPORTED_MODULE_6__[\"default\"].registerUser, _auth_register__WEBPACK_IMPORTED_MODULE_2__[\"index\"]);\nrouter.register(_views_v1_routes__WEBPACK_IMPORTED_MODULE_6__[\"default\"].loginUser, _auth_login__WEBPACK_IMPORTED_MODULE_1__[\"index\"]);\nrouter.register(_views_v1_routes__WEBPACK_IMPORTED_MODULE_6__[\"default\"].addSiteKey, _panel_add_site_key___WEBPACK_IMPORTED_MODULE_4__[\"index\"]);\n\nrouter.route();\n\n\n//# sourceURL=webpack:///./templates/index.js?");
/***/ }),
/***/ "./templates/panel/add-site-key/addLevelButton.js":
/*!********************************************************!*\
!*** ./templates/panel/add-site-key/addLevelButton.js ***!
\********************************************************/
/*! exports provided: addLevelButtonAddEventListener */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"addLevelButtonAddEventListener\", function() { return addLevelButtonAddEventListener; });\n/*\n * Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n */\n\nconst LABEL_CONTAINER_CLASS = 'sitekey-form__add-level-flex-container';\nconst ADD_LEVEL_BUTTON = 'sitekey-form__add-level-button';\nconst LABEL_CLASS = 'sitekey-form__label';\nconst INPUT_ID_WITHOUT_LEVEL = 'level';\nconst LABEL_INNER_TEXT_WITHOUT_LEVEL = 'Level ';\nconst INPUT_CLASS = 'sitekey-form__input--add-level';\nconst ADD_LEVEL_BUTTON_INNER_TEXT = 'Add Level';\n\nconst addLevelButtonEventHandler = e => {\n const PREV_LEVEL_CONTAINER = e.target.parentElement;\n e.target.remove();\n\n let numLevels = 0;\n document.querySelectorAll(`.${LABEL_CLASS}`).forEach(_ => numLevels++);\n numLevels = numLevels.toString();\n\n let labelContainer = document.createElement('div');\n labelContainer.className = LABEL_CONTAINER_CLASS;\n\n let inputID = INPUT_ID_WITHOUT_LEVEL + numLevels;\n let label = document.createElement('label');\n label.className = LABEL_CLASS;\n label.htmlFor = inputID;\n label.innerText = LABEL_INNER_TEXT_WITHOUT_LEVEL + numLevels;\n\n labelContainer.appendChild(label);\n\n PREV_LEVEL_CONTAINER.insertAdjacentElement('afterend', labelContainer);\n\n let inputContainer = document.createElement('div');\n inputContainer.className = LABEL_CONTAINER_CLASS;\n\n let input = document.createElement('input');\n input.id = inputID;\n input.name = inputID;\n input.type = 'text';\n input.className = INPUT_CLASS;\n\n inputContainer.appendChild(input);\n\n let button = document.createElement('button');\n button.className = ADD_LEVEL_BUTTON;\n button.innerText = ADD_LEVEL_BUTTON_INNER_TEXT;\n\n inputContainer.appendChild(button);\n\n labelContainer.insertAdjacentElement('afterend', inputContainer);\n\n\n addLevelButtonAddEventListener();\n};\n\nconst addLevelButtonAddEventListener = () => {\n let addLevelButton = document.querySelector(`.${ADD_LEVEL_BUTTON}`);\n addLevelButton.addEventListener('click', addLevelButtonEventHandler);\n};\n\n/*\n <div class=\"sitekey-form__add-level-flex-container\">\n<label class=\"sitekey-form__label\" for=\"level2\">Level 2</label>\n</div>\n\n<div class=\"sitekey-form__add-level-flex-container\">\n<input\n class=\"sitekey-form__input--add-level\"\n type=\"text\"\n name=\"level2\"\n id=\"level2\"\n value=\"\"\n/>\n<button class=\"sitekey-form__add-level-button\">Add Level</button>\n</div>\n*/\n\n\n//# sourceURL=webpack:///./templates/panel/add-site-key/addLevelButton.js?");
/***/ }),
/***/ "./templates/panel/add-site-key/form.js":
/*!**********************************************!*\
!*** ./templates/panel/add-site-key/form.js ***!
\**********************************************/
/*! exports provided: addSubmitEventListener */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"addSubmitEventListener\", function() { return addSubmitEventListener; });\n/*\n * Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n */\n\nconst SITE_KEY_FORM_CLASS = 'sitekey-form';\nconst FORM = document.querySelector(`.${SITE_KEY_FORM_CLASS}`);\n\nconst addSubmitEventListener = () => {\n FORM.addEventListener('submit', submit, true);\n};\n\nconst submit = async () => {\n alert('submited');\n // get values\n // check validate levels\n // submit\n // handle erros\n}\n\n\n//# sourceURL=webpack:///./templates/panel/add-site-key/form.js?");
/***/ }),
/***/ "./templates/panel/add-site-key/index.js":
/*!***********************************************!*\
!*** ./templates/panel/add-site-key/index.js ***!
\***********************************************/
/*! exports provided: index */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"index\", function() { return index; });\n/* harmony import */ var _addLevelButton__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./addLevelButton */ \"./templates/panel/add-site-key/addLevelButton.js\");\n/* harmony import */ var _form__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./form */ \"./templates/panel/add-site-key/form.js\");\n/*\n * Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n */\n\n\n\n\nconst index = () => {\n _addLevelButton__WEBPACK_IMPORTED_MODULE_0__[\"addLevelButtonAddEventListener\"]();\n _form__WEBPACK_IMPORTED_MODULE_1__[\"addSubmitEventListener\"]();\n};\n\n\n//# sourceURL=webpack:///./templates/panel/add-site-key/index.js?");
/***/ }),
/***/ "./templates/panel/index.js":
/*!**********************************!*\
!*** ./templates/panel/index.js ***!
\**********************************/
/*! exports provided: index */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"index\", function() { return index; });\n/*\n * Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n */\n\nconst index = () => {\n // const html = document.documentElement;\n // const body = document.body;\n // const menuLinks = document.querySelectorAll('.admin-menu a');\n // const collapseBtn = document.querySelector('.admin-menu .collapse-btn');\n // const toggleMobileMenu = document.querySelector('.toggle-mob-menu');\n // const switchInput = document.querySelector('.switch input');\n // const switchLabel = document.querySelector('.switch label');\n // const switchLabelText = switchLabel.querySelector('span:last-child');\n // const collapsedClass = 'collapsed';\n // const lightModeClass = 'light-mode';\n //\n // /*TOGGLE HEADER STATE*/\n // collapseBtn.addEventListener('click', function() {\n // body.classList.toggle(collapsedClass);\n // this.getAttribute('aria-expanded') == 'true'\n // ? this.setAttribute('aria-expanded', 'false')\n // : this.setAttribute('aria-expanded', 'true');\n // this.getAttribute('aria-label') == 'collapse menu'\n // ? this.setAttribute('aria-label', 'expand menu')\n // : this.setAttribute('aria-label', 'collapse menu');\n // });\n //\n // /*TOGGLE MOBILE MENU*/\n // toggleMobileMenu.addEventListener('click', function() {\n // body.classList.toggle('mob-menu-opened');\n // this.getAttribute('aria-expanded') == 'true'\n // ? this.setAttribute('aria-expanded', 'false')\n // : this.setAttribute('aria-expanded', 'true');\n // this.getAttribute('aria-label') == 'open menu'\n // ? this.setAttribute('aria-label', 'close menu')\n // : this.setAttribute('aria-label', 'open menu');\n // });\n //\n // /*SHOW TOOLTIP ON MENU LINK HOVER*/\n // for (const link of menuLinks) {\n // link.addEventListener('mouseenter', function() {\n // if (\n // body.classList.contains(collapsedClass) &&\n // window.matchMedia('(min-width: 768px)').matches\n // ) {\n // const tooltip = this.querySelector('span').textContent;\n // this.setAttribute('title', tooltip);\n // } else {\n // this.removeAttribute('title');\n // }\n // });\n // }\n //\n // /*TOGGLE LIGHT/DARK MODE*/\n // if (localStorage.getItem('dark-mode') === 'false') {\n // html.classList.add(lightModeClass);\n // switchInput.checked = false;\n // switchLabelText.textContent = 'Light';\n // }\n //\n // switchInput.addEventListener('input', function() {\n // html.classList.toggle(lightModeClass);\n // if (html.classList.contains(lightModeClass)) {\n // switchLabelText.textContent = 'Light';\n // localStorage.setItem('dark-mode', 'false');\n // } else {\n // switchLabelText.textContent = 'Dark';\n // localStorage.setItem('dark-mode', 'true');\n // }\n // });\n //\n let a;\n};\n\n\n//# sourceURL=webpack:///./templates/panel/index.js?");
/***/ }),
/***/ "./templates/panel/main.scss":
/*!***********************************!*\
!*** ./templates/panel/main.scss ***!
\***********************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("// extracted by mini-css-extract-plugin\n\n//# sourceURL=webpack:///./templates/panel/main.scss?");
/***/ }),
/***/ "./templates/router.js":
/*!*****************************!*\
!*** ./templates/router.js ***!
\*****************************/
/*! exports provided: Router */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Router\", function() { return Router; });\n/*\n * Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n */\n\nconst normalizeUri = uri => {\n if (!uri) {\n throw new Error('uri is empty');\n }\n\n if (typeof uri !== 'string') {\n throw new TypeError('URI must be a string');\n }\n\n let uriLength = uri.length;\n if (uri[uriLength - 1] == '/') {\n uri = uri.slice(0, uriLength - 1);\n }\n return uri;\n};\n\nclass Router {\n constructor() {\n this.routes = [];\n }\n\n register(uri, fn) {\n // typechecks\n if (!uri) {\n throw new Error('uri is empty');\n }\n\n if (!fn) {\n throw new Error('fn is empty');\n }\n if (typeof uri !== 'string') {\n throw new TypeError('URI must be a string');\n }\n\n if (typeof fn !== 'function') {\n throw new TypeError('a callback fn must be provided');\n }\n\n this.routes.forEach(route => {\n if (route.uri == uri) {\n throw new Error(\n `URI exists. provided URI: ${uri}, registered config: ${route}`,\n );\n }\n });\n\n uri = normalizeUri(uri);\n\n const route = {\n uri,\n fn,\n };\n this.routes.push(route);\n }\n\n route() {\n this.routes.forEach(route => {\n // normalize for trailing slash\n let pattern = new RegExp(`^${route.uri}$`);\n let path = window.location.pathname;\n path = normalizeUri(path);\n if (path.match(pattern)) {\n return route.fn.call();\n }\n });\n }\n}\n\n\n//# sourceURL=webpack:///./templates/router.js?");
/***/ }),
/***/ "./templates/utils/genJsonPayload.js":
/*!*******************************************!*\
!*** ./templates/utils/genJsonPayload.js ***!
\*******************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/*\n * Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n */\n\nconst genJsonPayload = payload => {\n let value = {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(payload),\n };\n return value;\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (genJsonPayload);\n\n\n//# sourceURL=webpack:///./templates/utils/genJsonPayload.js?");
/***/ }),
/***/ "./templates/views/v1/routes.js":
/*!**************************************!*\
!*** ./templates/views/v1/routes.js ***!
\**************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/*\n * Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n */\n\nconst ROUTES = {\n registerUser: '/join/',\n loginUser: '/login/',\n signoutUser: '/api/v1/signout',\n panelHome: '/',\n docsHome: '/docs/',\n sitekey: '/sitekey',\n addSiteKey: '/sitekey/add',\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (ROUTES);\n\n\n//# sourceURL=webpack:///./templates/views/v1/routes.js?");
/***/ })
/******/ });

View file

@ -1,9 +1,20 @@
* { * {
padding: 0;
margin: 0; margin: 0;
padding: 0;
} }
a { a {
text-decoration: none; text-decoration: none;
color: inherit; }
li {
list-style: none;
}
html {
height: 100%;
}
body {
height: 100%;
} }

View file

@ -1,3 +1,20 @@
/*
* Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
const ROUTES = { const ROUTES = {
registerUser: '/api/v1/signup', registerUser: '/api/v1/signup',

View file

@ -1,3 +1,20 @@
/*
* Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import ROUTES from '../../api/v1/routes'; import ROUTES from '../../api/v1/routes';
import VIEWS from '../../views/v1/routes'; import VIEWS from '../../views/v1/routes';

View file

@ -1,3 +1,20 @@
/*
* Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import ROUTES from '../../api/v1/routes'; import ROUTES from '../../api/v1/routes';
import genJsonPayload from '../../utils/genJsonPayload'; import genJsonPayload from '../../utils/genJsonPayload';

View file

@ -1,3 +1,20 @@
/*
* Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import ROUTES from '../../api/v1/routes'; import ROUTES from '../../api/v1/routes';
import VIEWS from '../../views/v1/routes'; import VIEWS from '../../views/v1/routes';

View file

@ -1,10 +1,26 @@
/*
* Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import ROUTES from '../../api/v1/routes'; import ROUTES from '../../api/v1/routes';
import genJsonPayload from '../../utils/genJsonPayload'; import genJsonPayload from '../../utils/genJsonPayload';
//export const checkUsernameExists = async () => { //export const checkUsernameExists = async () => {
async function userExists() { async function userExists() {
let username = document.getElementById('username'); let username = document.getElementById('username');
let val = username.value; let val = username.value;
let payload = { let payload = {
@ -39,6 +55,6 @@ async function userExists() {
alert(`error: ${err.error}`); alert(`error: ${err.error}`);
} }
return false; return false;
}; }
export default userExists; export default userExists;

View file

@ -3,6 +3,6 @@
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title><.= title .>|<.= name .></title> <title><.= title .> | <.= name .></title>
</head> </head>
<body> <body>

View file

@ -1,18 +1,35 @@
/*
* Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {Router} from './router'; import {Router} from './router';
import * as login from './auth/login'; import * as login from './auth/login';
import * as register from './auth/register'; import * as register from './auth/register';
import * as panel from './panel/index'; import * as panel from './panel/index';
import './auth/forms.scss'; import * as addSiteKey from './panel/add-site-key/';
//import './auth/forms.scss';
import './panel/main.scss'; import './panel/main.scss';
import VIEWS from './views/v1/routes'; import VIEWS from './views/v1/routes';
const router = new Router(); const router = new Router();
router.register(VIEWS.panelHome, panel.index); router.register(VIEWS.panelHome, panel.index);
router.register(VIEWS.registerUser, register.index); router.register(VIEWS.registerUser, register.index);
router.register(VIEWS.loginUser, login.index); router.register(VIEWS.loginUser, login.index);
//router.register('/panel/layout.html/', panel.index); router.register(VIEWS.addSiteKey, addSiteKey.index);
router.route(); router.route();

View file

@ -0,0 +1,15 @@
<div class="sitekey-form__add-level-flex-container">
<label class="sitekey-form__label" for="level2">Level <.= level .></label>
</div>
<div class="sitekey-form__add-level-flex-container">
<input
class="sitekey-form__input--add-level"
type="number"
id="level2"
id="level<.= level .>"
name="level<.= level .>"
value=""
/>
<button class="sitekey-form__add-level-button">Add Level</button>
</div>

View file

@ -0,0 +1,90 @@
/*
* Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
const LABEL_CONTAINER_CLASS = 'sitekey-form__add-level-flex-container';
const ADD_LEVEL_BUTTON = 'sitekey-form__add-level-button';
const LABEL_CLASS = 'sitekey-form__label';
const INPUT_ID_WITHOUT_LEVEL = 'level';
const LABEL_INNER_TEXT_WITHOUT_LEVEL = 'Level ';
const INPUT_CLASS = 'sitekey-form__input--add-level';
const ADD_LEVEL_BUTTON_INNER_TEXT = 'Add Level';
const addLevelButtonEventHandler = e => {
const PREV_LEVEL_CONTAINER = e.target.parentElement;
e.target.remove();
let numLevels = 0;
document.querySelectorAll(`.${LABEL_CLASS}`).forEach(_ => numLevels++);
numLevels = numLevels.toString();
let labelContainer = document.createElement('div');
labelContainer.className = LABEL_CONTAINER_CLASS;
let inputID = INPUT_ID_WITHOUT_LEVEL + numLevels;
let label = document.createElement('label');
label.className = LABEL_CLASS;
label.htmlFor = inputID;
label.innerText = LABEL_INNER_TEXT_WITHOUT_LEVEL + numLevels;
labelContainer.appendChild(label);
PREV_LEVEL_CONTAINER.insertAdjacentElement('afterend', labelContainer);
let inputContainer = document.createElement('div');
inputContainer.className = LABEL_CONTAINER_CLASS;
let input = document.createElement('input');
input.id = inputID;
input.name = inputID;
input.type = 'text';
input.className = INPUT_CLASS;
inputContainer.appendChild(input);
let button = document.createElement('button');
button.className = ADD_LEVEL_BUTTON;
button.innerText = ADD_LEVEL_BUTTON_INNER_TEXT;
inputContainer.appendChild(button);
labelContainer.insertAdjacentElement('afterend', inputContainer);
addLevelButtonAddEventListener();
};
export const addLevelButtonAddEventListener = () => {
let addLevelButton = document.querySelector(`.${ADD_LEVEL_BUTTON}`);
addLevelButton.addEventListener('click', addLevelButtonEventHandler);
};
/*
<div class="sitekey-form__add-level-flex-container">
<label class="sitekey-form__label" for="level2">Level 2</label>
</div>
<div class="sitekey-form__add-level-flex-container">
<input
class="sitekey-form__input--add-level"
type="text"
name="level2"
id="level2"
value=""
/>
<button class="sitekey-form__add-level-button">Add Level</button>
</div>
*/

View file

@ -0,0 +1,12 @@
<div class="sitekey-form__add-level-flex-container">
<!-- insert Javascript for adding more levels as needed -->
<label class="sitekey-form__label" for="level1">Level <.= level .></label>
</div>
<input
class="sitekey-form__input"
type="number"
name="level1"
id="level<.= level .>"
value=""
/>

View file

@ -1,48 +1,25 @@
<form class="sitekey-form" action="/something" method="post"> <form class="sitekey-form" action="/something" method="post">
<div class="sitekey-form__title-flex-container"> <div class="sitekey-form__title-flex-container">
<b class="sitekey-form__title">Add Site Key</b> <b class="sitekey-form__title"><.= form_title .></b>
</div> </div>
<div class="sitekey-form__add-level-flex-container"> <div class="sitekey-form__add-level-flex-container">
<label class="sitekey-form__label" for="description">Description</label> <label class="sitekey-form__label" for="description">Description</label>
</div> </div>
<input <input
class="sitekey-form__input" class="sitekey-form__input"
type="text/" type="text"
name="description" name="description"
id="description" id="description"
value="" value="<.= form_description .>"
/> />
<div class="sitekey-form__add-level-flex-container"> <. for level in 1..=levels { .>
<!-- insert Javascript for adding more levels as needed --> <. if level == levels { .>
<label class="sitekey-form__label" for="level1">Level 1</label> <. include!("./add-level.html"); .>
</div> <. } else { .>
<. include!("./existing-level.html"); .>
<. } .>
<. } .>
<input
class="sitekey-form__input"
type="text/"
name="level1"
id="level1"
value=""
/>
<div class="sitekey-form__add-level-flex-container">
<label class="sitekey-form__label" for="level1">Level 2</label>
</div>
<div class="sitekey-form__add-level-flex-container">
<!--
<div class="sitekey-form__add-level-spacer"></div>
-->
<input
class="sitekey-form__input--add-level"
type="text/"
name="level2"
id="level2"
value=""
/>
<button class="sitekey-form__add-level">Add Level</button>
</div>
<button class="sitekey-form__submit" type="submit">Submit</button> <button class="sitekey-form__submit" type="submit">Submit</button>
</form> </form>

View file

@ -0,0 +1,31 @@
/*
* Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
const SITE_KEY_FORM_CLASS = 'sitekey-form';
const FORM = document.querySelector(`.${SITE_KEY_FORM_CLASS}`);
export const addSubmitEventListener = () => {
FORM.addEventListener('submit', submit, true);
};
const submit = async () => {
alert('submited');
// get values
// check validate levels
// submit
// handle erros
}

View file

@ -0,0 +1,24 @@
/*
* Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import * as addLevelButton from './addLevelButton';
import * as addLevelForm from './form';
export const index = () => {
addLevelButton.addLevelButtonAddEventListener();
addLevelForm.addSubmitEventListener();
};

View file

@ -65,7 +65,7 @@
</a> </a>
</li> </li>
<li class="secondary-menu__item"> <li class="secondary-menu__item">
<a class="secondary-menu__item-link" href=""> <a class="secondary-menu__item-link" href="/docs/">
<img class="secondary-menu__icon" src="<.= crate::FILES.get("./static-assets/img/svg/file-text.svg").unwrap() .>" alt="" /> <img class="secondary-menu__icon" src="<.= crate::FILES.get("./static-assets/img/svg/file-text.svg").unwrap() .>" alt="" />
<div class="secondary-menu__item-name"> <div class="secondary-menu__item-name">
API Docs API Docs
@ -73,9 +73,9 @@
</a> </a>
</li> </li>
<li class="secondary-menu__item"> <li class="secondary-menu__item">
<a class="secondary-menu__item-link" href=""> <a class="secondary-menu__item-link" href="https://github.com/mCaptcha/guard">
<img class="secondary-menu__icon" <img class="secondary-menu__icon"
src="<.= crate::FILES.get("./static-assets/img/svg/github.svg").unwrap() .>" alt="" /> src="<.= crate::FILES.get("./static-assets/img/svg/github.svg").unwrap() .>" alt="GitHub Icon" />
<div class="secondary-menu__item-name"> <div class="secondary-menu__item-name">
Source Code Source Code
</div> </div>

View file

@ -1,10 +1,19 @@
/* /*
import './main.scss'; * Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>
import './nav/main.scss'; *
*/ * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
//import './main.scss'; * License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
export const index = () => { export const index = () => {
// const html = document.documentElement; // const html = document.documentElement;

View file

@ -1,19 +1,6 @@
@import '../reset'; @import '../reset';
@import '../vars'; @import '../vars';
* {
margin: 0;
padding: 0;
}
a {
text-decoration: none;
}
li {
list-style: none;
}
.secondary-menu { .secondary-menu {
position: fixed; position: fixed;
width: 14%; width: 14%;
@ -70,16 +57,6 @@ li {
font-size: 1rem; font-size: 1rem;
} }
/*
.secondary-menu__section-partition {
border-bottom: 1px solid var(--light-text);
margin: auto;
max-width: 70%;
list-style: none;
margin: 20px;
}
*/
.secondary-menu__item-link:hover { .secondary-menu__item-link:hover {
color: $green; color: $green;
cursor: grab; cursor: grab;
@ -94,12 +71,10 @@ li {
} }
main { main {
position: fixed; margin-left: 14%;
top: 0; min-height: 100%;
right: 0;
left: 14%;
bottom: 0;
background-color: $backdrop; background-color: $backdrop;
padding-bottom: 20px;
} }
.task-bar { .task-bar {
@ -290,11 +265,7 @@ main {
margin-top: 10px; margin-top: 10px;
} }
.sitekey-form__add-level-spacer { .sitekey-form__add-level-button {
flex: 3;
}
.sitekey-form__add-level {
background-color: $violet; background-color: $violet;
color: white; color: white;
padding: 5px; padding: 5px;

View file

@ -0,0 +1,21 @@
/*
* Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
export const index = () => {
};

View file

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="52" height="52" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-bell"><path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"></path><path d="M13.73 21a2 2 0 0 1-3.46 0"></path></svg>

Before

Width:  |  Height:  |  Size: 321 B

View file

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="52" height="52" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-credit-card"><rect x="1" y="4" width="22" height="16" rx="2" ry="2"></rect><line x1="1" y1="10" x2="23" y2="10"></line></svg>

Before

Width:  |  Height:  |  Size: 329 B

View file

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="52" height="52" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-eye-off"><path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"></path><line x1="1" y1="1" x2="23" y2="23"></line></svg>

Before

Width:  |  Height:  |  Size: 460 B

View file

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="52" height="52" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-eye"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path><circle cx="12" cy="12" r="3"></circle></svg>

Before

Width:  |  Height:  |  Size: 316 B

View file

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="52" height="52" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file-text"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg>

Before

Width:  |  Height:  |  Size: 473 B

View file

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="52" height="52" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file"><path d="M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"></path><polyline points="13 2 13 9 20 9"></polyline></svg>

Before

Width:  |  Height:  |  Size: 337 B

View file

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="52" height="52" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-filter"><polygon points="22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"></polygon></svg>

Before

Width:  |  Height:  |  Size: 290 B

View file

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="52" height="52" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-github"><path d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22"></path></svg>

Before

Width:  |  Height:  |  Size: 528 B

View file

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="52" height="52" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-globe"><circle cx="12" cy="12" r="10"></circle><line x1="2" y1="12" x2="22" y2="12"></line><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path></svg>

Before

Width:  |  Height:  |  Size: 409 B

View file

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="52" height="52" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-help-circle"><circle cx="12" cy="12" r="10"></circle><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"></path><line x1="12" y1="17" x2="12.01" y2="17"></line></svg>

Before

Width:  |  Height:  |  Size: 365 B

View file

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="52" height="52" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-home"><path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path><polyline points="9 22 9 12 15 12 15 22"></polyline></svg>

Before

Width:  |  Height:  |  Size: 332 B

View file

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-key"><path d="M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4"></path></svg>

Before

Width:  |  Height:  |  Size: 352 B

View file

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="52" height="52" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-log-out"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path><polyline points="16 17 21 12 16 7"></polyline><line x1="21" y1="12" x2="9" y2="12"></line></svg>

Before

Width:  |  Height:  |  Size: 367 B

View file

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="52" height="52" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-menu"><line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="18" x2="21" y2="18"></line></svg>

Before

Width:  |  Height:  |  Size: 346 B

View file

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-message-square"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path></svg>

Before

Width:  |  Height:  |  Size: 305 B

View file

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="52" height="52" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-moon"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path></svg>

Before

Width:  |  Height:  |  Size: 281 B

View file

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="52" height="52" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-settings"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg>

Before

Width:  |  Height:  |  Size: 1,011 B

View file

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="52" height="52" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-shield-off"><path d="M19.69 14a6.9 6.9 0 0 0 .31-2V5l-8-3-3.16 1.18"></path><path d="M4.73 4.73L4 5v7c0 6 8 10 8 10a20.29 20.29 0 0 0 5.62-4.38"></path><line x1="1" y1="1" x2="23" y2="23"></line></svg>

Before

Width:  |  Height:  |  Size: 405 B

View file

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="52" height="52" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-shield"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"></path></svg>

Before

Width:  |  Height:  |  Size: 279 B

View file

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="52" height="52" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-tag"><path d="M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"></path><line x1="7" y1="7" x2="7.01" y2="7"></line></svg>

Before

Width:  |  Height:  |  Size: 355 B

View file

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="52" height="52" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-toggle-left"><rect x="1" y="5" width="22" height="14" rx="7" ry="7"></rect><circle cx="8" cy="12" r="3"></circle></svg>

Before

Width:  |  Height:  |  Size: 323 B

View file

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="52" height="52" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-toggle-right"><rect x="1" y="5" width="22" height="14" rx="7" ry="7"></rect><circle cx="16" cy="12" r="3"></circle></svg>

Before

Width:  |  Height:  |  Size: 325 B

View file

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="52" height="52" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-user"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path><circle cx="12" cy="7" r="4"></circle></svg>

Before

Width:  |  Height:  |  Size: 313 B

View file

@ -4,7 +4,7 @@
--> -->
<li class="task-bar__spacer"></li> <li class="task-bar__spacer"></li>
<li class="task-bar__action"> <li class="task-bar__action">
<a class="task-bar__link" href="/panel/sitekey/add"> <a class="task-bar__link" href="/sitekey/add">
<button class="main-menu__add-site"> <button class="main-menu__add-site">
+ New Site + New Site
</button> </button>

View file

@ -1,3 +1,20 @@
/*
* Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
const normalizeUri = uri => { const normalizeUri = uri => {
if (!uri) { if (!uri) {
throw new Error('uri is empty'); throw new Error('uri is empty');

View file

@ -1,3 +1,20 @@
/*
* Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
const genJsonPayload = payload => { const genJsonPayload = payload => {
let value = { let value = {
method: 'POST', method: 'POST',

View file

@ -1,3 +1,20 @@
/*
* Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
const isBlankString = (event, value, field) => { const isBlankString = (event, value, field) => {
if (!value.replace(/\s/g, '').length) { if (!value.replace(/\s/g, '').length) {
event.preventDefault(); event.preventDefault();

View file

@ -1,54 +1,28 @@
/*
* Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
const ROUTES = { const ROUTES = {
registerUser: '/join/', registerUser: '/join/',
loginUser: '/login/', loginUser: '/login/',
signoutUser: '/api/v1/signout', signoutUser: '/api/v1/signout',
panelHome: '/', panelHome: '/',
docsHome: '/docs/', docsHome: '/docs/',
sitekey: '/sitekey',
addSiteKey: '/sitekey/add',
}; };
export default ROUTES; export default ROUTES;
// deleteAccount: '/api/v1/account/delete',
//
// usernameExists: '/api/v1/account/username/exists',
//
// emailExists: '/api/v1/account/email/exists',
//
// healthCheck: '/api/v1/meta/health',
//
// buildDetails: '/api/v1/meta/build',
//
// addDomain: '/api/v1/mcaptcha/domain/add',
//
// challengeDomain: '/api/v1/mcaptcha/domain/domain/verify/challenge/get',
//
// proveDomain: '/api/v1/mcaptcha/domain/domain/verify/challenge/prove',
//
// deleteDomain: '/api/v1/mcaptcha/domain/delete',
//
// addToken: '/api/v1/mcaptcha/domain/token/add',
//
// updateTokenKey: '/api/v1/mcaptcha/domain/token/update',
//
// getTokenKey: '/api/v1/mcaptcha/domain/token/get',
//
// deleteToken: '/api/v1/mcaptcha/domain/token/delete',
//
// addTokenLevels: '/api/v1/mcaptcha/domain/token/levels/add',
//
// updateTokenLevels: '/api/v1/mcaptcha/domain/token/levels/update',
//
// deleteTokenLevels: '/api/v1/mcaptcha/domain/token/levels/delete',
//
// getTokenLevels: '/api/v1/mcaptcha/domain/token/levels/get',
//
// getTokenDuration: '/api/v1/mcaptcha/domain/token/token/get',
//
// updateTokenDuration: '/api/v1/mcaptcha/domain/token/token/update',
//

View file

@ -2,6 +2,8 @@ const path = require('path');
const common = require('./webpack.common'); const common = require('./webpack.common');
const merge = require('webpack-merge'); const merge = require('webpack-merge');
var HtmlWebpackPlugin = require('html-webpack-plugin'); var HtmlWebpackPlugin = require('html-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = merge(common, { module.exports = merge(common, {
mode: 'development', mode: 'development',
@ -9,12 +11,16 @@ module.exports = merge(common, {
filename: '[name].js', filename: '[name].js',
path: path.resolve(__dirname, 'static-assets/bundle'), path: path.resolve(__dirname, 'static-assets/bundle'),
}, },
plugins: [
new MiniCssExtractPlugin({filename: '[name].css'}),
new CleanWebpackPlugin(),
],
module: { module: {
rules: [ rules: [
{ {
test: /\.scss$/, test: /\.scss$/,
use: [ use: [
'style-loader', //3. Inject styles into DOM MiniCssExtractPlugin.loader, //3. Extract css into files
'css-loader', //2. Turns css into commonjs 'css-loader', //2. Turns css into commonjs
'sass-loader', //1. Turns sass into css 'sass-loader', //1. Turns sass into css
], ],