]> jfr.im git - uguu.git/commitdiff
refactoring v.1.5.4
authorGo Johansson (neku) <redacted>
Sat, 16 Jul 2022 06:24:58 +0000 (08:24 +0200)
committerGo Johansson (neku) <redacted>
Sat, 16 Jul 2022 06:24:58 +0000 (08:24 +0200)
* Ko-Fi donation button added.
* Templating now uses ejs instead of swig.
* clean-css/uglify-js replaced with minify-all.
* Minor PHP changes.
* Preparations for major refactor.

28 files changed:
.travis.yml [deleted file]
Makefile
dist.json
package.json
static/css/uguu.css
static/img/kofi.png [new file with mode: 0644]
static/php/includes/Core.namespace.php
static/php/includes/Upload.class.php
templates/banners.swig [deleted file]
templates/banners/donations.swig [deleted file]
templates/banners/malware_scans.swig [deleted file]
templates/faq.ejs [new file with mode: 0644]
templates/faq.swig [deleted file]
templates/index.ejs [new file with mode: 0644]
templates/index.swig [deleted file]
templates/layout.swig [deleted file]
templates/layout_index.swig [deleted file]
templates/nav.swig [deleted file]
templates/partials/donation_banner.ejs [new file with mode: 0644]
templates/partials/footer.ejs [new file with mode: 0644]
templates/partials/header.ejs [new file with mode: 0644]
templates/partials/lead.ejs [new file with mode: 0644]
templates/partials/malware_banner.ejs [new file with mode: 0644]
templates/partials/nav.ejs [new file with mode: 0644]
templates/partials/upload_form.ejs [new file with mode: 0644]
templates/tools.ejs [new file with mode: 0644]
templates/tools.swig [deleted file]
templates/upload_form.swig [deleted file]

diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644 (file)
index 8c559e0..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-language: php
-php:
-  - '7.2'
-  - '7.3'
-  - '7.4'
-
-install:
-- source ~/.nvm/nvm.sh 
-- nvm ls-remote
-- nvm install stable
-- nvm use stable
-script:
-- make 
-
index 775203530f91a0e4dbb67fd662cff84e9ed277c5..18b06d6bd8c8a8a97a1a0f8d9bb5e6a95c79c45e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -4,8 +4,11 @@ TAR="tar"
 GREP="grep"
 NODE="node"
 NPM="npm"
-DESTDIR="./dist"
-PKG_VERSION := $( $(GREP) -Po '(?<="version": ")[^"]*' )
+NODEJQ="node_modules/node-jq/bin/jq"
+CONF="dist.json"
+DESTDIR = $(shell $(CURDIR)/$(NODEJQ) -r ".dest" $(CURDIR)/$(CONF))
+NPX="npx"
+PKG_VERSION = $(shell $(CURDIR)/$(NODEJQ) -r ".version" $(CURDIR)/package.json)
 TMPDIR := $(shell mktemp -d)
 DOCKER_IMAGE = "$(shell basename $(CURDIR) | tr [:upper:] [:lower:])"
 DOCKER_TAG="$(DOCKER_TAG)"
@@ -13,17 +16,19 @@ CONTAINER_NAME="$(CONTAINER_NAME)"
 # default modules
 MODULES="php"
 
-all: builddirs npm_dependencies swig htmlmin min-css min-js copy-img submodules
-       
-swig:
-       $(NODE) node_modules/swig/bin/swig.js render -j dist.json templates/faq.swig > $(CURDIR)/build/faq.html 
-       $(NODE) node_modules/swig/bin/swig.js render -j dist.json templates/index.swig > $(CURDIR)/build/index.html 
-       $(NODE) node_modules/swig/bin/swig.js render -j dist.json templates/tools.swig > $(CURDIR)/build/tools.html 
+pageList = $(shell $(CURDIR)/$(NODEJQ) -r ".pages[]" $(CURDIR)/$(CONF))
+noExt = $(shell echo $(i) | cut -d '.' -f1)
+
+all: builddirs npm_dependencies ejs minify-all copy-img submodules
+
+ejs:
+       $(foreach i,$(pageList), \
+       $(NPX) ejs -f $(CURDIR)/$(CONF) $(CURDIR)/templates/$(i) -o $(CURDIR)/build/tmp/html/$(noExt).html;)
 
-htmlmin:
-       $(NODE) node_modules/htmlmin/bin/htmlmin $(CURDIR)/build/index.html -o $(CURDIR)/build/index.html 
-       $(NODE) node_modules/htmlmin/bin/htmlmin $(CURDIR)/build/faq.html -o $(CURDIR)/build/faq.html 
-       $(NODE) node_modules/htmlmin/bin/htmlmin $(CURDIR)/build/tools.html -o $(CURDIR)/build/tools.html 
+minify-all:
+       $(NPX) minify-all-cli -s $(CURDIR)/build/tmp/html/ -d $(CURDIR)/build/html
+       $(NPX) minify-all-cli -s $(CURDIR)/static/js -d $(CURDIR)/build/js
+       $(NPX) minify-all-cli -s $(CURDIR)/static/css -d $(CURDIR)/build/css
 
 installdirs:
        mkdir -p $(DESTDIR)/ $(DESTDIR)/img
@@ -34,15 +39,6 @@ endif
 ifneq (,$(findstring moe,$(MODULES)))
        mkdir -p $(DESTDIR)/moe/{css,fonts,includes,js,login,panel/css/font,panel/css/images,register,templates}
 endif
-       
-min-css:
-       $(NODE) $(CURDIR)/node_modules/.bin/cleancss $(CURDIR)/static/css/uguu.css --output $(CURDIR)/build/uguu.min.css
-
-min-js:
-       echo "// @source https://github.com/nokonoko/uguu/tree/master/static/js" > $(CURDIR)/build/uguu.min.js 
-       echo "// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat" >> $(CURDIR)/build/uguu.min.js
-       $(NODE) $(CURDIR)/node_modules/.bin/uglifyjs ./static/js/app.js >> $(CURDIR)/build/uguu.min.js 
-       echo "// @license-end" >> $(CURDIR)/build/uguu.min.js
 
 copy-img:
        cp -v $(CURDIR)/static/img/*.png $(CURDIR)/build/img/
@@ -55,16 +51,17 @@ else
        $(error The php submodule was not found)
 endif
 
-copy-moe:
-ifneq ($(wildcard $(CURDIR)/moe/.),)
-       cp -rv $(CURDIR)/moe $(CURDIR)/build/
-else
-       $(error The moe submodule was not found)
-endif
-
 install: installdirs
        cp -rv $(CURDIR)/build/* $(DESTDIR)/
-
+       mv $(DESTDIR)/html/* $(DESTDIR)/
+       mv $(DESTDIR)/js/* $(DESTDIR)/
+       mv $(DESTDIR)/css/* $(DESTDIR)/
+       rm -rf $(DESTDIR)/html
+       rm -rf $(DESTDIR)/css
+       rm -rf $(DESTDIR)/js
+       rm -rf $(DESTDIR)/tmp
+       mv $(DESTDIR)/uguu.css $(DESTDIR)/uguu.min.css
+       mv $(DESTDIR)/app.js $(DESTDIR)/uguu.min.js
 dist:
        DESTDIR=$(TMPDIR)/uguu-$(PKGVERSION)
        export DESTDIR
@@ -95,7 +92,7 @@ purge-container:
        fi;             
 
 builddirs:
-       mkdir -p $(CURDIR)/build $(CURDIR)/build/img 
+       mkdir -p $(CURDIR)/build $(CURDIR)/build/img $(CURDIR)/build/tmp $(CURDIR)/build/tmp/html
 ifneq (,$(findstring php,$(MODULES)))
        mkdir -p $(CURDIR)/build/classes $(CURDIR)/build/includes
 endif
index 38e8d1757a465cde8f822daf0ffedfc6ef48a16e..653738ce0e7d0c6b716c5432c68ce2103812528e 100644 (file)
--- a/dist.json
+++ b/dist.json
@@ -3,30 +3,28 @@
     "allowErrors": false
   },
   "dest": "dist",
-  "pkgVersion": "1.5.3",
-  "banners": [
-    "banners/malware_scans.swig",
-    "banners/donations.swig"
+  "pkgVersion": "1.5.4",
+  "pages": [
+    "index.ejs",
+    "faq.ejs",
+    "tools.ejs"
   ],
-  "src": [
-    "templates/index.swig",
-    "templates/faq.swig",
-    "templates/tools.swig"
-  ],
-  "generateRobotstxt": false,
-  "generateSitemap": false,
   "max_upload_size": 128,
-  "production": false,
-  "siteName": "SITENAME",
-  "siteUrl": "https://yoursite.com",
+  "expireTime": "24H",
+  "siteName": "sitename",
+  "subTitle": "site title",
+  "siteUrl": "https://uguu.se",
   "abuseContact": "abuse@example.com",
   "infoContact": "info@example.com",
   "ServerCountryLocation": "Sweden",
   "SiteMetaInfo": "SITENAME is a temporary file hosting service, upload files up to 128MiB for 24 hours.",
   "ToolsDesc": "The following tools might need editing to work on this clone of Uguu, usually editing the URL works.",
+  "donationBanner": true,
   "paypalUrl": "",
   "bitcoinAddress": "",
   "flattrUrl": "",
+  "kofiUrl": "",
+  "malwareBanner": true,
   "DB_MODE": "sqlite",
   "DB_PATH": "/var/www/db/uguu.sq3",
   "DB_USER": "NULL",
@@ -35,6 +33,7 @@
   "ANTI_DUPE": false,
   "BLACKLIST_DB": true,
   "FILTER_MODE": true,
+  "RATE_LIMIT": true,
   "FILES_ROOT": "/var/www/files/",
   "FILES_RETRIES": 15,
   "SSL": true,
index 6a389b425c64b18165bbbd9930685e181abdb1b8..6a38ba5e253eb75ed820e4f36f550a1a08769caa 100644 (file)
@@ -1,6 +1,6 @@
 {
   "name": "uguu",
-  "version": "1.5.3",
+  "version": "1.5.4",
   "description": "Kawaii file host",
   "homepage": "https://uguu.se/",
   "repository": {
   "bugs": {
     "url": "https://github.com/nokonoko/uguu/issues"
   },
-  "devDependencies": {
-    "clean-css": "^5.1.2",
-    "clean-css-cli": "^5.3.0",
-    "uglify-js": "^3.13.9",
-    "swig": "^1.4.2"
-  },
   "dependencies": {
-    "htmlmin": "0.0.6"
+    "ejs": "^3.1.8",
+    "minify-all-cli": "^1.0.13",
+    "node-jq": "^2.3.3"
   }
 }
index 93c7fd32faeb3f2b4f66d1e9139f48b416776490..d48962b3b83bfec4b7038ccc2d1342505d469d4b 100644 (file)
@@ -189,6 +189,9 @@ a.donate-btn:hover {
 .icon-flattr {
   background-image: url('img/flattr.png');
 }
+.icon-kofi {
+  background-image: url('img/kofi.png');
+}
 
 /**
  * NAVIGATION LINKS
diff --git a/static/img/kofi.png b/static/img/kofi.png
new file mode 100644 (file)
index 0000000..9bf37ba
Binary files /dev/null and b/static/img/kofi.png differ
index 1626ff2e006b55d6ec42f16a6a6487a2b078be68..fcd1d50af12c864c5e35031c3ab27767f93dac89 100644 (file)
@@ -350,7 +350,7 @@ namespace Core {
                 $q->bindValue(':orig', Upload::$FILE_NAME, PDO::PARAM_STR);
                 $q->bindValue(':name', Upload::$NEW_NAME_FULL, PDO::PARAM_STR);
                 $q->bindValue(':size', Upload::$FILE_SIZE, PDO::PARAM_INT);
-                $q->bindValue(':date', time(), PDO::PARAM_STR);
+                $q->bindValue(':date', time(), PDO::PARAM_INT);
                 $q->bindValue(':ip', Upload::$IP, PDO::PARAM_STR);
                 $q->execute();
             } catch (Exception) {
index 9fb5e0fd5be58943bf71f47690b55e3170d16858..d0b52b6ea01b72f40947248bf800265953138916 100644 (file)
@@ -121,19 +121,6 @@ class Upload
         ];
     }
 
-    public static function getIP()
-    {
-        if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
-            self::$IP = $_SERVER['HTTP_CLIENT_IP'];
-        }
-        if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
-            self::$IP = $_SERVER['HTTP_X_FORWARDED_FOR'];
-        }
-        if (!isset(self::$IP)) {
-            self::$IP = $_SERVER['REMOTE_ADDR'];
-        }
-    }
-
     public static function fileInfo()
     {
         if (isset($_FILES['files'])) {
@@ -149,7 +136,7 @@ class Upload
             }
 
             if (Settings::$LOG_IP) {
-                self::getIP();
+                self::$IP = $_SERVER['REMOTE_ADDR'];
             } else {
                 self::$IP = null;
             }
diff --git a/templates/banners.swig b/templates/banners.swig
deleted file mode 100644 (file)
index 59b72e8..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-{% for banner in banners %}
-       {% include banner %}
-{% endfor %}
diff --git a/templates/banners/donations.swig b/templates/banners/donations.swig
deleted file mode 100644 (file)
index 98c5418..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<p class="alert alert-info">
-       <strong>{{siteName}} is free to use, but our hosting costs are far from it</strong> &mdash; donations are what keep {{siteName}} alive, free, and fast.</strong>
-       <span class="donate-btns">
-               {% if paypalUrl != '' %}
-                       <a class="donate-btn donate-paypal" href="{{paypalUrl}}" target="_BLANK">
-                               <span class="icon icon-paypal"></span>
-                               PayPal
-                       </a>
-               {% endif %}
-               {% if bitcoinAddress != '' %}
-                       <a class="donate-btn donate-bitcoin" href="bitcoin:{{bitcoinAddress}}?label={{siteName}}&amp;message=Hosting%20Costs" target="_BLANK">
-                               <span class="icon icon-bitcoin"></span>
-                               Bitcoin
-                       </a>
-               {% endif %}
-               {% if flattrUrl != '' %}
-                       <a class="donate-btn donate-flattr" href="{{flattrUrl}}" target="_BLANK">
-                               <span class="icon icon-flattr"></span>
-                               Flattr
-                       </a>
-               {% endif %}
-       </span>
-</p>
diff --git a/templates/banners/malware_scans.swig b/templates/banners/malware_scans.swig
deleted file mode 100644 (file)
index 1555dca..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-<p class="alert alert-error">
-       <strong>Malware is not allowed</strong> &mdash; files identified as malware will be removed without further notice.
-</p>
diff --git a/templates/faq.ejs b/templates/faq.ejs
new file mode 100644 (file)
index 0000000..efdb8c5
--- /dev/null
@@ -0,0 +1,64 @@
+<%- include('./templates/partials/header.ejs'); -%>
+<div class="container">
+    <article>
+        <div class="jumbotron">
+            <h1>
+                <abbr title="Frequently asked questions">FAQ</abbr>
+            </h1>
+        </div>
+        <div class="alert alert-info">
+            <h2>What is <%= siteName %>?</h2>
+            <p><%= siteName %> is a simple to use free file hosting service where files get
+                deleted after <%= expireTime %>. It lets you share your photos, documents, music, videos and more with
+                others online.</p>
+            <h2>What files are allowed?</h2>
+            <p>Any kind of file is allowed, as long as the file is legal in <%= ServerCountryLocation %> and you have the legal
+                right to publish the file on our service.</p>
+            <p>As an exception to this policy to prevent abuse, we do not allow malware on our service. Any malware that
+                could be used to infect other computers may be removed from our service at our discretion.</p>
+            <h2>Do you keep logs of uploaded files?</h2>
+            <% if (LOG_IP) { %>
+                <p>A database of the current active files are kept which includes the name, hash and IP of the file and time of upload,
+                    this data is deleted when the file expires.</p>
+            <% } else { %>
+            <p>A database of the current active files are kept which includes the name and hash of the file and time of upload,
+                this data is deleted when the file expires.</p>
+            <% } %>
+            <p>Downloads and visits are not tracked or logged in respect for your privacy.</p>
+            <h2>Can you remove my copyrighted file?</h2>
+            <p>
+                Please submit your copyright takedown notice to
+                <a href="mailto:<%= abuseContact %>"><%= abuseContact %></a>
+                . We will
+                handle your notice within <%= expireTime %> and disable access to the infringing file after receiving a notice
+                compliant with the Copyright Act.
+            </p>
+            <h2>Can you remove files that are defaming me or otherwise infringing my non-copyright rights?</h2>
+            <p>
+                <%= siteName %> respects takedowns for other files when accompanied with a certified <%= ServerCountryLocation %> court order. If
+                you are unable to obtain the order, a preliminary injuction or court order is typically also sufficient.
+                Please forward the notice to
+                <a href="mailto:<%= abuseContact %>"><%= abuseContact %></a>
+                .
+            </p>
+            <h2>Can you remove illegal files?</h2>
+            <p>Please contact the appropriate law enforcement agency if you notice illegal files hosted on <%= siteName %>. We
+                have not been trained or qualified to investigate and fight crimes and enforce the law, so it's not
+                appropriate to send accusations of illegal activity to us.</p>
+            <p>
+                You must contact the appropriate law enforcement office. They may then contact us if appropriate.
+                If you are an law enforcement official and you need our assistance, please contact
+                <a href="mailto:<%= abuseContact %>"><%= abuseContact %></a>
+                . If you are a law enforcement official from another
+                country, we may voluntarily cooperate if the crime you are investigating would also be illegal in
+                <%= ServerCountryLocation %>.
+            </p>
+            <h2>I have a question...</h2>
+
+            Send an email to
+            <a href="mailto:<%= infoContact %>"><%= infoContact %></a>
+            .
+
+        </div>
+    </article>
+<%- include('./templates/partials/footer.ejs'); -%>
\ No newline at end of file
diff --git a/templates/faq.swig b/templates/faq.swig
deleted file mode 100644 (file)
index 594d638..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-{% extends "layout.swig" %}
-
-{% block title %}FAQ{% endblock %}
-{% block body %}
-<article>
-       <div class="jumbotron">
-               <h1><abbr title="Frequently asked questions">FAQ</abbr></h1>
-       </div>
-       <div class="alert alert-info">
-       <h2>What is {{siteName}}?</h2>
-       <p><span role="definition"><dfn>{{siteName}}</dfn> is a simple to use free file hosting service.</span> It lets you share your photos, documents, music, videos and more with others online for 24 hours.</p>
-       <h2>What files are allowed?</h2>
-       <p>{{siteName}} welcomes uploading all files, as long as the file is legal in {{ServerCountryLocation}} and you have the legal right to publish the file on our service.</p>
-       <p>As an exception to this policy to prevent abuse, we do not allow malware on our service. Any malware that could be used to infect other computers may be removed from our service at our discretion.</p>
-       <h2>Can you remove my copyrighted file?</h2>
-       <p>Please submit your copyright takedown notice to <a href="mailto:{{abuseContact}}">{{abuseContact}}</a>. We will handle your notice within 24 hours and disable access to the infringing file after receiving a notice compliant with the Copyright Act 1968.</p>
-       <h2>Can you remove files that are defaming me or otherwise infringing my non-copyright rights?</h2>
-       <p>{{siteName}} respects takedowns for other files when accompanied with a certified {{ServerCountryLocation}} court order. If you are unable to obtain the order, a preliminary injuction or court order is typically also sufficient. Please forward the notice to <a href="mailto:{{abuseContact}}">{{abuseContact}}</a>.</p>
-       <h2>Can you remove illegal files?</h2>
-       <p>Please contact the appropriate law enforcement agency if you notice illegal files hosted on {{siteName}}. We have not been trained or qualified to investigate and fight crimes and enforce the law, so it's not appropriate to send accusations of illegal activity to us. <strong>You must contact the appropriate law enforcement office.</strong> They may then contact us if appropriate.</p>
-       <p>If you are an {{ServerCountryLocation}}law enforcement official and you need our assistance, please contact <a href="mailto:{{abuseContact}}">{{abuseContact}}</a>. If you are a law enforcement official from another country, we may voluntarily cooperate if the crime you are investigating would also be illegal in {{ServerCountryLocation}}.</p>
-       <h2>I have a question...</h2>
-       <p>Send us an email at <a href="mailto:{{infoContact}}">{{infoContact}}</a> and let's talk!</p>
-</div>
-</article>
-{% include "nav.swig" %}
-{% endblock %}
\ No newline at end of file
diff --git a/templates/index.ejs b/templates/index.ejs
new file mode 100644 (file)
index 0000000..ae7f6ff
--- /dev/null
@@ -0,0 +1,15 @@
+<%- include('./templates/partials/header.ejs'); -%>
+<div class="container">
+    <div class="jumbotron">
+        <%- include('./templates/partials/lead.ejs'); -%>
+        <%- include('./templates/partials/upload_form.ejs'); -%>
+    </div>
+
+    <% if (malwareBanner) { %>
+        <%- include('./templates/partials/malware_banner.ejs'); -%>
+    <% } %>
+
+    <% if (donationBanner) { %>
+        <%- include('./templates/partials/donation_banner.ejs'); -%>
+    <% } %>
+<%- include('./templates/partials/footer.ejs'); -%>
\ No newline at end of file
diff --git a/templates/index.swig b/templates/index.swig
deleted file mode 100644 (file)
index b997e0e..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "layout_index.swig" %}
-
-{% block body %}
-<div class="jumbotron">
-       <h1>{{siteName}}~</h1>
-       <p class="lead">Max upload size is {{max_upload_size}}&nbsp;MiB & files expire after 24H, read the <a href="faq.html"><abbr title="Frequently asked questions">FAQ</abbr></a></p>
-       {% include "upload_form.swig" %}
-</div>
-{% include "banners.swig" %}
-{% include "nav.swig" %}
-{% endblock %}
diff --git a/templates/layout.swig b/templates/layout.swig
deleted file mode 100644 (file)
index bb8fb0d..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-       <head>
-               <meta charset="utf-8">
-               <meta name="viewport" content="width=device-width, initial-scale=1">
-               <meta name="generator" content="Uguu {{pkgVersion}}">
-               <meta name="Description" content="{{SiteMetaInfo}}">
-               <title>{{siteName}} &middot; {% block title %}Kawaii Temporary File Hosting{% endblock %}</title>
-               <link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
-               <link rel="stylesheet" href="uguu.min.css">
-       </head>
-       <body>
-               <div class="container">
-                       {% block body %}What the fuck are you doing here, <span lang="jp">baka</span>?{% endblock %}
-               </div>
-       </body>
-</html>
diff --git a/templates/layout_index.swig b/templates/layout_index.swig
deleted file mode 100644 (file)
index 07fceb6..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-       <head>
-               <meta charset="utf-8">
-               <meta name="viewport" content="width=device-width, initial-scale=1">
-               <meta name="generator" content="Uguu {{pkgVersion}}">
-               <meta name="description" content="{{SiteMetaInfo}}">
-               <title>{{siteName}} &middot; {% block title %}Kawaii Temporary File Hosting{% endblock %}</title>
-               <link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
-               <link rel="stylesheet" href="uguu.min.css">
-               <script src="uguu.min.js"></script>
-       </head>
-       <body>
-               <div class="container">
-                       {% block body %}What the fuck are you doing here, <span lang="jp">baka</span>?{% endblock %}
-               </div>
-       </body>
-</html>
diff --git a/templates/nav.swig b/templates/nav.swig
deleted file mode 100644 (file)
index 9c0e44b..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<nav>
-       <ul>
-               <li><a href="/">{{siteName}}</a></li>
-               <li><a href="tools.html">Tools</a></li>
-               <li><a href="https://github.com/nokonoko/uguu">GitHub</a></li>
-       </ul>
-</nav>
diff --git a/templates/partials/donation_banner.ejs b/templates/partials/donation_banner.ejs
new file mode 100644 (file)
index 0000000..eae66fa
--- /dev/null
@@ -0,0 +1,36 @@
+<p class="alert alert-info">
+    <strong><%= siteName %> is free to use, but our hosting costs are not</strong>
+
+    &mdash; donations are what keep <%= siteName %> alive, free from ads and fast.
+
+    <span class="donate-btns">
+
+        <% if (bitcoinAddress) { %>
+            <a class="donate-btn donate-bitcoin" href="bitcoin:<%= bitcoinAddress %>?label=<%= siteName %>&amp;message=Hosting%20Costs" target="_BLANK">
+                    <span class="icon icon-bitcoin"></span>
+                                        Bitcoin
+                </a>
+        <% } %>
+
+            <% if (paypalUrl) { %>
+                <a class="donate-btn donate-paypal" href="<%= paypalUrl %>" target="_BLANK">
+                    <span class="icon icon-paypal"></span>
+                                        PayPal
+                </a>
+            <% } %>
+
+            <% if (flattrUrl) { %>
+                <a class="donate-btn donate-flattr" href="<%= flattrUrl %>" target="_BLANK">
+                    <span class="icon icon-flattr"></span>
+                                        Flattr
+                </a>
+            <% } %>
+
+            <% if (kofiUrl) { %>
+                <a class="donate-btn donate-kofi" href="<%= kofiUrl %>" target="_BLANK">
+                    <span class="icon icon-kofi"></span>
+                                        Ko-Fi
+                </a>
+            <% } %>
+            </span>
+</p>
\ No newline at end of file
diff --git a/templates/partials/footer.ejs b/templates/partials/footer.ejs
new file mode 100644 (file)
index 0000000..e2c13e2
--- /dev/null
@@ -0,0 +1,3 @@
+<%- include('./templates/partials/nav.ejs'); -%>
+</div>
+</body>
\ No newline at end of file
diff --git a/templates/partials/header.ejs b/templates/partials/header.ejs
new file mode 100644 (file)
index 0000000..6d88056
--- /dev/null
@@ -0,0 +1,9 @@
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<meta name="generator" content="Uguu <%= pkgVersion %>">
+<meta name="description" content="<%= SiteMetaInfo %>">
+<title><%= siteName %> &middot; <%= subTitle %></title>
+<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
+<link rel="stylesheet" href="uguu.min.css">
+<script src="uguu.min.js"></script>
+<body>
\ No newline at end of file
diff --git a/templates/partials/lead.ejs b/templates/partials/lead.ejs
new file mode 100644 (file)
index 0000000..3dc236c
--- /dev/null
@@ -0,0 +1,7 @@
+<h1><%= siteName %>~</h1>
+<p class="lead">
+    Max upload size is <%= max_upload_size %>&nbsp;MiB & files expire after <%= expireTime %>, read the
+    <a href="faq.html">
+        <abbr title="Frequently asked questions">FAQ</abbr>
+    </a>
+</p>
\ No newline at end of file
diff --git a/templates/partials/malware_banner.ejs b/templates/partials/malware_banner.ejs
new file mode 100644 (file)
index 0000000..5bee7e0
--- /dev/null
@@ -0,0 +1,4 @@
+<p class="alert alert-error">
+    <strong>Malware is not allowed</strong>
+    &mdash; files identified as malware will be removed without further notice.
+</p>
\ No newline at end of file
diff --git a/templates/partials/nav.ejs b/templates/partials/nav.ejs
new file mode 100644 (file)
index 0000000..12a2c4f
--- /dev/null
@@ -0,0 +1,13 @@
+<nav>
+    <ul>
+        <li>
+            <a href="/"><%= siteName %></a>
+        </li>
+        <li>
+            <a href="tools.html">Tools</a>
+        </li>
+        <li>
+            <a href="https://github.com/nokonoko/Uguu">Github</a>
+        </li>
+    </ul>
+</nav>
\ No newline at end of file
diff --git a/templates/partials/upload_form.ejs b/templates/partials/upload_form.ejs
new file mode 100644 (file)
index 0000000..129896c
--- /dev/null
@@ -0,0 +1,6 @@
+<form id="upload-form" enctype="multipart/form-data" method="post" action="upload.php?output=html">
+    <button id="upload-btn" class="btn" type="button">Drop or paste file(s)</button>
+    <input type="file" id="upload-input" name="files[]" multiple data-max-size="<%= max_upload_size %>MiB">
+    <input type="submit" value="Submit">
+</form>
+<ul id="upload-filelist"></ul>
\ No newline at end of file
diff --git a/templates/tools.ejs b/templates/tools.ejs
new file mode 100644 (file)
index 0000000..bb3bc90
--- /dev/null
@@ -0,0 +1,59 @@
+<%- include('./templates/partials/header.ejs'); -%>
+<div class="container">
+    <div class="jumbotron">
+        <h1><%= siteName %> Tools</h1>
+    </div>
+    <div class="alert alert-info">
+        <section>
+            <h3>
+                To upload using curl or make a tool you can post using:
+                <br>
+                curl -i -F files[]=@yourfile.jpeg <%= siteUrl %>/upload.php (JSON Response)
+            </h3>
+            <p>To upload using curl or make a tool you can post using: curl -i -F 'files[]=@yourfile.jpeg' <%= siteUrl %>/upload.php (JSON Response)</p>
+            <section>
+                <h2>ShareX</h2>
+                <dl>
+                    <dt>Download</dt>
+                    <dd>
+                        <a href="https://github.com/ShareX/ShareX">https://github.com/ShareX/ShareX</a>
+                    </dd>
+                </dl>
+            </section>
+            <h2>uguuecho</h2>
+            <dl>
+                <dt>Download</dt>
+                <dd>
+                    <a href="https://git.teknik.io/nekunekus/uguucho">https://git.teknik.io/nekunekus/uguucho</a>
+                </dd>
+            </dl>
+        </section>
+        <h2>pomfload</h2>
+        <dl>
+            <dt>Download</dt>
+            <dd>
+                <a href="https://github.com/ewhal/pomfload">https://github.com/ewhal/pomfload</a>
+            </dd>
+        </dl>
+        <section>
+            <h2>Pomfshare</h2>
+            <dl>
+                <dt>Download</dt>
+                <dd>
+                    <a href="https://github.com/Nyubis/Pomfshare">https://github.com/Nyubis/Pomfshare</a>
+                </dd>
+            </dl>
+        </section>
+        <section>
+            <h2>Pomf Rehost</h2>
+            <dl>
+                <dt>Download</dt>
+                <dd>
+                    <a href="https://git.fuwafuwa.moe/lesderid/pomf-rehost">
+                        https://git.fuwafuwa.moe/lesderid/pomf-rehost
+                    </a>
+                </dd>
+            </dl>
+        </section>
+    </div>
+<%- include('./templates/partials/footer.ejs'); -%>
\ No newline at end of file
diff --git a/templates/tools.swig b/templates/tools.swig
deleted file mode 100644 (file)
index 8ba0fb9..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-{% extends "layout.swig" %}
-
-{% block title %}Tools{% endblock %}
-{% block body %}
-
-<div class="jumbotron"><h1>Uguu Tools</h1></div>
-<div class="alert alert-info">
-  <section>
-    <h3>
-      To upload using curl or make a tool you can post using:
-      <br/>
-      curl -i -F files[]=@yourfile.jpeg {{siteUrl}}/upload.php (JSON Response)
-    </h3>
-
-<p>{{ToolsDesc}}</p>
-
-  <section>
-    <h2>ShareX</h2>
-    <dl>
-      <dt>Download</dt>
-      <dd><a href="https://getsharex.com">https://getsharex.com</a></dd>
-      <dt>Source</dt>
-      <dd><a href="https://github.com/ShareX/ShareX">https://github.com/ShareX/ShareX</a></dd>
-    </dl>
-  </section>
-
-  <h2>uguuecho</h2>
-  <dl>
-    <dt>Download</dt>
-    <dd><a href="https://git.teknik.io/nekunekus/uguucho">https://git.teknik.io/nekunekus/uguucho</a></dd>
-  </dl>
-</section>
-
-  <h2>pomfload</h2>
-  <dl>
-    <dt>Download</dt>
-    <dd><a href="https://github.com/ewhal/pomfload">https://github.com/ewhal/pomfload</a></dd>
-  </dl>
-</section>
-
-  <section>
-    <h2>Pomfshare</h2>
-
-    <dl>
-      <dt>Download</dt>
-      <dd><a
-      href="https://github.com/Nyubis/Pomfshare">https://github.com/Nyubis/Pomfshare</a></dd>
-    </dl>
-  </section>
-
-  <section>
-    <h2>Pomf Rehost</h2>
-    <dl>
-      <dt>Download</dt>
-      <dd>
-        <a href="https://git.fuwafuwa.moe/lesderid/pomf-rehost">
-          https://git.fuwafuwa.moe/lesderid/pomf-rehost
-        </a>
-      </dd>
-    </dl>
-</div>
-  </section>
-{% include "nav.swig" %}
-{% endblock %}
diff --git a/templates/upload_form.swig b/templates/upload_form.swig
deleted file mode 100644 (file)
index 5e8832f..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<form id="upload-form" enctype="multipart/form-data" method="post" action="upload.php?output=html">
-       <button id="upload-btn" class="btn" type="button">Drop or paste file(s)</button>
-       <input type="file" id="upload-input" name="files[]" multiple data-max-size="{{max_upload_size}}MiB">
-       <input type="submit" value="Submit">
-</form> 
-<ul id="upload-filelist"></ul>