Add a legal notices page
This commit is contained in:
parent
34bdb3cf24
commit
009d649ea6
34 changed files with 3048 additions and 5 deletions
58
internal/dis/component/control/legal/legal.go
Normal file
58
internal/dis/component/control/legal/legal.go
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
package legal
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/cli"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/control"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/control/static"
|
||||
"github.com/FAU-CDI/wisski-distillery/pkg/httpx"
|
||||
|
||||
_ "embed"
|
||||
)
|
||||
|
||||
type Legal struct {
|
||||
component.Base
|
||||
}
|
||||
|
||||
var (
|
||||
_ component.Routeable = (*Legal)(nil)
|
||||
)
|
||||
|
||||
//go:embed "legal.html"
|
||||
var legalTemplateString string
|
||||
var legalTemplate = static.AssetsLegal.MustParseShared("legal.html", legalTemplateString)
|
||||
|
||||
func (legal *Legal) Routes() component.Routes {
|
||||
return component.Routes{
|
||||
Paths: []string{"/legal/"},
|
||||
CSRF: false,
|
||||
}
|
||||
}
|
||||
|
||||
func (legal *Legal) HandleRoute(ctx context.Context, route string) (http.Handler, error) {
|
||||
return httpx.HTMLHandler[legalContext]{
|
||||
Handler: legal.context,
|
||||
Template: legalTemplate,
|
||||
}, nil
|
||||
}
|
||||
|
||||
type legalContext struct {
|
||||
LegalNotices string
|
||||
|
||||
CSRFCookie string
|
||||
SessionCookie string
|
||||
AssetsDisclaimer string
|
||||
}
|
||||
|
||||
func (legal *Legal) context(r *http.Request) (legalContext, error) {
|
||||
return legalContext{
|
||||
LegalNotices: cli.LegalNotices,
|
||||
|
||||
CSRFCookie: control.CSRFCookie,
|
||||
SessionCookie: control.SessionCookie,
|
||||
AssetsDisclaimer: static.AssetsDisclaimer,
|
||||
}, nil
|
||||
}
|
||||
79
internal/dis/component/control/legal/legal.html
Normal file
79
internal/dis/component/control/legal/legal.html
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
{{ template "_base.html" . }}
|
||||
{{ define "title" }}Legal{{ end }}
|
||||
|
||||
{{ define "header/time" }}
|
||||
<!-- no header/time -->
|
||||
{{ end }}
|
||||
{{ define "header"}}
|
||||
<!-- no header -->
|
||||
{{ end }}
|
||||
|
||||
{{ define "content" }}
|
||||
<div class="pure-u-1">
|
||||
<h2 id="cookies">Cookie Usage</h2>
|
||||
|
||||
<p>
|
||||
Parts of this site use cookies for essential purposes.
|
||||
<a href="https://en.wikipedia.org/wiki/HTTP_cookie">Wikipedia</a> says that
|
||||
</p>
|
||||
<blockquote>
|
||||
<p>A […] cookie (also called web cookie, Internet cookie, browser cookie, or simply cookie) is a small piece of data sent from a website and stored on the user’s computer by the user’s web browser while the user is browsing.</p>
|
||||
</blockquote>
|
||||
<p>
|
||||
This site only uses cookies where necessary; in particular they are only used on access protected sites.
|
||||
Public sites are cookie-free.
|
||||
For signed in users only two cookies are used.
|
||||
|
||||
<ol>
|
||||
<li>
|
||||
The cookie named <code>{{ .CSRFCookie }}</code> is used to prevent <a href="https://en.wikipedia.org/wiki/Cross-site_request_forgery">Cross-site request forgery</a>.
|
||||
</li>
|
||||
<li>
|
||||
The cookie named <code>{{ .SessionCookie }}</code> is used to track a distillery user session, so that a user does not constantly have to login again.
|
||||
It is automatically deleted once a user signs out.
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
Neither cookie is used beyond the purposes they are required for.
|
||||
In particular, they are not used for analytics or any other kind of tracking.
|
||||
</p>
|
||||
</div>
|
||||
<div class="pure-u-1">
|
||||
<h2 id="notices">Legal Notices</h2>
|
||||
|
||||
<ul>
|
||||
<li><a href="#license.backend">Backend</a></li>
|
||||
<li><a href="#license.frontend">Frontend</a></li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
This site is powered by the <a href="https://github.com/FAU-CDI/wisski-distillery" target="_blank" rel="noopener noreferer">WissKI Distillery</a>.
|
||||
The project is licensed under the terms of the AGPL Version 3.0 License.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="pure-u-1">
|
||||
<h3 id="license.backend">Backend</h2>
|
||||
|
||||
<p>
|
||||
<small><a href="#notices">Back to Notices</a></small>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The backend may contain code from the following projects:
|
||||
</p>
|
||||
|
||||
<pre>{{ .LegalNotices }}</pre>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="pure-u-1">
|
||||
<h3 id="license.frontend">Frontend</h2>
|
||||
|
||||
<p>
|
||||
<small><a href="#notices">Back to Notices</a></small>
|
||||
</p>
|
||||
|
||||
<pre>{{ .AssetsDisclaimer }}</pre>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
|
@ -21,7 +21,7 @@ type Assets struct {
|
|||
Styles string // <link> tags inserted by the asset
|
||||
}
|
||||
|
||||
//go:generate node build.mjs Home User Admin
|
||||
//go:generate node build.mjs Home User Admin Legal
|
||||
|
||||
// MustParse parses a new template from the given source
|
||||
// and calls [RegisterAssoc] on it.
|
||||
|
|
|
|||
2837
internal/dis/component/control/static/assets_disclaimer.txt
Normal file
2837
internal/dis/component/control/static/assets_disclaimer.txt
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1,7 +1,12 @@
|
|||
package static
|
||||
|
||||
import _ "embed"
|
||||
|
||||
// This file was automatically generated. Do not edit.
|
||||
|
||||
//go:embed "assets_disclaimer.txt"
|
||||
var AssetsDisclaimer string
|
||||
|
||||
// AssetsHome contains assets for the 'Home' entrypoint.
|
||||
var AssetsHome = Assets{
|
||||
Scripts: `<script type="module" src="/static/Home.38d394c2.js"></script><script src="/static/Home.38d394c2.js" nomodule="" defer></script><script type="module" src="/static/Home.38d394c2.js"></script><script src="/static/Home.38d394c2.js" nomodule="" defer></script>`,
|
||||
|
|
@ -19,3 +24,9 @@ var AssetsAdmin = Assets{
|
|||
Scripts: `<script nomodule="" defer src="/static/User.30d54198.js"></script><script type="module" src="/static/User.4197014b.js"></script><script type="module" src="/static/Home.38d394c2.js"></script><script src="/static/Home.38d394c2.js" nomodule="" defer></script><script type="module" src="/static/Admin.4ca3cb6f.js"></script><script src="/static/Admin.9750ba9c.js" nomodule="" defer></script>`,
|
||||
Styles: `<link rel="stylesheet" href="/static/Home.9f00501f.css"><link rel="stylesheet" href="/static/Admin.6d59e220.css"><link rel="stylesheet" href="/static/User.38d394c2.css"><link rel="stylesheet" href="/static/Admin.6d2ae968.css">`,
|
||||
}
|
||||
|
||||
// AssetsLegal contains assets for the 'Legal' entrypoint.
|
||||
var AssetsLegal = Assets{
|
||||
Scripts: `<script type="module" src="/static/Home.38d394c2.js"></script><script src="/static/Home.38d394c2.js" nomodule="" defer></script><script type="module" src="/static/Legal.38d394c2.js"></script><script src="/static/Legal.38d394c2.js" nomodule="" defer></script>`,
|
||||
Styles: `<link rel="stylesheet" href="/static/Home.9f00501f.css"><link rel="stylesheet" href="/static/Legal.d1531eba.css"><link rel="stylesheet" href="/static/Legal.20259812.css">`,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import { Parcel } from "@parcel/core"
|
|||
import { mkdir, rm, writeFile, readFile, unlink, rmdir, } from "fs/promises"
|
||||
import { join } from "path"
|
||||
import { parse as parseHTML } from 'node-html-parser';
|
||||
import { spawnSync } from 'child_process'
|
||||
|
||||
//
|
||||
// PARAMETERS
|
||||
|
|
@ -13,6 +14,11 @@ const DIST_DIR = join('.', 'dist')
|
|||
const PUBLIC_DIR = '/static/'
|
||||
|
||||
const DEST_PACKAGE = process.env.GOPACKAGE ?? 'static'
|
||||
const DEST_DISCLAIMER = (() => {
|
||||
const source = (process.env.GOFILE ?? 'assets.go')
|
||||
const base = source.substring(0, source.length - '.go'.length)
|
||||
return base + '_disclaimer.txt'
|
||||
})()
|
||||
const DEST_FILE = (() => {
|
||||
const source = (process.env.GOFILE ?? 'assets.go')
|
||||
const base = source.substring(0, source.length - '.go'.length)
|
||||
|
|
@ -31,6 +37,30 @@ await Promise.all([
|
|||
console.log(' Done.')
|
||||
|
||||
|
||||
//
|
||||
// Write the disclaimer
|
||||
//
|
||||
|
||||
process.stdout.write('Generating legal disclaimer ...')
|
||||
|
||||
const disclaimer = await new Promise((r, e) => {
|
||||
var child = spawnSync("yarn", ["licenses", "generate-disclaimer"], { encoding : 'utf8' });
|
||||
if (child.error) {
|
||||
e(child.stderr)
|
||||
return
|
||||
}
|
||||
|
||||
r(child.stdout)
|
||||
});
|
||||
|
||||
console.log(' Done.')
|
||||
|
||||
|
||||
process.stdout.write(`Writing ${DEST_DISCLAIMER} ...`)
|
||||
await writeFile(DEST_DISCLAIMER, disclaimer)
|
||||
console.log(' Done.')
|
||||
|
||||
|
||||
//
|
||||
// WRITE ENTRY POINTS
|
||||
//
|
||||
|
|
@ -79,7 +109,6 @@ const bundler = new Parcel({
|
|||
const { bundleGraph } = await bundler.run()
|
||||
console.log(' Done.')
|
||||
|
||||
|
||||
//
|
||||
// FIND ASSETS IN OUTPUT
|
||||
//
|
||||
|
|
@ -118,8 +147,13 @@ var Assets${name} = Assets{
|
|||
}).join('\n\n')
|
||||
const goSource = `package ${DEST_PACKAGE}
|
||||
|
||||
import _ "embed"
|
||||
|
||||
// This file was automatically generated. Do not edit.
|
||||
|
||||
//go:embed ${JSON.stringify(DEST_DISCLAIMER)}
|
||||
var AssetsDisclaimer string
|
||||
|
||||
${goAssets}
|
||||
`;
|
||||
|
||||
|
|
|
|||
BIN
internal/dis/component/control/static/dist/LM-bold-italic.702b3482.woff2
vendored
Normal file
BIN
internal/dis/component/control/static/dist/LM-bold-italic.702b3482.woff2
vendored
Normal file
Binary file not shown.
BIN
internal/dis/component/control/static/dist/LM-bold-italic.f65b4854.woff
vendored
Normal file
BIN
internal/dis/component/control/static/dist/LM-bold-italic.f65b4854.woff
vendored
Normal file
Binary file not shown.
BIN
internal/dis/component/control/static/dist/LM-bold-italic.fbe2ed3d.ttf
vendored
Normal file
BIN
internal/dis/component/control/static/dist/LM-bold-italic.fbe2ed3d.ttf
vendored
Normal file
Binary file not shown.
BIN
internal/dis/component/control/static/dist/LM-bold.31ce4615.ttf
vendored
Normal file
BIN
internal/dis/component/control/static/dist/LM-bold.31ce4615.ttf
vendored
Normal file
Binary file not shown.
BIN
internal/dis/component/control/static/dist/LM-bold.35b4959f.woff2
vendored
Normal file
BIN
internal/dis/component/control/static/dist/LM-bold.35b4959f.woff2
vendored
Normal file
Binary file not shown.
BIN
internal/dis/component/control/static/dist/LM-bold.bf36a7a0.woff
vendored
Normal file
BIN
internal/dis/component/control/static/dist/LM-bold.bf36a7a0.woff
vendored
Normal file
Binary file not shown.
BIN
internal/dis/component/control/static/dist/LM-italic.36b1666c.woff2
vendored
Normal file
BIN
internal/dis/component/control/static/dist/LM-italic.36b1666c.woff2
vendored
Normal file
Binary file not shown.
BIN
internal/dis/component/control/static/dist/LM-italic.979990db.woff
vendored
Normal file
BIN
internal/dis/component/control/static/dist/LM-italic.979990db.woff
vendored
Normal file
Binary file not shown.
BIN
internal/dis/component/control/static/dist/LM-italic.b7d16088.ttf
vendored
Normal file
BIN
internal/dis/component/control/static/dist/LM-italic.b7d16088.ttf
vendored
Normal file
Binary file not shown.
BIN
internal/dis/component/control/static/dist/LM-regular.228e9eb9.woff
vendored
Normal file
BIN
internal/dis/component/control/static/dist/LM-regular.228e9eb9.woff
vendored
Normal file
Binary file not shown.
BIN
internal/dis/component/control/static/dist/LM-regular.8430c051.woff2
vendored
Normal file
BIN
internal/dis/component/control/static/dist/LM-regular.8430c051.woff2
vendored
Normal file
Binary file not shown.
BIN
internal/dis/component/control/static/dist/LM-regular.a39abab4.ttf
vendored
Normal file
BIN
internal/dis/component/control/static/dist/LM-regular.a39abab4.ttf
vendored
Normal file
Binary file not shown.
1
internal/dis/component/control/static/dist/Legal.20259812.css
vendored
Normal file
1
internal/dis/component/control/static/dist/Legal.20259812.css
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
html{background-color:#87a485}body{max-width:80vw!important}
|
||||
0
internal/dis/component/control/static/dist/Legal.38d394c2.js
vendored
Normal file
0
internal/dis/component/control/static/dist/Legal.38d394c2.js
vendored
Normal file
1
internal/dis/component/control/static/dist/Legal.d1531eba.css
vendored
Normal file
1
internal/dis/component/control/static/dist/Legal.d1531eba.css
vendored
Normal file
File diff suppressed because one or more lines are too long
BIN
internal/dis/component/control/static/dist/Libertinus-bold-italic.818dca24.woff2
vendored
Normal file
BIN
internal/dis/component/control/static/dist/Libertinus-bold-italic.818dca24.woff2
vendored
Normal file
Binary file not shown.
BIN
internal/dis/component/control/static/dist/Libertinus-bold.dbc19f09.woff2
vendored
Normal file
BIN
internal/dis/component/control/static/dist/Libertinus-bold.dbc19f09.woff2
vendored
Normal file
Binary file not shown.
BIN
internal/dis/component/control/static/dist/Libertinus-italic.296c0a11.woff2
vendored
Normal file
BIN
internal/dis/component/control/static/dist/Libertinus-italic.296c0a11.woff2
vendored
Normal file
Binary file not shown.
BIN
internal/dis/component/control/static/dist/Libertinus-regular.4fbe3482.woff2
vendored
Normal file
BIN
internal/dis/component/control/static/dist/Libertinus-regular.4fbe3482.woff2
vendored
Normal file
Binary file not shown.
BIN
internal/dis/component/control/static/dist/Libertinus-semibold-italic.8f58c3c1.woff2
vendored
Normal file
BIN
internal/dis/component/control/static/dist/Libertinus-semibold-italic.8f58c3c1.woff2
vendored
Normal file
Binary file not shown.
BIN
internal/dis/component/control/static/dist/Libertinus-semibold.0f1c4067.woff2
vendored
Normal file
BIN
internal/dis/component/control/static/dist/Libertinus-semibold.0f1c4067.woff2
vendored
Normal file
Binary file not shown.
|
|
@ -5,6 +5,7 @@
|
|||
"private": true,
|
||||
"dependencies": {
|
||||
"dayjs": "^1.11.5",
|
||||
"latex.css": "^1.8.0",
|
||||
"node-html-parser": "^6.1.1",
|
||||
"parcel": "^2.7.0",
|
||||
"purecss": "^2.1.0"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
html {
|
||||
background-color: #87A485;
|
||||
}
|
||||
|
||||
body {
|
||||
max-width: 80vw !important;
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
import "latex.css/style.min.css"
|
||||
|
|
@ -1093,6 +1093,11 @@ json5@^2.2.0, json5@^2.2.1:
|
|||
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.1.tgz#655d50ed1e6f95ad1a3caababd2b0efda10b395c"
|
||||
integrity sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==
|
||||
|
||||
latex.css@^1.8.0:
|
||||
version "1.8.0"
|
||||
resolved "https://registry.yarnpkg.com/latex.css/-/latex.css-1.8.0.tgz#463f77c844900825f5a53bd3aa0457473a293cba"
|
||||
integrity sha512-3mUWF6M2/3eqEhekJ2i3GWQbJQpGIQ3JDKtd3GwsmQCifxqCFS3UkOlkvsAOB6C+AN/O2y9kPOVbs/kR2O5sDg==
|
||||
|
||||
lightningcss-darwin-arm64@1.16.0:
|
||||
version "1.16.0"
|
||||
resolved "https://registry.yarnpkg.com/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.16.0.tgz#f3318a2e64ca160610977675ee1a7e611f4a3617"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue