A clean, Markdown-based publishing platform made for writers. Write together, and build a community. https://writefreely.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

82 lines
2.5 KiB

  1. /*
  2. * Copyright © 2018-2019 A Bunch Tell LLC.
  3. *
  4. * This file is part of WriteFreely.
  5. *
  6. * WriteFreely is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU Affero General Public License, included
  8. * in the LICENSE file in this source code package.
  9. */
  10. package writefreely
  11. import (
  12. "database/sql"
  13. "github.com/writeas/writefreely/config"
  14. "time"
  15. )
  16. var defaultPageUpdatedTime = time.Date(2018, 11, 8, 12, 0, 0, 0, time.Local)
  17. func getAboutPage(app *App) (*instanceContent, error) {
  18. c, err := app.db.GetDynamicContent("about")
  19. if err != nil {
  20. return nil, err
  21. }
  22. if c == nil {
  23. c = &instanceContent{
  24. ID: "about",
  25. Type: "page",
  26. Content: defaultAboutPage(app.cfg),
  27. }
  28. }
  29. if !c.Title.Valid {
  30. c.Title = defaultAboutTitle(app.cfg)
  31. }
  32. return c, nil
  33. }
  34. func defaultAboutTitle(cfg *config.Config) sql.NullString {
  35. return sql.NullString{String: "About " + cfg.App.SiteName, Valid: true}
  36. }
  37. func getPrivacyPage(app *App) (*instanceContent, error) {
  38. c, err := app.db.GetDynamicContent("privacy")
  39. if err != nil {
  40. return nil, err
  41. }
  42. if c == nil {
  43. c = &instanceContent{
  44. ID: "privacy",
  45. Type: "page",
  46. Content: defaultPrivacyPolicy(app.cfg),
  47. Updated: defaultPageUpdatedTime,
  48. }
  49. }
  50. if !c.Title.Valid {
  51. c.Title = defaultPrivacyTitle()
  52. }
  53. return c, nil
  54. }
  55. func defaultPrivacyTitle() sql.NullString {
  56. return sql.NullString{String: "Privacy Policy", Valid: true}
  57. }
  58. func defaultAboutPage(cfg *config.Config) string {
  59. if cfg.App.Federation {
  60. return `_` + cfg.App.SiteName + `_ is an interconnected place for you to write and publish, powered by WriteFreely and ActivityPub.`
  61. }
  62. return `_` + cfg.App.SiteName + `_ is a place for you to write and publish, powered by WriteFreely.`
  63. }
  64. func defaultPrivacyPolicy(cfg *config.Config) string {
  65. return `[WriteFreely](https://writefreely.org), the software that powers this site, is built to enforce your right to privacy by default.
  66. 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.
  67. We store log files, or data about what happens on our servers. We also use cookies to keep you logged in to your account.
  68. 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.`
  69. }