vocascan / vocascan-server

Server for Vocascan
https://vocascan.com
Apache License 2.0
26 stars 5 forks source link

Feature/legal templates #72

Closed noctera closed 2 years ago

noctera commented 2 years ago
Status Type Env Vars Change
:white_check_mark: Ready Feature Yes

Description

This PR adds the function to create your own routes and add static pages or redirects to your server in them. Mainly to include a privacy policy and terms and conditions.

just define your custom pages in the config (documentation will be done soon)

// ...
pages: {
    privacy: {
      url: '/privacy',
      fallback: { type: 'file', location: './staticPages/privacy-en.html' },
      langs: {
        en: { type: 'redirect', location: 'https://my-website/privacy' },
        de: { type: 'file', location: './staticPages/privacy-de.html' },
        // ...
      },
    },
   termsAndConditions: {
      url: '/terms-and-conditions',
      fallback: { type: 'file', location: './staticPages/privacy-en.html' },
      langs: {
        en: { type: 'redirect', location: 'https://my-website/privacy' },
        // ...
      },
    },
  },

Info: The langs prop is not required.

In this case /privacy and /terms-and-conditions would return or redirect the fallback page, as no language is given in the query params. If you add ?lang=en the page, defined in langs will be displayed.

To Do:

If you use a language as query parameter, that is not defined in the config, you will be redirected to the fallback page.

Motivation and Context

We will need this function to bring the Vocascan Cloud one step closer to the public

Screenshots / GIFs (if appropriate):

Checklist

Resolves