diff --git a/src/index.js b/src/index.js index 3800635..3238f0a 100644 --- a/src/index.js +++ b/src/index.js @@ -9,6 +9,11 @@ const app = express() const __dirname = dirname(fileURLToPath(import.meta.url)) app.use(cors()) +app.set('views', path.join(__dirname, 'views')) +app.set('view engine', 'ejs') + +app.get('/', (req, res) => res.render('index')) +app.get('/form/:data', (req, res) => res.render('form')) app.get('/api/qrcode', async (req, res) => { const errors = [] @@ -81,7 +86,4 @@ ${String(req.query.issuer_city).toUpperCase()}` }) -app.get('/', (req, res) => res.sendFile(path.join(__dirname, 'index.html'))) -app.get('/style.css', (req, res) => res.sendFile(path.join(__dirname, 'style.css'))) - app.listen(process.env.PORT || 80, () => console.log(`UPN-QR started on port ${process.env.PORT || 80}`)) \ No newline at end of file diff --git a/src/style.css b/src/style.css deleted file mode 100644 index 8e7795d..0000000 --- a/src/style.css +++ /dev/null @@ -1,64 +0,0 @@ -body, -html { - margin: 0; - padding: 0; - max-width: 100vw; - overflow-x: hidden; - --c-dark: #202124; - --c-darkish: #303134; - --c-primary: #e8eaed; - --c-accent: #C58AF9; -} - -html { - padding: 0 0; - width: 100vw; - display: grid; - grid-template-columns: auto minmax(50vw, 650px) auto; - background-color: var(--c-dark); -} - -body { - grid-column: 2; - padding: 15px; - margin: 30px 10px; - - display: grid; - grid-template-columns: auto; - grid-auto-rows: auto; - row-gap: 2rem; - - border-radius: 1rem; - background-color: var(--c-darkish); - color: var(--c-primary); - - font-family: monospace; - font-size: 16px; - line-height: 1.6em; - word-break: normal; -} - -a { - color: var(--c-accent); - text-decoration: none; -} -code, -pre { - background-color: var(--c-dark); - padding: 6px 4px 2px 4px; - word-break: break-all; -} -pre { - overflow-x: scroll; -} -section div { - padding-left: 25px; - display: grid; -} - -.credits { - display: grid; - align-items: center; - justify-content: center; - text-align: center; -} \ No newline at end of file diff --git a/src/views/form.ejs b/src/views/form.ejs new file mode 100644 index 0000000..dc6c8e4 --- /dev/null +++ b/src/views/form.ejs @@ -0,0 +1,20 @@ + + + + + + + UPN-QR :: FORM + + + +
+ +
+ + + \ No newline at end of file diff --git a/src/index.html b/src/views/index.ejs similarity index 88% rename from src/index.html rename to src/views/index.ejs index 24af022..6be0caa 100644 --- a/src/index.html +++ b/src/views/index.ejs @@ -5,8 +5,73 @@ UPN-QR | Open generator for UPN QR codes - +

About

@@ -21,7 +86,15 @@

Because Public Payments Administration prohibits the generation and use of UPN-QR codes by any unapthorized party, you must be authorized in order to use this application and publish the content that it generates.

-

API

+

🔗 Form maker

+
+
+ +
+
+ + +

🔗 API

🔗 GET /api/qrcode

Returns a image/png image if successful (OK 200), else returns the following JSON { ok: false, errors: String[] } where errors is an array of descriptive strings.