2018-12-24 18:45:15 +01:00
|
|
|
/*
|
|
|
|
* Copyright © 2018 A Bunch Tell LLC.
|
|
|
|
*
|
|
|
|
* This file is part of WriteFreely.
|
|
|
|
*
|
|
|
|
* WriteFreely is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License, included
|
|
|
|
* in the LICENSE file in this source code package.
|
|
|
|
*/
|
2018-12-31 07:05:26 +01:00
|
|
|
|
2018-11-19 03:58:50 +01:00
|
|
|
package writefreely
|
|
|
|
|
|
|
|
import (
|
2019-04-11 19:56:07 +02:00
|
|
|
"database/sql"
|
2019-04-06 19:23:22 +02:00
|
|
|
"github.com/writeas/writefreely/config"
|
2018-11-19 03:58:50 +01:00
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
2019-04-06 19:23:22 +02:00
|
|
|
var defaultPageUpdatedTime = time.Date(2018, 11, 8, 12, 0, 0, 0, time.Local)
|
|
|
|
|
|
|
|
func getAboutPage(app *app) (*instanceContent, error) {
|
|
|
|
c, err := app.db.GetDynamicContent("about")
|
2018-11-19 03:58:50 +01:00
|
|
|
if err != nil {
|
2019-04-06 19:23:22 +02:00
|
|
|
return nil, err
|
2018-11-19 03:58:50 +01:00
|
|
|
}
|
2019-04-06 19:23:22 +02:00
|
|
|
if c == nil {
|
|
|
|
c = &instanceContent{
|
|
|
|
ID: "about",
|
2019-04-11 19:56:07 +02:00
|
|
|
Type: "page",
|
2019-04-06 19:23:22 +02:00
|
|
|
Content: defaultAboutPage(app.cfg),
|
2018-11-19 03:58:50 +01:00
|
|
|
}
|
|
|
|
}
|
2019-04-11 19:56:07 +02:00
|
|
|
if !c.Title.Valid {
|
|
|
|
c.Title = defaultAboutTitle(app.cfg)
|
|
|
|
}
|
2018-11-19 03:58:50 +01:00
|
|
|
return c, nil
|
|
|
|
}
|
|
|
|
|
2019-04-11 19:56:07 +02:00
|
|
|
func defaultAboutTitle(cfg *config.Config) sql.NullString {
|
|
|
|
return sql.NullString{String: "About " + cfg.App.SiteName, Valid: true}
|
|
|
|
}
|
|
|
|
|
2019-04-06 19:23:22 +02:00
|
|
|
func getPrivacyPage(app *app) (*instanceContent, error) {
|
|
|
|
c, err := app.db.GetDynamicContent("privacy")
|
2018-11-19 03:58:50 +01:00
|
|
|
if err != nil {
|
2019-04-06 19:23:22 +02:00
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
if c == nil {
|
|
|
|
c = &instanceContent{
|
|
|
|
ID: "privacy",
|
2019-04-11 19:56:07 +02:00
|
|
|
Type: "page",
|
2019-04-06 19:23:22 +02:00
|
|
|
Content: defaultPrivacyPolicy(app.cfg),
|
|
|
|
Updated: defaultPageUpdatedTime,
|
|
|
|
}
|
|
|
|
}
|
2019-04-11 19:56:07 +02:00
|
|
|
if !c.Title.Valid {
|
|
|
|
c.Title = defaultPrivacyTitle()
|
|
|
|
}
|
2019-04-06 19:23:22 +02:00
|
|
|
return c, nil
|
|
|
|
}
|
|
|
|
|
2019-04-11 19:56:07 +02:00
|
|
|
func defaultPrivacyTitle() sql.NullString {
|
|
|
|
return sql.NullString{String: "Privacy Policy", Valid: true}
|
|
|
|
}
|
|
|
|
|
2019-04-06 19:23:22 +02:00
|
|
|
func defaultAboutPage(cfg *config.Config) string {
|
|
|
|
if cfg.App.Federation {
|
|
|
|
return `_` + cfg.App.SiteName + `_ is an interconnected place for you to write and publish, powered by WriteFreely and ActivityPub.`
|
2018-11-19 03:58:50 +01:00
|
|
|
}
|
2019-04-06 19:23:22 +02:00
|
|
|
return `_` + cfg.App.SiteName + `_ is a place for you to write and publish, powered by WriteFreely.`
|
|
|
|
}
|
|
|
|
|
|
|
|
func defaultPrivacyPolicy(cfg *config.Config) string {
|
2019-04-12 03:33:33 +02:00
|
|
|
return `[WriteFreely](https://writefreely.org), the software that powers this site, is built to enforce your right to privacy by default.
|
2018-11-19 03:58:50 +01:00
|
|
|
|
|
|
|
It retains as little data about you as possible, not even requiring an email address to sign up. However, if you _do_ give us your email address, it is stored encrypted in our database. We salt and hash your account's password.
|
|
|
|
|
|
|
|
We store log files, or data about what happens on our servers. We also use cookies to keep you logged in to your account.
|
|
|
|
|
2019-04-06 19:23:22 +02:00
|
|
|
Beyond this, it's important that you trust whoever runs **` + cfg.App.SiteName + `**. Software can only do so much to protect you -- your level of privacy protections will ultimately fall on the humans that run this particular service.`
|
2018-11-19 03:58:50 +01:00
|
|
|
}
|