Commit graph

17 commits

Author SHA1 Message Date
Wolvan
3287260962 Disable qs library
Being able to pass JSON objects in a query string is unneeded and
possibly insecure, thus should be avoided if possible.
2022-01-01 13:13:38 +01:00
Wolvan
9fa3eabad1 Make frontend js-less
The frontend should work without having JS enabled. JS will enhance the
experience but should under no circumstance be necessary.
To achieve this, the entire entry system has been turned into a form
that posts its values to a new backend path specifically made to take
form responses. Instead of returning an API response, it also redirects
the browser to either the voting page on successful creation or the
frontpage with a bunch of get parameters that are used to prefill the
form in a server-side rendering process.
An error parameter is also given but there is no way to display said
error for now.
2022-01-01 04:13:24 +01:00
Wolvan
862fe9d2f2 Allow browser JS to be written for the frontend
ESLint in this project is by default configured to lint NodeJS
source code. The `./frontend` folder contains browser source code
though, so a new `.eslintrc` sets that for the frontend folder.
2022-01-01 04:06:20 +01:00
Wolvan
08cb0df5e5 Add debugging run script
With this script one can easily launch a debuggable instance of the
current source code and then use vscode's debugger to attach to it.
2022-01-01 04:06:02 +01:00
Wolvan
5f9f2efee7 Continue refining frontend for poll creation 2021-12-29 19:46:47 +01:00
Wolvan
2f41df7264 Allow only 300 characters max
This prevents people from going crazy with gigabytes of data.
2021-12-29 19:26:07 +01:00
Wolvan
2db013c204 Begin designing the UI 2021-12-29 19:22:38 +01:00
Wolvan
e83766309a First steps towards functional frontend
Polls and their results can now be accessed as long as they are found on
the backend.
2021-12-29 18:21:22 +01:00
Wolvan
1507ea6d33 Fix config loading of boolean values
Setting values from config is a little tricky, but I think this makes it
work properly now.
2021-12-29 17:04:23 +01:00
Wolvan
16ca2ee8b1 Fix relative pathing issues
Running from a subdirectory makes the entire script a bit cumbersome
to wrap around when it comes to relative paths. They should now all work
properly though.
Paths that are relative to the Project Root now work as expected (eg.
package.json path) and other paths like the data and config path are
based on the current execution directory.
2021-12-29 15:25:43 +01:00
Wolvan
8a304c763b Only save valid options
Empty options are not valid options
2021-12-29 14:24:33 +01:00
Wolvan
d383d501f1 Ignore casing in dupe check mode 2021-12-29 14:23:34 +01:00
Wolvan
584d0092d8 Avoid ambigous characters in IDs
The issue with ambigous characters is that they are hard to write
when only seeing them, as one could confuse 0 for O with certain
typefaces for example.
Ambiguity is lessened by removing `Oo0Iil1` from the possible charset.
In order to keep a big enough pool of IDs the ID length changed from 6
to 8 characters instead, which seems like an OK tradeoff.
2021-12-29 14:13:35 +01:00
Wolvan
9d80a009ca Create rudimentary poll backend
This is currently untested, but the backend allows creating a new poll,
getting results of an existing poll, voting and retrieving info of a
poll for display purposes.
Recaptcha is not yet implemented at this stage.
2021-12-29 01:02:18 +01:00
Wolvan
8c3001042b Build frontend loader system
A custom server-side renderer is used to deliver pages to the client
with values defined on load. This makes templating easier.
2021-12-28 23:49:18 +01:00
Wolvan
1031a4c36f Implement backend and frontend loading
This system lets a server modularly load backend and frontend and allows
hosting each of the parts on separate services.
2021-12-28 23:47:30 +01:00
Wolvan
8bc3f7fe36 Initial commit
This code serves as an application framework of sorts and is totally not
stolen from some of my other projects.
2021-12-28 21:11:19 +01:00