diff --git a/assets/Files/ayden1.png b/assets/Files/ayden1.png deleted file mode 100644 index 6ab5b85..0000000 Binary files a/assets/Files/ayden1.png and /dev/null differ diff --git a/assets/Files/fin1.png b/assets/Files/fin1.png deleted file mode 100644 index 462e427..0000000 Binary files a/assets/Files/fin1.png and /dev/null differ diff --git a/assets/Files/goo.png b/assets/Files/goo.png deleted file mode 100644 index beea97e..0000000 Binary files a/assets/Files/goo.png and /dev/null differ diff --git a/assets/Files/mikey1.png b/assets/Files/mikey1.png deleted file mode 100644 index b1d1071..0000000 Binary files a/assets/Files/mikey1.png and /dev/null differ diff --git a/assets/Files/quill1.png b/assets/Files/quill1.png deleted file mode 100644 index 36db35d..0000000 Binary files a/assets/Files/quill1.png and /dev/null differ diff --git a/assets/Files/ramin1.png b/assets/Files/ramin1.png deleted file mode 100644 index 876e1a6..0000000 Binary files a/assets/Files/ramin1.png and /dev/null differ diff --git a/assets/Files/theme.css b/assets/Files/theme.css index 3733eb1..bede0d6 100644 --- a/assets/Files/theme.css +++ b/assets/Files/theme.css @@ -1,17 +1,4 @@ html { - --main: #35FF00; - --main-fg: #0D4F00; - --secondary: #2ACC00; - --general-bg: #4F4F4F; - --general-fg: #808080; - --bg-transparency: #4F4F4F80; - --background-image: url(/assets/goo.png); - --page-bg: #000000AA; - --page-fg: #D8FFCC; - --tag-fg: #FFFFFF; -} - -html.Meta { --main: #cccccc; --main-fg: #202020; --secondary: #808080; @@ -22,17 +9,8 @@ html.Meta { --page-bg: #000000AA; --page-fg: #ffffff; --tag-fg: #FFFFFF; -} - -html.MikeyLore { - --main: #0080ff; - --main-fg: #002040; - --secondary: #004080; - --general-bg: #4F4F4F; - --general-fg: #808080; - --bg-transparency: #4F4F4F80; - --background-image: none; - --page-bg: #000000AA; - --page-fg: #ccddff; - --tag-fg: #FFFFFF; + --font-families: "Lato", sans-serif; + --title-font-families: "Montserrat", sans-serif; + --tag-font-families: monospace; + --title-font-weights: 800; } \ No newline at end of file diff --git a/assets/Files/will1.png b/assets/Files/will1.png deleted file mode 100644 index ae3b2ac..0000000 Binary files a/assets/Files/will1.png and /dev/null differ diff --git a/assets/system/main.css b/assets/system/main.css index 6be25d8..f8b70ad 100644 --- a/assets/system/main.css +++ b/assets/system/main.css @@ -3,7 +3,7 @@ body, html { min-height: 100vh; margin: 0; padding: 0; - font-family: "JetBrains Mono", monospace; + font-family: var(--font-families); overflow: hidden; font-size: 18px; } @@ -16,6 +16,7 @@ body { #header { background-color: var(--main); color: var(--main-fg); + font-family: var(--title-font-families); font-weight: bold; width: 100%; display: flex; @@ -31,9 +32,9 @@ body { color: var(--main-fg); font-weight: bold; border: none; - font-family: "JetBrains Mono", monospace; - font-size: 18px; height: 32px; + font-size: 24px; + line-height: 32px; cursor: pointer; } @@ -74,6 +75,7 @@ body { #sbheader, #inheader { background-color: var(--main); + font-family: var(--title-font-families); height: 48px; display: flex; flex-direction: row; @@ -134,6 +136,7 @@ body { color: var(--page-fg); font-weight: bold; height: 48px; + font-family: var(--title-font-families); } .fullwidthlink .linkname { @@ -163,7 +166,7 @@ body { color: var(--tag-fg); font-size: 18px; padding: 0; - font-family: "JetBrains Mono", monospace; + font-family: var(--tag-font-families); user-select: none; cursor: pointer; } @@ -181,7 +184,7 @@ body { height: 32px; padding: 8px; box-sizing: border-box; - font-family: "JetBrains Mono", monospace; + font-family: var(--font-families); font-size: 18px; border: 2px var(--general-fg) solid; background-color: var(--general-bg); @@ -206,7 +209,7 @@ body { white-space: nowrap; overflow: hidden; box-sizing: border-box; - font-family: "JetBrains Mono", monospace; + font-family: var(--font-families); font-size: 18px; border: 2px var(--general-fg) solid; background-color: var(--general-bg); @@ -222,7 +225,6 @@ body { overflow: hidden; padding: 0; box-sizing: border-box; - font-family: "JetBrains Mono", monospace; font-size: 18px; border-radius: 0 8px 8px 0; color: var(--general-bg); @@ -254,12 +256,11 @@ body { #sidebar { position:relative; left: 0; +} +#sidebar[data-okanimate] { transition: left 0.25s, width 0.25s; } -#sidebar .overinput { - transition: left 0.25s, width 0.25s; -} -#body { +#body[data-okanimate] { transition: grid-template-columns 0.25s; } @@ -282,10 +283,10 @@ body { grid-template-columns: 0px auto; } - #body.sidebarOpen { + #body[data-sidebar-open="true"] { grid-template-columns: 300px auto; } - #body.sidebarOpen #sidebar { + #body[data-sidebar-open="true"] #sidebar { position:relative; left: 0; } @@ -301,7 +302,6 @@ body { } #sidebar { - left: -800px !important; width: 100vw !important; } @@ -309,19 +309,11 @@ body { width: calc(100vw - 46px) !important; } - #body { + #body[data-sidebar-open="true"] { grid-template-columns: 0px auto; } - #body.sidebarOpen { - grid-template-columns: 0px auto; - } - - #sidebar, #sidebar .overinput { - transition: left 0.25s, width 0s !important; - } - - #body.sidebarOpen #sidebar { + #body[data-sidebar-open="true"] #sidebar { left: 0 !important; } } \ No newline at end of file diff --git a/assets/system/page.css b/assets/system/page.css index 98bee93..4463462 100644 --- a/assets/system/page.css +++ b/assets/system/page.css @@ -3,6 +3,7 @@ border-bottom: 2px solid var(--main); color: var(--main); font-size: 32px; + font-family: var(--title-font-families); margin: 16px 0; } #page h2 { @@ -12,6 +13,7 @@ width: 100%; color: var(--main); font-size: 24px; + font-family: var(--title-font-families); margin: 16px 0; } #page p { @@ -26,4 +28,9 @@ } #page a { color: var(--main); +} +#page code { + background-color: var(--general-bg); + padding: 2px; + border-radius: 4px; } \ No newline at end of file diff --git a/assets/system/searchNodes.js b/assets/system/searchNodes.js index 1b1562d..f71a7b8 100644 --- a/assets/system/searchNodes.js +++ b/assets/system/searchNodes.js @@ -2,15 +2,15 @@ var page = document.getElementById("page"); var search = document.getElementById("searchbar"); var overinput = document.querySelector(".overinput"); var clearinput = document.querySelector(".clearinput"); +var bodyele = document.getElementById("body"); var searchNodes = [...document.getElementById("searchNodes").children]; var searchNodesCont = document.getElementById("searchNodes"); var sbheader = document.getElementById("sbheader"); -search.addEventListener('input', onsearch); - function onsearch () { - search.value = search.value.replace(/Redirects to /i, "|=> " ); - search.value = search.value.replace(/Redirects /i, "|=> "); + search.value = search.value.replace(/^Redirects to /i, ">> " ); + search.value = search.value.replace(/^Redirects /i, ">> "); + search.value = search.value.replace(/^\>\> to /i, ">> " ); if (sessionStorage.getItem("searchvalue") === "()" && search.value === ")") search.value = ""; if (sessionStorage.getItem("searchvalue") === "()" && search.value === "(") @@ -30,10 +30,10 @@ function onsearch () { searchNodes.forEach(child => child.style.display = "") } - var value = search.value.replace(/>/g, ">").replace(/")) { + var value = search.value.replace(/>/g, ">").replace(/>")) { overinput.style.display = "inline-block"; - overinput.innerHTML = "Redirects " + (search.value.length > 4 && search.value !== "|=> " ? search.value.replace(/^\|\=\>/, "to ") : ""); + overinput.innerHTML = "Redirects " + (search.value.length > 3 && search.value !== ">> " ? search.value.replace(/^\>\>/, "to ") : ""); searchNodes.forEach(child => { child.style.display = "none"; var name = child.querySelector(".linkname"); @@ -66,29 +66,8 @@ function onsearch () { sessionStorage.setItem("searchvalue", search.value); }; -function toggleSidebar() { - document.querySelector('#body').classList.toggle('sidebarOpen'); - sessionStorage.setItem("sidebar", document.querySelector("#body").className); -} - -function opensearch(sq) { - search.value = sq; - onsearch(); - document.querySelector('#body').classList.add('sidebarOpen'); - sessionStorage.setItem("sidebar", document.querySelector("#body").className); -} - -if (window.innerWidth > 800) { - document.querySelector("#body").className = sessionStorage.getItem("sidebar"); -} search.value = sessionStorage.getItem("searchvalue"); -onsearch(); - -overinput.addEventListener("click", () => { - search.focus(); -}) - -clearinput.addEventListener("click", () => { - search.value = ""; - onsearch(); -}) \ No newline at end of file +search.addEventListener('input', onsearch); +overinput.addEventListener("click", () => {search.focus();}); +clearinput.addEventListener("click", () => {search.value = "";onsearch();}); +onsearch(); \ No newline at end of file diff --git a/assets/system/sidebar.js b/assets/system/sidebar.js new file mode 100644 index 0000000..0feda68 --- /dev/null +++ b/assets/system/sidebar.js @@ -0,0 +1,23 @@ +var bodyele = document.getElementById("body"); +var sidebarele = document.getElementById("sidebar"); +function toggleSidebar(override) { + bodyele.dataset.sidebarOpen = override ?? (bodyele.dataset.sidebarOpen == "false"); + sessionStorage.setItem("sidebar", bodyele.dataset.sidebarOpen); +} +function opensearch(sq) { + search.value = sq; + onsearch(); + toggleSidebar(true); +} +if (window.innerWidth > 800) { + bodyele.dataset.sidebarOpen = sessionStorage.getItem("sidebar") == "true"; +} else { + bodyele.dataset.sidebarOpen = true; + setTimeout(() => { + bodyele.dataset.sidebarOpen = false; + }, 1) +} +setTimeout(() => { + sidebarele.dataset.okanimate = true; + bodyele.dataset.okanimate = true; +}, 1) \ No newline at end of file diff --git a/index.js b/index.js index fdf1107..f9f6ce8 100644 --- a/index.js +++ b/index.js @@ -6,34 +6,51 @@ var app = express(); app.set('view engine', 'ejs'); app.use("/a", express.static(path.join(__dirname, 'assets'))); app.use("/assets", express.static(path.join(__dirname, 'assets', "Files"))); +var templateIndex = (x, y) => ({"type": "page","pageName": x,"pageData": y,"allPages": pages}); +var templateErrPage = (sc) => ({"tags": ["Meta",sc],"location": "system/" + sc}); +var templateTag = (x, y) => ({"shortname": x,"color": y}); +var pages; +var getPages = () => { + var __pg = JSON.parse(fs.readFileSync(path.join(__dirname, "views", "pages.json"), 'utf8')); + __pg.tags["Meta"] = templateTag("//","#808080"); + __pg.tags["404"] = templateTag("404","#008000"); + __pg.tags["500"] = templateTag("500","#FF0080"); + __pg.wikiData.fullName = __pg.wikiData.name.join(" "); + pages = __pg; +} +setInterval(getPages, 10000); +getPages(); -var getPages = () => JSON.parse(fs.readFileSync(path.join(__dirname, "views", "pages.json"), 'utf8')); var getPage = (page) => { - var pageindexes = getPages(); - console.log(pageindexes.pages, page, pageindexes.pages[page]); - if (pageindexes.pages[page].link.redirect) - return getPage(pageindexes.pages[page].link.location); - return { - name: page, - page: pageindexes.pages[page], - all: pageindexes + if (!(pages.pages[page] || pages.redirects[page])) return { + type: "invaildrequest" }; + if (pages.redirects[page]) return { + type: "redirect", + page: pages.redirects[page] + }; + return templateIndex(page, pages.pages[page]); } +app.get('/', (_,r) => r.redirect("/wiki/Welcome")); +app.get('/wiki', (_,r) => r.redirect("/wiki/Welcome")); + app.get('/wiki/:page', function(req, res, next) { - try { - if (!getPages().pages[req.params.page]) next(); - var page = getPage(req.params.page); - res.render('index', page); - } catch (error) { - next(error); + var page = getPage(req.params.page); + switch (page.type) { + case "invaildrequest": + next(); + break; + case "redirect": + res.redirect(page.page); + break; + case "page": + res.render('index', page, (err, html) => { + if (err) res.status(500).render('index', templateIndex("500_Internal_Server_Error", templateErrPage("500"))); + else res.send(html); + }); } }); -app.use(function(req,res){ - res.status(404).render('index', getPage("404_Not_Found")); -}); - -app.listen(8080, () => { - console.log('Server is listening on port 8080'); -}); +app.use((_,r) => r.status(404).render('index', templateIndex("404_Not_Found", templateErrPage("404")))); +app.listen(80, () => console.log('http://127.0.0.1:80/')); diff --git a/views/articles/Installation.ejs b/views/articles/Installation.ejs new file mode 100644 index 0000000..b01e185 --- /dev/null +++ b/views/articles/Installation.ejs @@ -0,0 +1,16 @@ +

Welcome to the AWE installation guide!

+

This guide will assist you while installing the Avalon Wiki Engine on a local server.

+

Make sure you have your 80 port open on this server.

+<%- include("blocks/MessageBox.ejs", { + title: "Docker support", + content: "This guide will not contain resources for installing AWE on Docker. You are purely on your own for that." +}) %> +

Installing locally or on a Node server

+

If you just want AWE for your local network, or on your own real server.

+

Installing on Replit

+

If you want quickly get AWE up and running.

+<%- include("blocks/MessageBox.ejs", { + title: "Cycles required", + content: "In order to use AWE on Replit, you will have to use Cycles to make your AWE Repl Always On.", + notice: "2 cycles/day for Always On" +}) %> \ No newline at end of file diff --git a/views/articles/Sandbox.ejs b/views/articles/Sandbox.ejs deleted file mode 100644 index bdd8e7b..0000000 --- a/views/articles/Sandbox.ejs +++ /dev/null @@ -1,24 +0,0 @@ -<%- include("blocks/MessageBox.ejs", { - title: "Hello, world!", - content: "Sex is real and it's a danger to society", - notice: "This is a small notice." -}) %> -<%- include("blocks/MessageBox.ejs") %> -

Header 1

-

This is a paragraph. Hello!

-

Header 2

-

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deleniti cumque aut, natus labore id voluptate quaerat hic enim tempore est sed sunt, sint praesentium culpa illum, ea autem modi! Expedita!

-

Header 3

-Psssst! I'm small! -<%- include("blocks/LunchBox.ejs", { - width: "200", - imageURL: "/assets/ramin1.png", - fullName: "Ramin", - pronouns: "she/her, they/them", - birthday: "April 13, 2026", - gender: "Female", - preference: "Pansexual", - attribution: "Avalonian Vineyards", - description: `Ramin is a FUCK.` -}) %> -<%- include("blocks/LunchBox.ejs") %> \ No newline at end of file diff --git a/views/articles/Searching.ejs b/views/articles/Searching.ejs new file mode 100644 index 0000000..96c79b2 --- /dev/null +++ b/views/articles/Searching.ejs @@ -0,0 +1,35 @@ +

Searching in the Avalon Wiki Engine is possible.

+

Use the searchbar element on the top-left to type text in and look for articles using a filter.

+

Search methods

+

Searching by name

+

This is the default behaviour, typing in a name, and getting your result.

+

Simply type QUERY (replace "QUERY" with your desired search) into the searchbar.

+

Searching by tag

+

Searching for articles using their tag is also very easy.

+

Simply wrap your tag name search in parentheses, like this: (QUERY)

+

There are two ways to search for a tag name:

+ +

Searching for redirects

+

Searching for redirects is enabled by default when searching, but there's another mode where you can search for redirects only.

+

Make your search a >>, like this: >>

+

Use two greater than symbols (>) to write the entire thing.

+

If you want to search for redirects that lead to a specific page, you can type >> QUERY, adding an article page (not tag) at the very end.

+

Shortcuts (Longcuts?)

+

Tagged

+Tagged QUERY +(QUERY +

Redirects

+Redirects QUERY +Redirects to QUERY +>> to QUERY +

Preventing shortcut corrections

+

Preventing corrections is easy, simply put a \ anywhere within your query to cancel a redirect.

+

For example, if the article you want to look for is called "Redirects and Tags", the Redirects QUERY shortcut would not let you type Redirects .

+

So, you can simply cancel the shortcut by placing a \ anywhere it would block a shortcut - usally at the start or in the middle of the word.

+\Redirects +\( +\Redirects to +\Tagged \ No newline at end of file diff --git a/views/articles/Welcome.ejs b/views/articles/Welcome.ejs index 27cd344..262c8e9 100644 --- a/views/articles/Welcome.ejs +++ b/views/articles/Welcome.ejs @@ -1,10 +1,11 @@ <%- include("blocks/MessageBox.ejs", { title: "Welcome!", - content: "Welcome to the Avalonian Districts Wiki!" + content: "Welcome to the " + allPages.wikiData.fullName + " development resource!" }) %> -

Avalonian Districts Wiki

-

This wiki is dedicated to making a public resource of all MikeyLore and Avalonian Vineyards content.

+

<%- allPages.wikiData.fullName %>

+

The Avalon Wiki Engine (also known as AWE) is a free and open-source piece of software, that lets site administrators manage content in a simple format.

About

-

The wiki is run by MikeyHX and RaminDetergent, and so is the lore. We are the admins of this page, and unlike normal wikis, this wiki is only editable through the source code. Feel free to look through it, I guess?

-

The Avalon Wiki Engine

-

Shortcuts for the Avalon Wiki Engine can be found here.

\ No newline at end of file +

The Avalon Wiki Engine is a bit tacky, but it functions well, allowing end users to easily navigate content, with fancy tricks like searching - by name or by tags.

+

Formatting is based on individual EJS files - see ejs.co for more info on EJS templating.

+

Installation and Source

+

An installation guide can be found at Installation.

\ No newline at end of file diff --git a/views/index.ejs b/views/index.ejs index dd2dddc..af22ff8 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -1,5 +1,5 @@ - + @@ -10,45 +10,59 @@ - + + +
- <%- name.replace(/_/g, " ") %> + <%- pageName.replace(/_/g, " ") %>
- <% page.tags.forEach(function(tagname){ %> + <% pageData.tags.forEach(function(tag){ %> <%- include("system/tag", { - implcl: locals, - tagname + allPages, + tag }) %> <% }); %>
- <%- include(page.link.location); %> + <%- include(pageData.location); %>
+ \ No newline at end of file diff --git a/views/pages.json b/views/pages.json index 4a8df07..fa44f8a 100644 --- a/views/pages.json +++ b/views/pages.json @@ -1,61 +1,45 @@ { + "wikiData": { + "name": [ + "Avalon", + "Wiki Engine" + ] + }, "tags": { - "404": { - "shortname": "404", - "color": "#008000" + "Accessibility": { + "shortname": "ACC", + "color": "#000080" }, - "MikeyLore": { - "shortname": "MLR", - "color": "#0080ff" + "Help": { + "shortname": "HLP", + "color": "#ff0080" }, - "Avalonian_Vineyards": { - "shortname": "AVY", - "color": "#35ff00" - }, - "Avalonian_Districts": { - "shortname": "M+A", - "color": "#1BC080" - }, - "Meta": { - "shortname": "//", - "color": "#808080" + "Installation_Guide": { + "shortname": "INS", + "color": "#000000" } }, + "redirects": { + "Searchbar": "Searching" + }, "pages": { - "Welcome!": { + "Welcome": { "tags": [ - "Avalonian_Districts", "Meta" ], - "color": "#808080", - "link": { - "redirect": false, - "location": "articles/Welcome" - } + "location": "articles/Welcome" }, - "Sandbox": { + "Searching": { "tags": [ - "Avalonian_Districts", - "Meta" + "Help" ], - "hidden": true, - "color": "#808080", - "link": { - "redirect": false, - "location": "articles/Sandbox" - } + "location": "articles/Searching" }, - "404_Not_Found": { + "Installation": { "tags": [ - "Meta", - "404" + "Help", "Installation_Guide" ], - "hidden": true, - "color": "#000000", - "link": { - "redirect": false, - "location": "articles/404" - } + "location": "articles/Installation" } } } diff --git a/views/articles/404.ejs b/views/system/404.ejs similarity index 100% rename from views/articles/404.ejs rename to views/system/404.ejs diff --git a/views/system/500.ejs b/views/system/500.ejs new file mode 100644 index 0000000..e8d3aa8 --- /dev/null +++ b/views/system/500.ejs @@ -0,0 +1,4 @@ +There was an internal server error while rendering this article.
+Possibly, this article's page index exists, but it is redirecting to or referencing a non-existent article.
+
+If possible, please notify the wiki managers. \ No newline at end of file diff --git a/views/system/fullwidth.ejs b/views/system/fullwidth.ejs index 9a710ff..e46a020 100644 --- a/views/system/fullwidth.ejs +++ b/views/system/fullwidth.ejs @@ -1,15 +1,15 @@ -