summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* site: use errormsg function for general survey errorsstuebinm2021-04-122-11/+12
| | | | | | | | | the previous commit introduced handling error messages using a "setErrormsg" function. This is now also used for the general error messages which may show up at the bottom of surveys. However, since js and async things are weird, the code there is still a long repetitive mess which can't really be cut down further.
* site: show hint for unselected radio buttonsstuebinm2021-04-122-10/+36
| | | | | | | In surveys containing radio buttons, there will now be a nice little hint directly beneath them if none were selected when attempting to submit (in addition to the relatively nondescript "not all required questions were filled in"-hint at the bottom of the form)
* site: fix locale detectionstuebinm2021-04-122-5/+9
| | | | (it mistakenly set the locale to undefined before)
* site: attempt to guess default languagestuebinm2021-04-083-5/+24
| | | | | (from the browser's preferences set via navigator.language and navigator.languages)
* add translation logic, locales for en and destuebinm2021-04-087-19/+99
| | | | | | | | | | | | | | | | | | | This adds a basic "replace fixed keys"-approach to translating the UI of surveys. So far this works great, but for complex things it may fail for some languages — for now I'll just try to take care not to add any output that puts things in the middle of sentences, which I think should work for a simple survey thing. The default language is still english, which is important as the language is declared withing a survey config — i.e. if loading it fails, it cannot be applied, and the "enter passphrase" dialog can also not change based on locales. This could possibly be fixed by adding an unencrypted "header" to the encrypted configs, but for now I'm not sure if that makes a lot of sense — it may be easier to just guess based on the browser's settings, and otherwise fall back to some specified default language. The "thanks for your answers"-page also has no translation so far.
* site: add a rudimentary dark modestuebinm2021-04-082-2/+27
| | | | | | | | | | This is a very simple, very high-contrast dark mode (for now). However, not all default ui elements seem to respect it by default — i.e. textareas stay entirely white by default and require additional theming. I'm not sure if this is my system stlye or firefox interfering, but for now I've added custom css rules which at least make text areas black. Buttons and checkboxes are still white, however.
* site: implement accessibility hints of WAVEstuebinm2021-04-082-17/+32
| | | | | | | | | | | This implements some accessibility guidelines, as hinted at by WAVE [1]: - labels for textareas - fieldsets for multiple-choice answers One thing that's still missing is a set language, which I guess will be best implemented together with an actual language switcher. [1] https://wave.webaim.org/
* site: better html attributesstuebinm2021-04-082-3/+4
| | | | (i.e. defined charset & a main tag)
* site: better error messagesstuebinm2021-04-082-34/+47
| | | | | | | this includes styling error messages red, and displaying error messages in case not all answers were answered as required (for now, this just means that not selecting any option in radio buttons is disallowed in general, as so far there are no corresponding config fields).
* site: sensible sizes for textareasstuebinm2021-04-071-0/+7
|
* add a todo filestuebinm2021-04-071-0/+18
|
* site: better error messagesstuebinm2021-04-071-14/+27
| | | | | | | this includes deduplicating some code, and attempts at error messages for files which could not be parsed as json but aren't actually valid age-encrypted files (there doesn't seem to be some easy way to validate that these files are valid age files without knowing the key).
* site: add visual feedback on survey submissionstuebinm2021-04-072-2/+31
| | | | | | After a submission, the survey will now either redirect to a "thanks for your answers!"-site (if the POST request had status 200) or else display some kind of error message.
* add a potentially useful readmestuebinm2021-04-051-0/+54
|
* utils: change name to survey-generatestuebinm2021-04-053-14/+13
|
* utils: switch to asymmetric encryptionstuebinm2021-04-051-6/+10
|
* server: fix binary file outputstuebinm2021-04-051-2/+3
| | | | (previously, it tried to use ascii encoding and would fail)
* site: add headers for survey POST requeststuebinm2021-04-051-2/+8
|
* add example surveystuebinm2021-04-053-0/+4
| | | | | | | | these can be found in site/examples. There is a simple unencrypted survey in "example.json", and an encrypted variant of the same in "encrypted.json". The key used for encryption can be found in "key.age"; in particular, note that the passphrase for the encrypted survey is exactly that private key.
* util: make outfile configurable (or print to stdout)stuebinm2021-04-051-1/+12
|
* add dhall example configstuebinm2021-04-051-0/+20
|
* add utility programstuebinm2021-04-054-0/+2366
| | | | | | This can be used to write configs in dhall (instead of plain json), combined with some input validation and (optionally) automatic encryption via the age rust crate.
* add simple server which takes POST requestsstuebinm2021-04-052-0/+115
| | | | | | | | | The idea is that it can accept surveys sent to it. Note that in an actual deployment it should have at least some rate-limiting, since actual validation of input is impossible if they are encrypted – i.e. this is bascially a pastbin. It may, however, be possible to require signing answers for survey with access restrictions, or do a challange/response type thing before allowing submission.
* add wasm blobsstuebinm2021-04-055-0/+695
| | | | | the nix tooling for rust and wasm appears to be really bad, so binary blobs are easier for now.
* load survey from (and submit result to) path given as fragmentstuebinm2021-04-051-18/+30
| | | | | | | syntax: http(s)://domain.tld/path/to/file/index.html#[upload url] The upload url may be relative to the site's position, or absolute. Survey results will be POSTed to [upload path]/upload.
* simple python server for testing purposesstuebinm2021-04-041-0/+15
| | | | | | web assembly needs its own mimetype set to work in the browser, which most other development tools don't support — so this python script can be used instead.
* simple forms with simple encryptionstuebinm2021-04-042-0/+259
this depends on age stuffed into web assembly, which is not yet part of this repository. The idea is to have a web app (which is a static html page + js / wasm) and a set of (optionally encrypted) json files which describe surveys, which the main site can download on demand.