Compare commits
93 Commits
Author | SHA1 | Date | |
---|---|---|---|
a30e4d3796 | |||
b35b465e3f | |||
e09a8353d2 | |||
9fe218e639 | |||
88b6e10c88 | |||
dd689e0dfd | |||
7da98fb2ab | |||
973abc8a81 | |||
98af3c6b4e | |||
1647a7187e | |||
c3d924cd77 | |||
30c35f2112 | |||
d6c58cf532 | |||
0cd964343b | |||
45910947e7 | |||
ed9c002b67 | |||
a1a470712b | |||
6567c34834 | |||
259a2088a8 | |||
f68241c092 | |||
9519ad5a1e | |||
5afd6b771a | |||
f2059b8e51 | |||
a7a1575710 | |||
222ad51d3d | |||
df4019ef0f | |||
4d87bc6d5e | |||
22deff88fe | |||
662c16326b | |||
5753ebda24 | |||
4a2aed5bcf | |||
c13b947628 | |||
951949f98d | |||
9b4a8e1890 | |||
1cf537662a | |||
e0fa31b7a1 | |||
344864f5b2 | |||
09350bab0e | |||
722022faec | |||
586b1cdef0 | |||
1f72891896 | |||
11d836dd26 | |||
57953b2cfd | |||
a93603eac0 | |||
1b72f05add | |||
2c6b15bc6d | |||
cafb158323 | |||
40fbb93732 | |||
b120341d78 | |||
095576a234 | |||
9199f202be | |||
3d08cc7612 | |||
a7b6fb9705 | |||
2f4d5d4c7c | |||
5b417ef87d | |||
04283d5917 | |||
d882daeb01 | |||
f99358729c | |||
7b04149a28 | |||
43c1cb6d9a | |||
9feb16a8d8 | |||
6885dfbb38 | |||
ed614026ec | |||
86a16629fd | |||
6d402aca32 | |||
87f8786c43 | |||
0af4a70aed | |||
cc8693ffaf | |||
b8fd81a86d | |||
62e75eaea8 | |||
5d251c3659 | |||
5552e6d2eb | |||
77a64d5179 | |||
fb842d203e | |||
9c0c7361a0 | |||
acae07b8f3 | |||
52b5dbf2c7 | |||
1b100483de | |||
7b9438233e | |||
ff36d65cc3 | |||
3d3cda319d | |||
0e825a55e5 | |||
88776337e4 | |||
f8691eb180 | |||
60e09175da | |||
13a6039490 | |||
d953b4135c | |||
4da9792b0f | |||
e03fd78ea9 | |||
36e9a16a6e | |||
d239a86444 | |||
8b1b99d0f7 | |||
c0e446d6d9 |
20
.air.toml
20
.air.toml
@ -3,25 +3,7 @@ testdata_dir = "testdata"
|
|||||||
tmp_dir = "tmp"
|
tmp_dir = "tmp"
|
||||||
|
|
||||||
[build]
|
[build]
|
||||||
args_bin = [
|
args_bin = ["-config tmp/config.toml"]
|
||||||
"-aes tmp/cpolis.aes",
|
|
||||||
"-articles tmp/articles",
|
|
||||||
"-banner-width 512",
|
|
||||||
"-config tmp/config.toml",
|
|
||||||
"-desc 'Freiheit, Gleichheit, Brüderlichkeit, Toleranz und Humanität'",
|
|
||||||
"-domain localhost",
|
|
||||||
"-feed tmp/cpolis.atom",
|
|
||||||
"-firebase tmp/firebase.json",
|
|
||||||
"-gob tmp/cpolis.gob",
|
|
||||||
"-img-width 256",
|
|
||||||
"-link https://distrikt-ni-st.de",
|
|
||||||
"-log tmp/cpolis.log",
|
|
||||||
"-pdfs tmp/pdfs",
|
|
||||||
"-pics tmp/pics",
|
|
||||||
"-port 8080",
|
|
||||||
"-title 'Freimaurer Distrikt Niedersachsen und Sachsen-Anhalt'",
|
|
||||||
"-web web",
|
|
||||||
]
|
|
||||||
bin = "./tmp/main"
|
bin = "./tmp/main"
|
||||||
cmd = "go build -o ./tmp/main ./cmd/main.go"
|
cmd = "go build -o ./tmp/main ./cmd/main.go"
|
||||||
delay = 0
|
delay = 0
|
||||||
|
@ -6,7 +6,10 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Article struct {
|
type Article struct {
|
||||||
@ -14,6 +17,7 @@ type Article struct {
|
|||||||
Title string
|
Title string
|
||||||
BannerLink string
|
BannerLink string
|
||||||
Summary string
|
Summary string
|
||||||
|
UUID uuid.UUID
|
||||||
ID int64
|
ID int64
|
||||||
CreatorID int64
|
CreatorID int64
|
||||||
IssueID int64
|
IssueID int64
|
||||||
@ -31,8 +35,8 @@ func (db *DB) AddArticle(a *Article) (int64, error) {
|
|||||||
selectQuery := "SELECT id FROM issues WHERE published = false"
|
selectQuery := "SELECT id FROM issues WHERE published = false"
|
||||||
insertQuery := `
|
insertQuery := `
|
||||||
INSERT INTO articles
|
INSERT INTO articles
|
||||||
(title, banner_link, summary, published, rejected, creator_id, issue_id, edited_id, clicks, is_in_issue, auto_generated)
|
(title, banner_link, summary, published, rejected, creator_id, issue_id, edited_id, clicks, is_in_issue, auto_generated, uuid)
|
||||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||||
`
|
`
|
||||||
|
|
||||||
for i := 0; i < TxMaxRetries; i++ {
|
for i := 0; i < TxMaxRetries; i++ {
|
||||||
@ -49,7 +53,7 @@ func (db *DB) AddArticle(a *Article) (int64, error) {
|
|||||||
return 0, fmt.Errorf("error getting issue ID when adding article to DB: %v", err)
|
return 0, fmt.Errorf("error getting issue ID when adding article to DB: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
result, err := tx.Exec(insertQuery, a.Title, a.BannerLink, a.Summary, a.Published, a.Rejected, a.CreatorID, id, a.EditedID, 0, a.IsInIssue, a.AutoGenerated)
|
result, err := tx.Exec(insertQuery, a.Title, a.BannerLink, a.Summary, a.Published, a.Rejected, a.CreatorID, id, a.EditedID, 0, a.IsInIssue, a.AutoGenerated, a.UUID.String())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if rollbackErr := tx.Rollback(); rollbackErr != nil {
|
if rollbackErr := tx.Rollback(); rollbackErr != nil {
|
||||||
log.Fatalf("transaction error: %v, rollback error: %v", err, rollbackErr)
|
log.Fatalf("transaction error: %v, rollback error: %v", err, rollbackErr)
|
||||||
@ -83,7 +87,7 @@ func (db *DB) AddArticle(a *Article) (int64, error) {
|
|||||||
|
|
||||||
func (db *DB) GetArticle(id int64) (*Article, error) {
|
func (db *DB) GetArticle(id int64) (*Article, error) {
|
||||||
query := `
|
query := `
|
||||||
SELECT title, created, banner_link, summary, published, creator_id, issue_id, edited_id, clicks, is_in_issue, auto_generated
|
SELECT title, created, banner_link, summary, published, creator_id, issue_id, edited_id, clicks, is_in_issue, auto_generated, uuid
|
||||||
FROM articles
|
FROM articles
|
||||||
WHERE id = ?
|
WHERE id = ?
|
||||||
`
|
`
|
||||||
@ -91,9 +95,10 @@ func (db *DB) GetArticle(id int64) (*Article, error) {
|
|||||||
|
|
||||||
article := new(Article)
|
article := new(Article)
|
||||||
var created []byte
|
var created []byte
|
||||||
|
var uuidString string
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
if err := row.Scan(&article.Title, &created, &article.BannerLink, &article.Summary, &article.Published, &article.CreatorID, &article.IssueID, &article.EditedID, &article.Clicks, &article.IsInIssue, &article.AutoGenerated); err != nil {
|
if err := row.Scan(&article.Title, &created, &article.BannerLink, &article.Summary, &article.Published, &article.CreatorID, &article.IssueID, &article.EditedID, &article.Clicks, &article.IsInIssue, &article.AutoGenerated, &uuidString); err != nil {
|
||||||
return nil, fmt.Errorf("error scanning article row: %v", err)
|
return nil, fmt.Errorf("error scanning article row: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,12 +108,42 @@ func (db *DB) GetArticle(id int64) (*Article, error) {
|
|||||||
return nil, fmt.Errorf("error parsing created: %v", err)
|
return nil, fmt.Errorf("error parsing created: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
article.UUID, err = uuid.Parse(uuidString)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("error parsing uuid: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return article, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (db *DB) GetArticleByUUID(u uuid.UUID) (*Article, error) {
|
||||||
|
query := `
|
||||||
|
SELECT id, title, created, banner_link, summary, published, creator_id, issue_id, edited_id, clicks, is_in_issue, auto_generated
|
||||||
|
FROM articles
|
||||||
|
WHERE uuid = ?
|
||||||
|
`
|
||||||
|
row := db.QueryRow(query, u.String())
|
||||||
|
|
||||||
|
article := new(Article)
|
||||||
|
var created []byte
|
||||||
|
var err error
|
||||||
|
|
||||||
|
if err := row.Scan(&article.ID, &article.Title, &created, &article.BannerLink, &article.Summary, &article.Published, &article.CreatorID, &article.IssueID, &article.EditedID, &article.Clicks, &article.IsInIssue, &article.AutoGenerated); err != nil {
|
||||||
|
return nil, fmt.Errorf("error scanning article row: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
article.UUID = u
|
||||||
|
article.Created, err = time.Parse("2006-01-02 15:04:05", string(created))
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("error parsing created: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
return article, nil
|
return article, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (db *DB) GetCertainArticles(attribute string, value bool) ([]*Article, error) {
|
func (db *DB) GetCertainArticles(attribute string, value bool) ([]*Article, error) {
|
||||||
query := fmt.Sprintf(`
|
query := fmt.Sprintf(`
|
||||||
SELECT id, title, created, banner_link, summary, creator_id, issue_id, clicks, published, rejected, is_in_issue, auto_generated
|
SELECT id, title, created, banner_link, summary, creator_id, issue_id, clicks, published, rejected, is_in_issue, auto_generated, uuid
|
||||||
FROM articles
|
FROM articles
|
||||||
WHERE %s = ?
|
WHERE %s = ?
|
||||||
`, attribute)
|
`, attribute)
|
||||||
@ -121,8 +156,9 @@ func (db *DB) GetCertainArticles(attribute string, value bool) ([]*Article, erro
|
|||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
article := new(Article)
|
article := new(Article)
|
||||||
var created []byte
|
var created []byte
|
||||||
|
var uuidString string
|
||||||
|
|
||||||
if err = rows.Scan(&article.ID, &article.Title, &created, &article.BannerLink, &article.Summary, &article.CreatorID, &article.IssueID, &article.Clicks, &article.Published, &article.Rejected, &article.IsInIssue, &article.AutoGenerated); err != nil {
|
if err = rows.Scan(&article.ID, &article.Title, &created, &article.BannerLink, &article.Summary, &article.CreatorID, &article.IssueID, &article.Clicks, &article.Published, &article.Rejected, &article.IsInIssue, &article.AutoGenerated, &uuidString); err != nil {
|
||||||
return nil, fmt.Errorf("error scanning article row: %v", err)
|
return nil, fmt.Errorf("error scanning article row: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,9 +167,18 @@ func (db *DB) GetCertainArticles(attribute string, value bool) ([]*Article, erro
|
|||||||
return nil, fmt.Errorf("error parsing created: %v", err)
|
return nil, fmt.Errorf("error parsing created: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
article.UUID, err = uuid.Parse(uuidString)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("error parsing uuid: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
articleList = append(articleList, article)
|
articleList = append(articleList, article)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err = rows.Err(); err != nil {
|
||||||
|
return nil, fmt.Errorf("error iterating over rows: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
return articleList, nil
|
return articleList, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,7 +187,7 @@ func (db *DB) GetCurrentIssueArticles() ([]*Article, error) {
|
|||||||
txOptions := &sql.TxOptions{Isolation: sql.LevelSerializable}
|
txOptions := &sql.TxOptions{Isolation: sql.LevelSerializable}
|
||||||
issueQuery := "SELECT id FROM issues WHERE published = false"
|
issueQuery := "SELECT id FROM issues WHERE published = false"
|
||||||
articlesQuery := `
|
articlesQuery := `
|
||||||
SELECT id, title, created, banner_link, summary, clicks, auto_generated
|
SELECT id, title, created, banner_link, summary, clicks, auto_generated, uuid
|
||||||
FROM articles
|
FROM articles
|
||||||
WHERE issue_id = ? AND published = true AND is_in_issue = true
|
WHERE issue_id = ? AND published = true AND is_in_issue = true
|
||||||
`
|
`
|
||||||
@ -174,8 +219,9 @@ func (db *DB) GetCurrentIssueArticles() ([]*Article, error) {
|
|||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
article := new(Article)
|
article := new(Article)
|
||||||
var created []byte
|
var created []byte
|
||||||
|
var uuidString string
|
||||||
|
|
||||||
if err = rows.Scan(&article.ID, &article.Title, &created, &article.BannerLink, &article.Summary, &article.Clicks, &article.AutoGenerated); err != nil {
|
if err = rows.Scan(&article.ID, &article.Title, &created, &article.BannerLink, &article.Summary, &article.Clicks, &article.AutoGenerated, &uuidString); err != nil {
|
||||||
if rollbackErr := tx.Rollback(); rollbackErr != nil {
|
if rollbackErr := tx.Rollback(); rollbackErr != nil {
|
||||||
log.Fatalf("transaction error: %v, rollback error: %v", err, rollbackErr)
|
log.Fatalf("transaction error: %v, rollback error: %v", err, rollbackErr)
|
||||||
}
|
}
|
||||||
@ -190,9 +236,24 @@ func (db *DB) GetCurrentIssueArticles() ([]*Article, error) {
|
|||||||
return nil, fmt.Errorf("error parsing created: %v", err)
|
return nil, fmt.Errorf("error parsing created: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
article.UUID, err = uuid.Parse(uuidString)
|
||||||
|
if err != nil {
|
||||||
|
if rollbackErr := tx.Rollback(); rollbackErr != nil {
|
||||||
|
log.Fatalf("transaction error: %v, rollback error: %v", err, rollbackErr)
|
||||||
|
}
|
||||||
|
return nil, fmt.Errorf("error parsing uuid: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
articleList = append(articleList, article)
|
articleList = append(articleList, article)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err = rows.Err(); err != nil {
|
||||||
|
if rollbackErr := tx.Rollback(); rollbackErr != nil {
|
||||||
|
log.Fatalf("transaction error: %v, rollback error: %v", err, rollbackErr)
|
||||||
|
}
|
||||||
|
return nil, fmt.Errorf("error iterating over rows: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
if err = tx.Commit(); err != nil {
|
if err = tx.Commit(); err != nil {
|
||||||
return nil, fmt.Errorf("error committing transaction when getting articles of issue %v: %v", issueID, err)
|
return nil, fmt.Errorf("error committing transaction when getting articles of issue %v: %v", issueID, err)
|
||||||
}
|
}
|
||||||
@ -284,12 +345,64 @@ func (db *DB) DeleteArticle(id int64) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func WriteArticleToFile(c *Config, articleID int64, content []byte) error {
|
func (db *DB) GetAllArticles() ([]*Article, error) {
|
||||||
articleAbsName := fmt.Sprint(c.ArticleDir, "/", articleID, ".md")
|
query := `
|
||||||
|
SELECT title, created, banner_link, summary, published, creator_id, issue_id, edited_id, clicks, is_in_issue, auto_generated, uuid
|
||||||
|
FROM articles
|
||||||
|
`
|
||||||
|
|
||||||
if err := os.WriteFile(articleAbsName, content, 0644); err != nil {
|
rows, err := db.Query(query)
|
||||||
return fmt.Errorf("error writing article %v to file: %v", articleID, err)
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("error querying DB: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
var created []byte
|
||||||
|
var uuidString string
|
||||||
|
|
||||||
|
articles := make([]*Article, 0)
|
||||||
|
for rows.Next() {
|
||||||
|
article := new(Article)
|
||||||
|
if err = rows.Scan(&article.Title, &created, &article.BannerLink, &article.Summary, &article.Published, &article.CreatorID, &article.IssueID, &article.EditedID, &article.Clicks, &article.IsInIssue, &article.AutoGenerated, &uuidString); err != nil {
|
||||||
|
return nil, fmt.Errorf("error scanning rows: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
article.Created, err = time.Parse("2006-01-02 15:04:05", string(created))
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("error parsing created: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
article.UUID, err = uuid.Parse(uuidString)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("error parsing uuid: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
articles = append(articles, article)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := rows.Err(); err != nil {
|
||||||
|
return nil, fmt.Errorf("error iterating over rows: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return articles, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Article) WriteContentToFile(c *Config, content []byte) error {
|
||||||
|
articlePath := filepath.Join(c.ArticleDir, fmt.Sprint(a.UUID, ".md"))
|
||||||
|
|
||||||
|
if err := os.WriteFile(articlePath, content, 0644); err != nil {
|
||||||
|
return fmt.Errorf("error writing article %v to file: %v", a.UUID, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *Article) ReadContent(c *Config) (string, error) {
|
||||||
|
articlePath := filepath.Join(c.ArticleDir, fmt.Sprint(a.UUID, ".md"))
|
||||||
|
|
||||||
|
content, err := os.ReadFile(articlePath)
|
||||||
|
if err != nil {
|
||||||
|
return "", fmt.Errorf("error reading file %v: %v", articlePath, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return string(content), nil
|
||||||
|
}
|
||||||
|
@ -68,6 +68,10 @@ func (db *DB) GetArticleAuthors(c *Config, articleID int64) ([]*User, error) {
|
|||||||
authors = append(authors, author)
|
authors = append(authors, author)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err = rows.Err(); err != nil {
|
||||||
|
return nil, fmt.Errorf("error iterating over rows: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
return authors, nil
|
return authors, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,6 +68,10 @@ func (db *DB) GetArticleContributors(c *Config, articleID int64) ([]*User, error
|
|||||||
contributors = append(contributors, contributor)
|
contributors = append(contributors, contributor)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err = rows.Err(); err != nil {
|
||||||
|
return nil, fmt.Errorf("error iterating over rows: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
return contributors, nil
|
return contributors, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,6 +61,10 @@ func (db *DB) GetArticleTags(articleID int64) ([]*Tag, error) {
|
|||||||
tags = append(tags, tag)
|
tags = append(tags, tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err = rows.Err(); err != nil {
|
||||||
|
return nil, fmt.Errorf("error iterating over rows: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
return tags, nil
|
return tags, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package backend
|
package backend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
@ -12,6 +13,9 @@ func GenerateAtomFeed(c *Config, db *DB) (*string, error) {
|
|||||||
feed := atom.NewFeed(c.Title)
|
feed := atom.NewFeed(c.Title)
|
||||||
feed.ID = atom.NewID("urn:feed:1")
|
feed.ID = atom.NewID("urn:feed:1")
|
||||||
feed.Subtitle = atom.NewText("text", c.Description)
|
feed.Subtitle = atom.NewText("text", c.Description)
|
||||||
|
if feed.Subtitle == nil {
|
||||||
|
return nil, errors.New("feed subtitle was not created")
|
||||||
|
}
|
||||||
|
|
||||||
linkID := feed.AddLink(atom.NewLink(c.Link))
|
linkID := feed.AddLink(atom.NewLink(c.Link))
|
||||||
feed.Links[linkID].Rel = "self"
|
feed.Links[linkID].Rel = "self"
|
||||||
@ -33,16 +37,25 @@ func GenerateAtomFeed(c *Config, db *DB) (*string, error) {
|
|||||||
entry := atom.NewEntry(articleTitle)
|
entry := atom.NewEntry(articleTitle)
|
||||||
entry.ID = atom.NewID(fmt.Sprint("urn:entry:", article.ID))
|
entry.ID = atom.NewID(fmt.Sprint("urn:entry:", article.ID))
|
||||||
entry.Published = atom.NewDate(article.Created)
|
entry.Published = atom.NewDate(article.Created)
|
||||||
entry.Content = atom.NewContent(atom.OutOfLine, "text/hmtl", fmt.Sprint(c.Domain, "/article/serve/", article.ID))
|
entry.Content = atom.NewContent(atom.OutOfLine, "text/html", fmt.Sprint(c.Domain, "/article/serve/", article.UUID))
|
||||||
|
if entry.Content == nil {
|
||||||
|
return nil, errors.New("entry content was not created")
|
||||||
|
}
|
||||||
|
|
||||||
if article.AutoGenerated {
|
if article.AutoGenerated {
|
||||||
entry.Summary = atom.NewText("text", "automatically generated")
|
entry.Summary = atom.NewText("text", "automatically generated")
|
||||||
|
if entry.Summary == nil {
|
||||||
|
return nil, errors.New("entry summary was not created")
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
articleSummary, err := ConvertToPlain(article.Summary)
|
articleSummary, err := ConvertToPlain(article.Summary)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("error converting description to plain text for Atom feed: %v", err)
|
return nil, fmt.Errorf("error converting description to plain text for Atom feed: %v", err)
|
||||||
}
|
}
|
||||||
entry.Summary = atom.NewText("text", articleSummary)
|
entry.Summary = atom.NewText("text", articleSummary)
|
||||||
|
if entry.Summary == nil {
|
||||||
|
return nil, errors.New("entry summary was not created")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(article.BannerLink) > 0 {
|
if len(article.BannerLink) > 0 {
|
||||||
|
@ -12,58 +12,60 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
AESKeyFile string
|
AESKeyFile string
|
||||||
ArticleDir string
|
ArticleDir string
|
||||||
ConfigFile string
|
AtomFile string
|
||||||
DBName string
|
ConfigFile string
|
||||||
Description string
|
DBName string
|
||||||
Domain string
|
DBPass string
|
||||||
AtomFile string
|
DBUser string
|
||||||
FirebaseKey string
|
Description string
|
||||||
GOBKeyFile string
|
Domain string
|
||||||
Link string
|
FirebaseKey string
|
||||||
LogFile string
|
ImgDir string
|
||||||
PDFDir string
|
IndexDir string
|
||||||
PicsDir string
|
Link string
|
||||||
Port string
|
LogFile string
|
||||||
Title string
|
PDFDir string
|
||||||
Version string
|
Port string
|
||||||
WebDir string
|
Title string
|
||||||
MaxBannerHeight int
|
Version string
|
||||||
MaxBannerWidth int
|
WebDir string
|
||||||
MaxImgHeight int
|
CookieExpiryHours int
|
||||||
MaxImgWidth int
|
MaxBannerHeight int
|
||||||
|
MaxBannerWidth int
|
||||||
|
MaxImgHeight int
|
||||||
|
MaxImgWidth int
|
||||||
}
|
}
|
||||||
|
|
||||||
func newConfig() *Config {
|
func newConfig() *Config {
|
||||||
return &Config{
|
return &Config{
|
||||||
AESKeyFile: "/var/www/cpolis/aes.key",
|
AESKeyFile: "/var/www/cpolis/aes.key",
|
||||||
ArticleDir: "/var/www/cpolis/articles",
|
ArticleDir: "/var/www/cpolis/articles",
|
||||||
AtomFile: "/var/www/cpolis/cpolis.atom",
|
AtomFile: "/var/www/cpolis/cpolis.atom",
|
||||||
ConfigFile: "/etc/cpolis/config.toml",
|
ConfigFile: "/etc/cpolis/config.toml",
|
||||||
DBName: "cpolis",
|
CookieExpiryHours: 24 * 30,
|
||||||
FirebaseKey: "/var/www/cpolis/serviceAccountKey.json",
|
DBName: "cpolis",
|
||||||
GOBKeyFile: "/var/www/cpolis/gob.key",
|
DBUser: "cpolis",
|
||||||
LogFile: "/var/log/cpolis.log",
|
FirebaseKey: "/etc/cpolis/serviceAccountKey.json",
|
||||||
MaxBannerHeight: 1080,
|
ImgDir: "/var/www/cpolis/images",
|
||||||
MaxBannerWidth: 1920,
|
IndexDir: "/var/www/cpolis/index",
|
||||||
MaxImgHeight: 1080,
|
LogFile: "/var/log/cpolis.log",
|
||||||
MaxImgWidth: 1920,
|
MaxBannerHeight: 1080,
|
||||||
PDFDir: "/var/www/cpolis/pdfs",
|
MaxBannerWidth: 1920,
|
||||||
PicsDir: "/var/www/cpolis/pics",
|
MaxImgHeight: 1080,
|
||||||
Port: ":8080",
|
MaxImgWidth: 1920,
|
||||||
Version: "v0.14.0",
|
PDFDir: "/var/www/cpolis/pdfs",
|
||||||
WebDir: "/var/www/cpolis/web",
|
Port: ":1664",
|
||||||
|
Version: "v0.17.1",
|
||||||
|
WebDir: "/var/www/cpolis/web",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func mkDir(path string, perm fs.FileMode) (string, error) {
|
func mkDir(path string, perm fs.FileMode) (string, error) {
|
||||||
var err error
|
name := filepath.Base(path)
|
||||||
|
|
||||||
stringSlice := strings.Split(path, "/")
|
path, err := filepath.Abs(path)
|
||||||
name := stringSlice[len(stringSlice)-1]
|
|
||||||
|
|
||||||
path, err = filepath.Abs(path)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("error finding absolute path for %v directory: %v", name, err)
|
return "", fmt.Errorf("error finding absolute path for %v directory: %v", name, err)
|
||||||
}
|
}
|
||||||
@ -82,20 +84,20 @@ func mkFile(path string, filePerm, dirPerm fs.FileMode) (string, error) {
|
|||||||
return "", fmt.Errorf("error finding absolute path for %v: %v", path, err)
|
return "", fmt.Errorf("error finding absolute path for %v: %v", path, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
stringSlice := strings.Split(path, "/")
|
|
||||||
_, err = os.Stat(path)
|
_, err = os.Stat(path)
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
dir := strings.Join(stringSlice[:len(stringSlice)-1], "/")
|
dir := filepath.Dir(path)
|
||||||
if err = os.MkdirAll(dir, dirPerm); err != nil {
|
if err = os.MkdirAll(dir, dirPerm); err != nil {
|
||||||
return "", fmt.Errorf("error creating %v: %v", dir, err)
|
return "", fmt.Errorf("error creating %v: %v", dir, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
fileName := stringSlice[len(stringSlice)-1]
|
fileName := filepath.Base(path)
|
||||||
file, err := os.Create(dir + "/" + fileName)
|
file, err := os.Create(filepath.Join(dir, fileName))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("error creating %v: %v", fileName, err)
|
return "", fmt.Errorf("error creating %v: %v", fileName, err)
|
||||||
}
|
}
|
||||||
defer file.Close()
|
defer file.Close()
|
||||||
|
|
||||||
if err = file.Chmod(filePerm); err != nil {
|
if err = file.Chmod(filePerm); err != nil {
|
||||||
return "", fmt.Errorf("error setting permissions for %v: %v", fileName, err)
|
return "", fmt.Errorf("error setting permissions for %v: %v", fileName, err)
|
||||||
}
|
}
|
||||||
@ -113,16 +115,19 @@ func (c *Config) handleCliArgs() error {
|
|||||||
flag.StringVar(&c.AtomFile, "feed", c.AtomFile, "atom feed file")
|
flag.StringVar(&c.AtomFile, "feed", c.AtomFile, "atom feed file")
|
||||||
flag.StringVar(&c.ConfigFile, "config", c.ConfigFile, "config file")
|
flag.StringVar(&c.ConfigFile, "config", c.ConfigFile, "config file")
|
||||||
flag.StringVar(&c.DBName, "db", c.DBName, "DB name")
|
flag.StringVar(&c.DBName, "db", c.DBName, "DB name")
|
||||||
|
flag.StringVar(&c.DBPass, "db-pass", c.DBPass, "DB password")
|
||||||
|
flag.StringVar(&c.DBUser, "db-user", c.DBUser, "DB username")
|
||||||
flag.StringVar(&c.Description, "desc", c.Description, "channel description")
|
flag.StringVar(&c.Description, "desc", c.Description, "channel description")
|
||||||
flag.StringVar(&c.Domain, "domain", c.Domain, "domain name")
|
flag.StringVar(&c.Domain, "domain", c.Domain, "domain name")
|
||||||
flag.StringVar(&c.FirebaseKey, "firebase", c.FirebaseKey, "Firebase service account key file")
|
flag.StringVar(&c.FirebaseKey, "firebase", c.FirebaseKey, "Firebase service account key file")
|
||||||
flag.StringVar(&c.GOBKeyFile, "gob", c.GOBKeyFile, "gob key file")
|
flag.StringVar(&c.ImgDir, "images", c.ImgDir, "images directory")
|
||||||
|
flag.StringVar(&c.IndexDir, "index", c.IndexDir, "index directory")
|
||||||
flag.StringVar(&c.Link, "link", c.Link, "channel Link")
|
flag.StringVar(&c.Link, "link", c.Link, "channel Link")
|
||||||
flag.StringVar(&c.LogFile, "log", c.LogFile, "log file")
|
flag.StringVar(&c.LogFile, "log", c.LogFile, "log file")
|
||||||
flag.StringVar(&c.PDFDir, "pdfs", c.PDFDir, "pdf directory")
|
flag.StringVar(&c.PDFDir, "pdfs", c.PDFDir, "pdf directory")
|
||||||
flag.StringVar(&c.PicsDir, "pics", c.PicsDir, "pictures directory")
|
|
||||||
flag.StringVar(&c.Title, "title", c.Title, "channel title")
|
flag.StringVar(&c.Title, "title", c.Title, "channel title")
|
||||||
flag.StringVar(&c.WebDir, "web", c.WebDir, "web directory")
|
flag.StringVar(&c.WebDir, "web", c.WebDir, "web directory")
|
||||||
|
flag.IntVar(&c.CookieExpiryHours, "cookie-expiry-hours", c.CookieExpiryHours, "cookies expire after this amount of hours")
|
||||||
flag.IntVar(&c.MaxBannerHeight, "banner-height", c.MaxBannerHeight, "maximum banner height")
|
flag.IntVar(&c.MaxBannerHeight, "banner-height", c.MaxBannerHeight, "maximum banner height")
|
||||||
flag.IntVar(&c.MaxBannerWidth, "banner-width", c.MaxBannerWidth, "maximum banner width")
|
flag.IntVar(&c.MaxBannerWidth, "banner-width", c.MaxBannerWidth, "maximum banner width")
|
||||||
flag.IntVar(&c.MaxImgHeight, "img-height", c.MaxImgHeight, "maximum image height")
|
flag.IntVar(&c.MaxImgHeight, "img-height", c.MaxImgHeight, "maximum image height")
|
||||||
@ -158,6 +163,10 @@ func (c *Config) setupConfig(cliConfig *Config) error {
|
|||||||
if cliConfig.AESKeyFile != defaultConfig.AESKeyFile {
|
if cliConfig.AESKeyFile != defaultConfig.AESKeyFile {
|
||||||
c.AESKeyFile = cliConfig.AESKeyFile
|
c.AESKeyFile = cliConfig.AESKeyFile
|
||||||
}
|
}
|
||||||
|
c.AESKeyFile, err = filepath.Abs(c.AESKeyFile)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("error setting absolute filepath for AESKeyFile: %v", err)
|
||||||
|
}
|
||||||
c.AESKeyFile, err = mkFile(c.AESKeyFile, 0600, 0700)
|
c.AESKeyFile, err = mkFile(c.AESKeyFile, 0600, 0700)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error setting up file: %v", err)
|
return fmt.Errorf("error setting up file: %v", err)
|
||||||
@ -166,15 +175,43 @@ func (c *Config) setupConfig(cliConfig *Config) error {
|
|||||||
if cliConfig.ArticleDir != defaultConfig.ArticleDir {
|
if cliConfig.ArticleDir != defaultConfig.ArticleDir {
|
||||||
c.ArticleDir = cliConfig.ArticleDir
|
c.ArticleDir = cliConfig.ArticleDir
|
||||||
}
|
}
|
||||||
|
c.ArticleDir, err = filepath.Abs(c.ArticleDir)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("error setting absolute filepath for ArticleDir: %v", err)
|
||||||
|
}
|
||||||
c.ArticleDir, err = mkDir(c.ArticleDir, 0700)
|
c.ArticleDir, err = mkDir(c.ArticleDir, 0700)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error setting up directory: %v", err)
|
return fmt.Errorf("error setting up directory: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if cliConfig.AtomFile != defaultConfig.AtomFile {
|
||||||
|
c.AtomFile = cliConfig.AtomFile
|
||||||
|
}
|
||||||
|
c.AtomFile, err = filepath.Abs(c.AtomFile)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("error setting absolute filepath for AtomFile: %v", err)
|
||||||
|
}
|
||||||
|
c.AtomFile, err = mkFile(c.AtomFile, 0644, 0744)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("error setting up file: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if cliConfig.CookieExpiryHours != defaultConfig.CookieExpiryHours {
|
||||||
|
c.CookieExpiryHours = cliConfig.CookieExpiryHours
|
||||||
|
}
|
||||||
|
|
||||||
if cliConfig.DBName != defaultConfig.DBName {
|
if cliConfig.DBName != defaultConfig.DBName {
|
||||||
c.DBName = cliConfig.DBName
|
c.DBName = cliConfig.DBName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if cliConfig.DBPass != defaultConfig.DBPass {
|
||||||
|
c.DBPass = cliConfig.DBPass
|
||||||
|
}
|
||||||
|
|
||||||
|
if cliConfig.DBUser != defaultConfig.DBUser {
|
||||||
|
c.DBUser = cliConfig.DBUser
|
||||||
|
}
|
||||||
|
|
||||||
if cliConfig.Description != defaultConfig.Description {
|
if cliConfig.Description != defaultConfig.Description {
|
||||||
c.Description = cliConfig.Description
|
c.Description = cliConfig.Description
|
||||||
}
|
}
|
||||||
@ -182,31 +219,43 @@ func (c *Config) setupConfig(cliConfig *Config) error {
|
|||||||
if cliConfig.Domain != defaultConfig.Domain {
|
if cliConfig.Domain != defaultConfig.Domain {
|
||||||
c.Domain = cliConfig.Domain
|
c.Domain = cliConfig.Domain
|
||||||
}
|
}
|
||||||
domainStrings := strings.Split(c.Domain, "/")
|
domainStrings := strings.Split(c.Domain, ":")
|
||||||
if domainStrings[0] != "http:" && domainStrings[0] != "https:" {
|
if domainStrings[0] != "http" && domainStrings[0] != "https" {
|
||||||
c.Domain = "https://" + c.Domain
|
c.Domain = "https://" + c.Domain
|
||||||
}
|
}
|
||||||
|
|
||||||
if cliConfig.AtomFile != defaultConfig.AtomFile {
|
|
||||||
c.AtomFile = cliConfig.AtomFile
|
|
||||||
}
|
|
||||||
c.AtomFile, err = mkFile(c.AtomFile, 0644, 0744)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("error setting up file: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if cliConfig.FirebaseKey != defaultConfig.FirebaseKey {
|
if cliConfig.FirebaseKey != defaultConfig.FirebaseKey {
|
||||||
c.FirebaseKey = cliConfig.FirebaseKey
|
c.FirebaseKey = cliConfig.FirebaseKey
|
||||||
}
|
}
|
||||||
|
c.FirebaseKey, err = filepath.Abs(c.FirebaseKey)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("error setting absolute filepath for FirebaseKey: %v", err)
|
||||||
|
}
|
||||||
c.FirebaseKey, err = mkFile(c.FirebaseKey, 0600, 0700)
|
c.FirebaseKey, err = mkFile(c.FirebaseKey, 0600, 0700)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error setting up file: %v", err)
|
return fmt.Errorf("error setting up file: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if cliConfig.GOBKeyFile != defaultConfig.GOBKeyFile {
|
if cliConfig.ImgDir != defaultConfig.ImgDir {
|
||||||
c.GOBKeyFile = cliConfig.GOBKeyFile
|
c.ImgDir = cliConfig.ImgDir
|
||||||
}
|
}
|
||||||
c.GOBKeyFile, err = mkFile(c.GOBKeyFile, 0600, 0700)
|
c.ImgDir, err = filepath.Abs(c.ImgDir)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("error setting absolute filepath for PicsDir: %v", err)
|
||||||
|
}
|
||||||
|
c.ImgDir, err = mkDir(c.ImgDir, 0700)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("error setting up directory: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if cliConfig.IndexDir != defaultConfig.IndexDir {
|
||||||
|
c.IndexDir = cliConfig.IndexDir
|
||||||
|
}
|
||||||
|
c.IndexDir, err = filepath.Abs(c.IndexDir)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("error setting absolute filepath for IndexDir: %v", err)
|
||||||
|
}
|
||||||
|
c.IndexDir, err = mkDir(c.IndexDir, 0700)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error setting up file: %v", err)
|
return fmt.Errorf("error setting up file: %v", err)
|
||||||
}
|
}
|
||||||
@ -218,6 +267,10 @@ func (c *Config) setupConfig(cliConfig *Config) error {
|
|||||||
if cliConfig.LogFile != defaultConfig.LogFile {
|
if cliConfig.LogFile != defaultConfig.LogFile {
|
||||||
c.LogFile = cliConfig.LogFile
|
c.LogFile = cliConfig.LogFile
|
||||||
}
|
}
|
||||||
|
c.LogFile, err = filepath.Abs(c.LogFile)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("error setting absolute filepath for LogFile: %v", err)
|
||||||
|
}
|
||||||
c.LogFile, err = mkFile(c.LogFile, 0600, 0700)
|
c.LogFile, err = mkFile(c.LogFile, 0600, 0700)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error setting up file: %v", err)
|
return fmt.Errorf("error setting up file: %v", err)
|
||||||
@ -242,15 +295,11 @@ func (c *Config) setupConfig(cliConfig *Config) error {
|
|||||||
if cliConfig.PDFDir != defaultConfig.PDFDir {
|
if cliConfig.PDFDir != defaultConfig.PDFDir {
|
||||||
c.PDFDir = cliConfig.PDFDir
|
c.PDFDir = cliConfig.PDFDir
|
||||||
}
|
}
|
||||||
c.PDFDir, err = mkDir(c.PDFDir, 0700)
|
c.PDFDir, err = filepath.Abs(c.PDFDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error setting up directory: %v", err)
|
return fmt.Errorf("error setting absolute filepath for PDFDir: %v", err)
|
||||||
}
|
}
|
||||||
|
c.PDFDir, err = mkDir(c.PDFDir, 0700)
|
||||||
if cliConfig.PicsDir != defaultConfig.PicsDir {
|
|
||||||
c.PicsDir = cliConfig.PicsDir
|
|
||||||
}
|
|
||||||
c.PicsDir, err = mkDir(c.PicsDir, 0700)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error setting up directory: %v", err)
|
return fmt.Errorf("error setting up directory: %v", err)
|
||||||
}
|
}
|
||||||
@ -266,6 +315,10 @@ func (c *Config) setupConfig(cliConfig *Config) error {
|
|||||||
if cliConfig.WebDir != defaultConfig.WebDir {
|
if cliConfig.WebDir != defaultConfig.WebDir {
|
||||||
c.WebDir = cliConfig.WebDir
|
c.WebDir = cliConfig.WebDir
|
||||||
}
|
}
|
||||||
|
c.WebDir, err = filepath.Abs(c.WebDir)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("error setting absolute filepath for WebDir: %v", err)
|
||||||
|
}
|
||||||
c.WebDir, err = mkDir(c.WebDir, 0700)
|
c.WebDir, err = mkDir(c.WebDir, 0700)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error setting up directory: %v", err)
|
return fmt.Errorf("error setting up directory: %v", err)
|
||||||
|
@ -30,45 +30,32 @@ type (
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func getUsername() (string, error) {
|
func getDBUsername(c *Config) error {
|
||||||
user := os.Getenv("DB_USER")
|
if c.DBUser == "" {
|
||||||
if user == "" {
|
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
fmt.Printf("DB Benutzer: ")
|
fmt.Printf("DB Benutzer: ")
|
||||||
user, err = bufio.NewReader(os.Stdin).ReadString('\n')
|
c.DBUser, err = bufio.NewReader(os.Stdin).ReadString('\n')
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("error reading username: %v", err)
|
return fmt.Errorf("error reading username: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return strings.TrimSpace(user), nil
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func getPassword() (string, error) {
|
func getDBPassword(c *Config) error {
|
||||||
pass := os.Getenv("DB_PASS")
|
if c.DBPass == "" {
|
||||||
if pass == "" {
|
|
||||||
fmt.Printf("DB Passwort: ")
|
fmt.Printf("DB Passwort: ")
|
||||||
bytePass, err := term.ReadPassword(int(syscall.Stdin))
|
bytePass, err := term.ReadPassword(int(syscall.Stdin))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("error reading password: %v", err)
|
return fmt.Errorf("error reading password: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
pass = strings.TrimSpace(string(bytePass))
|
c.DBPass = strings.TrimSpace(string(bytePass))
|
||||||
}
|
}
|
||||||
return pass, nil
|
return nil
|
||||||
}
|
|
||||||
|
|
||||||
func getCredentials() (string, string, error) {
|
|
||||||
user, err := getUsername()
|
|
||||||
if err != nil {
|
|
||||||
return "", "", fmt.Errorf("error getting username: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
pass, err := getPassword()
|
|
||||||
if err != nil {
|
|
||||||
return "", "", fmt.Errorf("error getting password: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return user, pass, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func wait(iteration int) {
|
func wait(iteration int) {
|
||||||
@ -77,26 +64,33 @@ func wait(iteration int) {
|
|||||||
time.Sleep(waitTime + jitter)
|
time.Sleep(waitTime + jitter)
|
||||||
}
|
}
|
||||||
|
|
||||||
func OpenDB(dbName string) (*DB, error) {
|
func OpenDB(c *Config) (*DB, error) {
|
||||||
var err error
|
var err error
|
||||||
db := DB{DB: new(sql.DB)}
|
db := new(DB)
|
||||||
|
|
||||||
|
if err := getDBUsername(c); err != nil {
|
||||||
|
return nil, fmt.Errorf("error getting DB username: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := getDBPassword(c); err != nil {
|
||||||
|
return nil, fmt.Errorf("error getting DB password: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
cfg := mysql.NewConfig()
|
cfg := mysql.NewConfig()
|
||||||
cfg.DBName = dbName
|
cfg.DBName = c.DBName
|
||||||
cfg.User, cfg.Passwd, err = getCredentials()
|
cfg.User = c.DBUser
|
||||||
if err != nil {
|
cfg.Passwd = c.DBPass
|
||||||
return nil, fmt.Errorf("error reading user credentials for DB: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
db.DB, err = sql.Open("mysql", cfg.FormatDSN())
|
db.DB, err = sql.Open("mysql", cfg.FormatDSN())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("error opening DB: %v", err)
|
return nil, fmt.Errorf("error opening DB: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = db.Ping(); err != nil {
|
if err = db.Ping(); err != nil {
|
||||||
return nil, fmt.Errorf("error pinging DB: %v", err)
|
return nil, fmt.Errorf("error pinging DB: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return &db, nil
|
return db, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (db *DB) UpdateAttributes(a ...*Attribute) error {
|
func (db *DB) UpdateAttributes(a ...*Attribute) error {
|
||||||
|
60
cmd/backend/docx.go
Normal file
60
cmd/backend/docx.go
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
package backend
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"os/exec"
|
||||||
|
"path/filepath"
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
|
)
|
||||||
|
|
||||||
|
func ConvertToMarkdown(c *Config, filename string) ([]byte, error) {
|
||||||
|
var stderr bytes.Buffer
|
||||||
|
|
||||||
|
tmpDir, err := os.MkdirTemp(os.TempDir(), "cpolis_images")
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("error creating temporary directory: %v", err)
|
||||||
|
}
|
||||||
|
defer os.RemoveAll(tmpDir)
|
||||||
|
|
||||||
|
articleFileName := filepath.Join(os.TempDir(), fmt.Sprint(uuid.New(), ".md"))
|
||||||
|
cmd := exec.Command("pandoc", "-s", "-L", filepath.Join("scripts", "create_toc.lua"), "-f", "docx", "-t", "gfm", "-o", articleFileName, "--extract-media", tmpDir, filename) // TODO: Is writing to a file necessary?
|
||||||
|
cmd.Stderr = &stderr
|
||||||
|
if err = cmd.Run(); err != nil {
|
||||||
|
return nil, fmt.Errorf("error converting docx to markdown: %v: %v", err, stderr.String())
|
||||||
|
}
|
||||||
|
defer os.Remove(articleFileName)
|
||||||
|
|
||||||
|
articleContent, err := os.ReadFile(articleFileName)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("error reading markdown file: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
re := regexp.MustCompile(`\{width=[^}]+height=[^}]+\}`)
|
||||||
|
articleContent = re.ReplaceAll(articleContent, []byte(""))
|
||||||
|
|
||||||
|
imageNames, err := filepath.Glob(filepath.Join(tmpDir, "media", "*"))
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("error getting docx images from temporary directory: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, name := range imageNames {
|
||||||
|
image, err := os.Open(name)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("error opening image file %v: %v", name, err)
|
||||||
|
}
|
||||||
|
defer image.Close()
|
||||||
|
|
||||||
|
newImageName, err := SaveImage(image, c.MaxImgHeight, c.MaxImgWidth, c.ImgDir)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("error saving image %v: %v", name, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
articleContent = regexp.MustCompile(name).ReplaceAll(articleContent, []byte(c.Domain+"/image/serve/"+newImageName))
|
||||||
|
}
|
||||||
|
|
||||||
|
return articleContent, nil
|
||||||
|
}
|
@ -1,10 +1,14 @@
|
|||||||
package backend
|
package backend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bufio"
|
||||||
"fmt"
|
"fmt"
|
||||||
"image"
|
"image"
|
||||||
"io"
|
"io"
|
||||||
|
"io/fs"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/chai2010/webp"
|
"github.com/chai2010/webp"
|
||||||
"github.com/disintegration/imaging"
|
"github.com/disintegration/imaging"
|
||||||
@ -13,6 +17,66 @@ import (
|
|||||||
|
|
||||||
var ErrUnsupportedFormat error = image.ErrFormat // used internally by imaging
|
var ErrUnsupportedFormat error = image.ErrFormat // used internally by imaging
|
||||||
|
|
||||||
|
func checkImageUsage(c *Config, db *DB, name string) (bool, error) {
|
||||||
|
imageWasFound := false
|
||||||
|
|
||||||
|
if err := filepath.Walk(c.ArticleDir, func(path string, info fs.FileInfo, err error) error {
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("error walking articles filepath: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !info.IsDir() {
|
||||||
|
mdFile, err := os.Open(path)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("error opening article %v: %v", info.Name(), err)
|
||||||
|
}
|
||||||
|
defer mdFile.Close()
|
||||||
|
|
||||||
|
scanner := bufio.NewScanner(mdFile)
|
||||||
|
for scanner.Scan() {
|
||||||
|
if strings.Contains(scanner.Text(), name) {
|
||||||
|
imageWasFound = true
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return scanner.Err()
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}); err != nil {
|
||||||
|
return false, fmt.Errorf("error walking articles filepath: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !imageWasFound {
|
||||||
|
users, err := db.GetAllUsers(c)
|
||||||
|
if err != nil {
|
||||||
|
return false, fmt.Errorf("error getting all users: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, user := range users {
|
||||||
|
if name == user.ProfilePicLink {
|
||||||
|
imageWasFound = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !imageWasFound {
|
||||||
|
articles, err := db.GetAllArticles()
|
||||||
|
if err != nil {
|
||||||
|
return false, fmt.Errorf("error getting all articles: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, article := range articles {
|
||||||
|
if name == article.BannerLink {
|
||||||
|
imageWasFound = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return imageWasFound, nil
|
||||||
|
}
|
||||||
|
|
||||||
func SaveImage(src io.Reader, maxHeight, maxWidth int, path string) (string, error) {
|
func SaveImage(src io.Reader, maxHeight, maxWidth int, path string) (string, error) {
|
||||||
img, err := imaging.Decode(src, imaging.AutoOrientation(true))
|
img, err := imaging.Decode(src, imaging.AutoOrientation(true))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -30,7 +94,7 @@ func SaveImage(src io.Reader, maxHeight, maxWidth int, path string) (string, err
|
|||||||
}
|
}
|
||||||
|
|
||||||
filename := fmt.Sprint(uuid.New(), ".webp")
|
filename := fmt.Sprint(uuid.New(), ".webp")
|
||||||
file, err := os.Create(path + filename)
|
file, err := os.Create(filepath.Join(path, filename))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("error creating new image file: %v", err)
|
return "", fmt.Errorf("error creating new image file: %v", err)
|
||||||
}
|
}
|
||||||
@ -42,3 +106,33 @@ func SaveImage(src io.Reader, maxHeight, maxWidth int, path string) (string, err
|
|||||||
|
|
||||||
return filename, nil
|
return filename, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func CleanUpImages(c *Config, db *DB) error {
|
||||||
|
if err := filepath.Walk(c.ImgDir, func(path string, info fs.FileInfo, err error) error {
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("error walking images filepath: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !info.IsDir() {
|
||||||
|
imageName := info.Name()
|
||||||
|
imagePath := path
|
||||||
|
|
||||||
|
imageWasFound, err := checkImageUsage(c, db, imageName)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("error checking image usage: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !imageWasFound {
|
||||||
|
if err = os.Remove(imagePath); err != nil {
|
||||||
|
return fmt.Errorf("error removing unused image: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}); err != nil {
|
||||||
|
return fmt.Errorf("error cleaning up: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
136
cmd/backend/index.go
Normal file
136
cmd/backend/index.go
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
package backend
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"sync"
|
||||||
|
|
||||||
|
"github.com/blevesearch/bleve"
|
||||||
|
)
|
||||||
|
|
||||||
|
type (
|
||||||
|
Index struct {
|
||||||
|
index bleve.Index
|
||||||
|
mu sync.RWMutex
|
||||||
|
}
|
||||||
|
|
||||||
|
Result struct{ *bleve.SearchResult }
|
||||||
|
)
|
||||||
|
|
||||||
|
func (i *Index) isIndexed(filename string, errChan chan<- error) bool {
|
||||||
|
i.mu.RLock()
|
||||||
|
defer i.mu.RUnlock()
|
||||||
|
|
||||||
|
query := bleve.NewDocIDQuery([]string{filename})
|
||||||
|
request := bleve.NewSearchRequest(query)
|
||||||
|
result, err := i.index.Search(request)
|
||||||
|
if err != nil {
|
||||||
|
errChan <- fmt.Errorf("error searching for file %v in index: %v", filename, err)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return len(result.Hits) > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *Index) indexAllArticles(c *Config, db *DB) error {
|
||||||
|
articles, err := db.GetAllArticles()
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("error getting all articles from DB: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
errChan := make(chan error, len(articles))
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
wg.Wait()
|
||||||
|
close(errChan)
|
||||||
|
}()
|
||||||
|
|
||||||
|
for _, article := range articles {
|
||||||
|
wg.Add(1)
|
||||||
|
go func() {
|
||||||
|
defer wg.Done()
|
||||||
|
|
||||||
|
filename := article.UUID.String()
|
||||||
|
content, err := article.ReadContent(c)
|
||||||
|
if err != nil {
|
||||||
|
errChan <- fmt.Errorf("error reading content of article %v: %v", filename, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if !i.isIndexed(filename, errChan) {
|
||||||
|
if err := i.Add(filename, content); err != nil {
|
||||||
|
errChan <- fmt.Errorf("error adding file %v to index: %v", filename, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
errChan <- nil
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
if err = <-errChan; err != nil {
|
||||||
|
return fmt.Errorf("error(s) indexing all articles: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func InitIndex(c *Config) (*Index, error) {
|
||||||
|
var err error
|
||||||
|
index := new(Index)
|
||||||
|
|
||||||
|
index.index, err = bleve.Open(c.IndexDir)
|
||||||
|
if err != nil {
|
||||||
|
mapping := bleve.NewIndexMapping()
|
||||||
|
index.index, err = bleve.New(c.IndexDir, mapping)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("error creating new index file: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return index, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *Index) Add(filename, content string) error {
|
||||||
|
i.mu.Lock()
|
||||||
|
defer i.mu.Unlock()
|
||||||
|
|
||||||
|
doc := map[string]string{
|
||||||
|
"name": filename,
|
||||||
|
"body": content,
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := i.index.Index(filename, doc); err != nil {
|
||||||
|
return fmt.Errorf("error indexing file %v: %v", filename, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *Index) Query(q string) (*Result, error) {
|
||||||
|
i.mu.RLock()
|
||||||
|
defer i.mu.RUnlock()
|
||||||
|
|
||||||
|
query := bleve.NewQueryStringQuery(q)
|
||||||
|
request := bleve.NewSearchRequest(query)
|
||||||
|
result, err := i.index.Search(request)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("error querying index for \"%v\": %v", q, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(result.Hits) < 1 {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return &Result{result}, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *Index) Delete(filename string) error {
|
||||||
|
i.mu.Lock()
|
||||||
|
defer i.mu.Unlock()
|
||||||
|
|
||||||
|
if err := i.index.Delete(filename); err != nil {
|
||||||
|
return fmt.Errorf("error deleting file %v from index: %v", filename, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
@ -6,16 +6,32 @@ import (
|
|||||||
|
|
||||||
"github.com/microcosm-cc/bluemonday"
|
"github.com/microcosm-cc/bluemonday"
|
||||||
"github.com/yuin/goldmark"
|
"github.com/yuin/goldmark"
|
||||||
|
"github.com/yuin/goldmark/extension"
|
||||||
|
"github.com/yuin/goldmark/parser"
|
||||||
|
"github.com/yuin/goldmark/renderer/html"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ConvertToHTML(md string) (string, error) {
|
func ConvertToHTML(md string) (string, error) {
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
|
|
||||||
if err := goldmark.Convert([]byte(md), &buf); err != nil {
|
gm := goldmark.New(
|
||||||
|
goldmark.WithExtensions(
|
||||||
|
extension.GFM,
|
||||||
|
),
|
||||||
|
goldmark.WithParserOptions(
|
||||||
|
parser.WithAttribute(),
|
||||||
|
),
|
||||||
|
goldmark.WithRendererOptions(
|
||||||
|
html.WithUnsafe(), // HTML-Inhalte erlauben
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
if err := gm.Convert([]byte(md), &buf); err != nil {
|
||||||
return "", fmt.Errorf("error converting markdown to html: %v", err)
|
return "", fmt.Errorf("error converting markdown to html: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
p := bluemonday.UGCPolicy()
|
p := bluemonday.UGCPolicy()
|
||||||
|
p.AllowAttrs("id").OnElements("h1", "h2", "h3", "h4", "h5", "h6")
|
||||||
html := p.Sanitize(buf.String())
|
html := p.Sanitize(buf.String())
|
||||||
|
|
||||||
return html, nil
|
return html, nil
|
||||||
|
@ -1,63 +0,0 @@
|
|||||||
package backend
|
|
||||||
|
|
||||||
import (
|
|
||||||
"crypto/rand"
|
|
||||||
"encoding/gob"
|
|
||||||
"fmt"
|
|
||||||
"io"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"github.com/gorilla/sessions"
|
|
||||||
)
|
|
||||||
|
|
||||||
type (
|
|
||||||
CookieStore struct{ sessions.CookieStore }
|
|
||||||
Session struct{ sessions.Session }
|
|
||||||
)
|
|
||||||
|
|
||||||
func NewKey() ([]byte, error) {
|
|
||||||
key := make([]byte, 32)
|
|
||||||
|
|
||||||
if _, err := io.ReadFull(rand.Reader, key); err != nil {
|
|
||||||
return nil, fmt.Errorf("error generating key: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return key, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func SaveKey(key []byte, filename string) error {
|
|
||||||
file, err := os.Create(filename)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("error creating key file: %v", err)
|
|
||||||
}
|
|
||||||
defer file.Close()
|
|
||||||
file.Chmod(0600)
|
|
||||||
|
|
||||||
if err = gob.NewEncoder(file).Encode(key); err != nil {
|
|
||||||
return fmt.Errorf("error ecoding key: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func LoadKey(filename string) ([]byte, error) {
|
|
||||||
file, err := os.Open(filename)
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("error opening key file: %v", err)
|
|
||||||
}
|
|
||||||
defer file.Close()
|
|
||||||
|
|
||||||
key := make([]byte, 32)
|
|
||||||
if err = gob.NewDecoder(file).Decode(&key); err != nil {
|
|
||||||
return nil, fmt.Errorf("error decoding key: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return key, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewCookieStore(key []byte) *CookieStore {
|
|
||||||
store := sessions.NewCookieStore(key)
|
|
||||||
store.Options.Secure = true
|
|
||||||
store.Options.HttpOnly = true
|
|
||||||
return &CookieStore{*store}
|
|
||||||
}
|
|
@ -31,5 +31,9 @@ func (db *DB) GetTagList() ([]*Tag, error) {
|
|||||||
tagList = append(tagList, tag)
|
tagList = append(tagList, tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err = rows.Err(); err != nil {
|
||||||
|
return nil, fmt.Errorf("error iterating over rows: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
return tagList, nil
|
return tagList, nil
|
||||||
}
|
}
|
||||||
|
@ -117,6 +117,9 @@ func aesDecrypt(c *Config, ciphertext string) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
nonceSize := gcm.NonceSize()
|
nonceSize := gcm.NonceSize()
|
||||||
|
if len(data) < nonceSize {
|
||||||
|
return "", errors.New("ciphertext too short")
|
||||||
|
}
|
||||||
nonce, cipherText := data[:nonceSize], data[nonceSize:]
|
nonce, cipherText := data[:nonceSize], data[nonceSize:]
|
||||||
|
|
||||||
plaintext, err := gcm.Open(nil, nonce, cipherText, nil)
|
plaintext, err := gcm.Open(nil, nonce, cipherText, nil)
|
||||||
@ -450,8 +453,6 @@ func (db *DB) AddFirstUser(c *Config, u *User, pass string) (int64, error) {
|
|||||||
|
|
||||||
func (db *DB) GetAllUsers(c *Config) ([]*User, error) {
|
func (db *DB) GetAllUsers(c *Config) ([]*User, error) {
|
||||||
var aesFirstName, aesLastName, aesEmail string
|
var aesFirstName, aesLastName, aesEmail string
|
||||||
var err error
|
|
||||||
|
|
||||||
query := "SELECT id, username, first_name, last_name, email, profile_pic_link, role FROM users"
|
query := "SELECT id, username, first_name, last_name, email, profile_pic_link, role FROM users"
|
||||||
|
|
||||||
rows, err := db.Query(query)
|
rows, err := db.Query(query)
|
||||||
@ -484,6 +485,10 @@ func (db *DB) GetAllUsers(c *Config) ([]*User, error) {
|
|||||||
users = append(users, user)
|
users = append(users, user)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err = rows.Err(); err != nil {
|
||||||
|
return nil, fmt.Errorf("error iterating over rows: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
return users, nil
|
return users, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -523,6 +528,10 @@ func (db *DB) GetAllUsersMap(c *Config) (map[int64]*User, error) {
|
|||||||
users[user.ID] = user
|
users[user.ID] = user
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err = rows.Err(); err != nil {
|
||||||
|
return nil, fmt.Errorf("error iterating over rows: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
return users, nil
|
return users, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
package calls
|
package calls
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"path/filepath"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
b "streifling.com/jason/cpolis/cmd/backend"
|
b "streifling.com/jason/cpolis/cmd/backend"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -37,15 +39,15 @@ func ServeArticle(c *b.Config, db *b.DB) http.HandlerFunc {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
idString := r.PathValue("id")
|
uuidString := r.PathValue("uuid")
|
||||||
id, err := strconv.ParseInt(idString, 10, 64)
|
uuid, err := uuid.Parse(uuidString)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
article, err := db.GetArticle(id)
|
article, err := db.GetArticleByUUID(uuid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
@ -56,8 +58,8 @@ func ServeArticle(c *b.Config, db *b.DB) http.HandlerFunc {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
articleAbsName := fmt.Sprint(c.ArticleDir, "/", article.ID, ".md")
|
articlePath := filepath.Join(c.ArticleDir, fmt.Sprint(article.UUID, ".md"))
|
||||||
contentBytes, err := os.ReadFile(articleAbsName)
|
contentBytes, err := os.ReadFile(articlePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
@ -87,15 +89,14 @@ func ServeArticle(c *b.Config, db *b.DB) http.HandlerFunc {
|
|||||||
|
|
||||||
func ServeClicks(db *b.DB) http.HandlerFunc {
|
func ServeClicks(db *b.DB) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
idString := r.PathValue("id")
|
uuid, err := uuid.Parse(r.PathValue("uuid"))
|
||||||
id, err := strconv.ParseInt(idString, 10, 64)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
article, err := db.GetArticle(id)
|
article, err := db.GetArticleByUUID(uuid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
@ -109,3 +110,25 @@ func ServeClicks(db *b.DB) http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func QueryArticles(c *b.Config, i *b.Index) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
if !tokenIsVerified(w, r, c) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := i.Query(r.PathValue("query"))
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
w.Header().Set("Content-Type", "application/json")
|
||||||
|
if err := json.NewEncoder(w).Encode(result); err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
http.Error(w, fmt.Sprintf("error encoding results to JSON: %v", err), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
package calls
|
package calls
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"path/filepath"
|
|
||||||
|
|
||||||
b "streifling.com/jason/cpolis/cmd/backend"
|
b "streifling.com/jason/cpolis/cmd/backend"
|
||||||
)
|
)
|
||||||
@ -14,13 +12,6 @@ func ServeAtomFeed(c *b.Config) http.HandlerFunc {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
absFilepath, err := filepath.Abs(c.AtomFile)
|
http.ServeFile(w, r, c.AtomFile)
|
||||||
if err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
http.ServeFile(w, r, absFilepath)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package calls
|
package calls
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
@ -9,21 +8,14 @@ import (
|
|||||||
f "streifling.com/jason/cpolis/cmd/frontend"
|
f "streifling.com/jason/cpolis/cmd/frontend"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ServeImage(c *b.Config, s *b.CookieStore) http.HandlerFunc {
|
func ServeImage(c *b.Config, s map[string]*f.Session) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
if _, err := f.GetSession(w, r, c, s); err != nil {
|
if !f.SessionIsActive(r, s) {
|
||||||
if !tokenIsVerified(w, r, c) {
|
if !tokenIsVerified(w, r, c) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
absFilepath, err := filepath.Abs(c.PicsDir)
|
http.ServeFile(w, r, filepath.Join(c.ImgDir, r.PathValue("pic")))
|
||||||
if err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
http.ServeFile(w, r, absFilepath+"/"+r.PathValue("pic"))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
b "streifling.com/jason/cpolis/cmd/backend"
|
b "streifling.com/jason/cpolis/cmd/backend"
|
||||||
)
|
)
|
||||||
@ -42,6 +43,6 @@ func ServePDF(c *b.Config) http.HandlerFunc {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
http.ServeFile(w, r, c.PDFDir+"/"+r.PathValue("id"))
|
http.ServeFile(w, r, filepath.Join(c.PDFDir, r.PathValue("id")))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,10 +6,12 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
b "streifling.com/jason/cpolis/cmd/backend"
|
b "streifling.com/jason/cpolis/cmd/backend"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -45,39 +47,34 @@ type EditorHTMLData struct {
|
|||||||
Contributors []*b.User
|
Contributors []*b.User
|
||||||
}
|
}
|
||||||
|
|
||||||
func WriteArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
func WriteArticle(c *b.Config, db *b.DB, s map[string]*Session) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
session, err := GetSession(w, r, c, s)
|
session, err := ManageSession(w, r, c, s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
http.Error(w, "Die Session ist abgelaufen. Bitte erneut anmelden.", http.StatusUnauthorized)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var data *EditorHTMLData
|
|
||||||
if session.Values["article"] == nil {
|
|
||||||
data = &EditorHTMLData{Action: "submit", Article: new(b.Article), ArticleUsers: make(map[string]*ArticleUser)}
|
|
||||||
} else {
|
|
||||||
data = session.Values["article"].(*EditorHTMLData)
|
|
||||||
}
|
|
||||||
|
|
||||||
users, err := db.GetAllUsers(c)
|
users, err := db.GetAllUsers(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data := &EditorHTMLData{Action: "submit", Article: new(b.Article), ArticleUsers: make(map[string]*ArticleUser)}
|
||||||
for _, user := range users {
|
for _, user := range users {
|
||||||
data.ArticleUsers[fmt.Sprint(user.LastName, user.FirstName, user.ID)] = &ArticleUser{User: user, ArticleRole: None}
|
data.ArticleUsers[fmt.Sprint(user.LastName, user.FirstName, user.ID)] = &ArticleUser{User: user, ArticleRole: None}
|
||||||
}
|
}
|
||||||
|
|
||||||
creator, err := db.GetUser(c, session.Values["id"].(int64))
|
creator, err := db.GetUser(c, session.User.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
data.Creator = data.ArticleUsers[fmt.Sprint(creator.LastName, creator.FirstName, creator.ID)]
|
data.Creator = data.ArticleUsers[fmt.Sprint(creator.LastName, creator.FirstName, creator.ID)]
|
||||||
|
data.Creator.ArticleRole = Author
|
||||||
delete(data.ArticleUsers, fmt.Sprint(creator.LastName, creator.FirstName, creator.ID))
|
delete(data.ArticleUsers, fmt.Sprint(creator.LastName, creator.FirstName, creator.ID))
|
||||||
|
|
||||||
data.Tags, err = db.GetTagList()
|
data.Tags, err = db.GetTagList()
|
||||||
@ -87,7 +84,7 @@ func WriteArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
tmpl, err := template.ParseFiles(c.WebDir + "/templates/editor.html")
|
tmpl, err := template.ParseFiles(filepath.Join(c.WebDir, "templates", "editor.html"))
|
||||||
if err = template.Must(tmpl, err).ExecuteTemplate(w, "page-content", data); err != nil {
|
if err = template.Must(tmpl, err).ExecuteTemplate(w, "page-content", data); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
@ -96,19 +93,11 @@ func WriteArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func SubmitArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
func SubmitArticle(c *b.Config, db *b.DB, s map[string]*Session) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
session, err := GetSession(w, r, c, s)
|
session, err := ManageSession(w, r, c, s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
http.Error(w, "Die Session ist abgelaufen. Bitte erneut anmelden.", http.StatusUnauthorized)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
session.Values["article"] = nil
|
|
||||||
if err = session.Save(r, w); err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,12 +105,13 @@ func SubmitArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|||||||
Title: r.PostFormValue("article-title"),
|
Title: r.PostFormValue("article-title"),
|
||||||
BannerLink: r.PostFormValue("article-banner-url"),
|
BannerLink: r.PostFormValue("article-banner-url"),
|
||||||
Summary: r.PostFormValue("article-summary"),
|
Summary: r.PostFormValue("article-summary"),
|
||||||
CreatorID: session.Values["id"].(int64),
|
CreatorID: session.User.ID,
|
||||||
Published: false,
|
Published: false,
|
||||||
Rejected: false,
|
Rejected: false,
|
||||||
IsInIssue: r.PostFormValue("issue") == "on",
|
IsInIssue: r.PostFormValue("issue") == "on",
|
||||||
AutoGenerated: false,
|
AutoGenerated: false,
|
||||||
EditedID: 0,
|
EditedID: 0,
|
||||||
|
UUID: uuid.New(),
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(article.Title) == 0 {
|
if len(article.Title) == 0 {
|
||||||
@ -155,29 +145,29 @@ func SubmitArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if r.PostFormValue("creator") == "contributor" {
|
if r.PostFormValue("creator") == "author" {
|
||||||
contributors = append(contributors, article.CreatorID)
|
|
||||||
} else {
|
|
||||||
authors = append(authors, article.CreatorID)
|
authors = append(authors, article.CreatorID)
|
||||||
|
} else {
|
||||||
|
contributors = append(contributors, article.CreatorID)
|
||||||
}
|
}
|
||||||
if len(authors) == 0 {
|
if len(authors) == 0 {
|
||||||
http.Error(w, "Es muss mindestens einen Autor geben.", http.StatusBadRequest)
|
http.Error(w, "Es muss mindestens einen Autor geben.", http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
article.ID, err = db.AddArticle(article)
|
|
||||||
if err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
content := []byte(r.PostFormValue("article-content"))
|
content := []byte(r.PostFormValue("article-content"))
|
||||||
if len(content) == 0 {
|
if len(content) == 0 {
|
||||||
http.Error(w, "Bitte den Artikel eingeben.", http.StatusBadRequest)
|
http.Error(w, "Bitte den Artikel eingeben.", http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if err := b.WriteArticleToFile(c, article.ID, content); err != nil {
|
if err := article.WriteContentToFile(c, content); err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
article.ID, err = db.AddArticle(article)
|
||||||
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
@ -214,9 +204,9 @@ func SubmitArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
data := new(struct{ Role int })
|
data := new(struct{ Role int })
|
||||||
data.Role = session.Values["role"].(int)
|
data.Role = session.User.Role
|
||||||
|
|
||||||
tmpl, err := template.ParseFiles(c.WebDir + "/templates/hub.html")
|
tmpl, err := template.ParseFiles(filepath.Join(c.WebDir, "templates", "hub.html"))
|
||||||
tmpl = template.Must(tmpl, err)
|
tmpl = template.Must(tmpl, err)
|
||||||
if err = tmpl.ExecuteTemplate(w, "page-content", data); err != nil {
|
if err = tmpl.ExecuteTemplate(w, "page-content", data); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
@ -226,23 +216,34 @@ func SubmitArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func ResubmitArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
func ResubmitArticle(c *b.Config, db *b.DB, s map[string]*Session) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
session, err := GetSession(w, r, c, s)
|
session, err := ManageSession(w, r, c, s)
|
||||||
|
if err != nil {
|
||||||
|
http.Error(w, "Die Session ist abgelaufen. Bitte erneut anmelden.", http.StatusUnauthorized)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
id, err := strconv.ParseInt(r.PathValue("id"), 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
article := &b.Article{
|
article, err := db.GetArticle(id)
|
||||||
Title: r.PostFormValue("article-title"),
|
if err != nil {
|
||||||
BannerLink: r.PostFormValue("article-banner-url"),
|
log.Println(err)
|
||||||
Summary: r.PostFormValue("article-summary"),
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
CreatorID: session.Values["id"].(int64),
|
return
|
||||||
IsInIssue: r.PostFormValue("issue") == "on",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
article.Title = r.PostFormValue("article-title")
|
||||||
|
article.BannerLink = r.PostFormValue("article-banner-url")
|
||||||
|
article.Summary = r.PostFormValue("article-summary")
|
||||||
|
article.CreatorID = session.User.ID
|
||||||
|
article.IsInIssue = r.PostFormValue("issue") == "on"
|
||||||
|
|
||||||
if len(article.Title) == 0 {
|
if len(article.Title) == 0 {
|
||||||
http.Error(w, "Bitte den Titel eingeben.", http.StatusBadRequest)
|
http.Error(w, "Bitte den Titel eingeben.", http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
@ -274,30 +275,23 @@ func ResubmitArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if r.PostFormValue("creator") == "contributor" {
|
if r.PostFormValue("creator") == "author" {
|
||||||
contributors = append(contributors, article.CreatorID)
|
|
||||||
} else {
|
|
||||||
authors = append(authors, article.CreatorID)
|
authors = append(authors, article.CreatorID)
|
||||||
|
} else {
|
||||||
|
contributors = append(contributors, article.CreatorID)
|
||||||
}
|
}
|
||||||
if len(authors) == 0 {
|
if len(authors) == 0 {
|
||||||
http.Error(w, "Es muss mindestens einen Autor geben.", http.StatusBadRequest)
|
http.Error(w, "Es muss mindestens einen Autor geben.", http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
article.ID, err = strconv.ParseInt(r.PathValue("id"), 10, 64)
|
|
||||||
if err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
content := r.PostFormValue("article-content")
|
content := r.PostFormValue("article-content")
|
||||||
if len(content) == 0 {
|
if len(content) == 0 {
|
||||||
http.Error(w, "Bitte den Artikel eingeben.", http.StatusBadRequest)
|
http.Error(w, "Bitte den Artikel eingeben.", http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
contentLink := fmt.Sprint(c.ArticleDir, "/", article.ID, ".md")
|
|
||||||
if err = os.WriteFile(contentLink, []byte(content), 0644); err != nil {
|
if err = article.WriteContentToFile(c, []byte(content)); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
@ -345,9 +339,9 @@ func ResubmitArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
data := new(struct{ Role int })
|
data := new(struct{ Role int })
|
||||||
data.Role = session.Values["role"].(int)
|
data.Role = session.User.Role
|
||||||
|
|
||||||
tmpl, err := template.ParseFiles(c.WebDir + "/templates/hub.html")
|
tmpl, err := template.ParseFiles(filepath.Join(c.WebDir, "templates", "hub.html"))
|
||||||
tmpl = template.Must(tmpl, err)
|
tmpl = template.Must(tmpl, err)
|
||||||
if err = tmpl.ExecuteTemplate(w, "page-content", data); err != nil {
|
if err = tmpl.ExecuteTemplate(w, "page-content", data); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
@ -357,11 +351,10 @@ func ResubmitArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func ShowUnpublishedUnrejectedAndPublishedRejectedArticles(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
func ShowUnpublishedUnrejectedAndPublishedRejectedArticles(c *b.Config, db *b.DB, s map[string]*Session) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
if _, err := GetSession(w, r, c, s); err != nil {
|
if _, err := ManageSession(w, r, c, s); err != nil {
|
||||||
log.Println(err)
|
http.Error(w, "Die Session ist abgelaufen. Bitte erneut anmelden.", http.StatusUnauthorized)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,7 +385,7 @@ func ShowUnpublishedUnrejectedAndPublishedRejectedArticles(c *b.Config, db *b.DB
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tmpl, err := template.ParseFiles(c.WebDir + "/templates/unpublished-articles.html")
|
tmpl, err := template.ParseFiles(filepath.Join(c.WebDir, "templates", "unpublished-articles.html"))
|
||||||
if err = template.Must(tmpl, err).ExecuteTemplate(w, "page-content", articles); err != nil {
|
if err = template.Must(tmpl, err).ExecuteTemplate(w, "page-content", articles); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
@ -401,12 +394,11 @@ func ShowUnpublishedUnrejectedAndPublishedRejectedArticles(c *b.Config, db *b.DB
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func ShowRejectedArticles(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
func ShowRejectedArticles(c *b.Config, db *b.DB, s map[string]*Session) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
session, err := GetSession(w, r, c, s)
|
session, err := ManageSession(w, r, c, s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
http.Error(w, "Die Session ist abgelaufen. Bitte erneut anmelden.", http.StatusUnauthorized)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -424,12 +416,12 @@ func ShowRejectedArticles(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerF
|
|||||||
|
|
||||||
data.MyIDs = make(map[int64]bool)
|
data.MyIDs = make(map[int64]bool)
|
||||||
for _, article := range data.RejectedArticles {
|
for _, article := range data.RejectedArticles {
|
||||||
if article.CreatorID == session.Values["id"].(int64) {
|
if article.CreatorID == session.User.ID {
|
||||||
data.MyIDs[article.ID] = true
|
data.MyIDs[article.ID] = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tmpl, err := template.ParseFiles(c.WebDir + "/templates/rejected-articles.html")
|
tmpl, err := template.ParseFiles(filepath.Join(c.WebDir, "templates", "rejected-articles.html"))
|
||||||
tmpl = template.Must(tmpl, err)
|
tmpl = template.Must(tmpl, err)
|
||||||
if err = tmpl.ExecuteTemplate(w, "page-content", data); err != nil {
|
if err = tmpl.ExecuteTemplate(w, "page-content", data); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
@ -439,12 +431,11 @@ func ShowRejectedArticles(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func ReviewRejectedArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
func ReviewRejectedArticle(c *b.Config, db *b.DB, s map[string]*Session) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
session, err := GetSession(w, r, c, s)
|
session, err := ManageSession(w, r, c, s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
http.Error(w, "Die Session ist abgelaufen. Bitte erneut anmelden.", http.StatusUnauthorized)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -465,8 +456,8 @@ func ReviewRejectedArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.Handler
|
|||||||
|
|
||||||
data.Image = data.Article.BannerLink
|
data.Image = data.Article.BannerLink
|
||||||
|
|
||||||
articleAbsName := fmt.Sprint(c.ArticleDir, "/", data.Article.ID, ".md")
|
articlePath := filepath.Join(c.ArticleDir, fmt.Sprint(data.Article.UUID, ".md"))
|
||||||
content, err := os.ReadFile(articleAbsName)
|
content, err := os.ReadFile(articlePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
@ -512,7 +503,7 @@ func ReviewRejectedArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.Handler
|
|||||||
data.ArticleUsers[fmt.Sprint(contributor.LastName, contributor.FirstName, contributor.ID)].ArticleRole = Contributor
|
data.ArticleUsers[fmt.Sprint(contributor.LastName, contributor.FirstName, contributor.ID)].ArticleRole = Contributor
|
||||||
}
|
}
|
||||||
|
|
||||||
creator, err := db.GetUser(c, session.Values["id"].(int64))
|
creator, err := db.GetUser(c, session.User.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
@ -534,7 +525,7 @@ func ReviewRejectedArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.Handler
|
|||||||
|
|
||||||
data.Action = fmt.Sprint("resubmit/", data.Article.ID)
|
data.Action = fmt.Sprint("resubmit/", data.Article.ID)
|
||||||
|
|
||||||
tmpl, err := template.ParseFiles(c.WebDir + "/templates/editor.html")
|
tmpl, err := template.ParseFiles(filepath.Join(c.WebDir, "templates", "editor.html"))
|
||||||
tmpl = template.Must(tmpl, err)
|
tmpl = template.Must(tmpl, err)
|
||||||
if err = tmpl.ExecuteTemplate(w, "page-content", data); err != nil {
|
if err = tmpl.ExecuteTemplate(w, "page-content", data); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
@ -544,12 +535,11 @@ func ReviewRejectedArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.Handler
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func PublishArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
func PublishArticle(c *b.Config, db *b.DB, s map[string]*Session, i *b.Index) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
session, err := GetSession(w, r, c, s)
|
session, err := ManageSession(w, r, c, s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
http.Error(w, "Die Session ist abgelaufen. Bitte erneut anmelden.", http.StatusUnauthorized)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -583,6 +573,19 @@ func PublishArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
content, err := article.ReadContent(c)
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if err = i.Add(article.UUID.String(), content); err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if article.EditedID != 0 {
|
if article.EditedID != 0 {
|
||||||
oldArticle, err := db.GetArticle(article.EditedID)
|
oldArticle, err := db.GetArticle(article.EditedID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -597,7 +600,14 @@ func PublishArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = os.Remove(fmt.Sprint(c.ArticleDir, "/", oldArticle.ID, ".md")); err != nil {
|
uuid := oldArticle.UUID.String()
|
||||||
|
if err = i.Delete(uuid); err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if err = os.Remove(filepath.Join(c.ArticleDir, uuid+".md")); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
@ -623,9 +633,9 @@ func PublishArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
data := new(struct{ Role int })
|
data := new(struct{ Role int })
|
||||||
data.Role = session.Values["role"].(int)
|
data.Role = session.User.Role
|
||||||
|
|
||||||
tmpl, err := template.ParseFiles(c.WebDir + "/templates/hub.html")
|
tmpl, err := template.ParseFiles(filepath.Join(c.WebDir, "templates", "hub.html"))
|
||||||
tmpl = template.Must(tmpl, err)
|
tmpl = template.Must(tmpl, err)
|
||||||
if err = tmpl.ExecuteTemplate(w, "page-content", data); err != nil {
|
if err = tmpl.ExecuteTemplate(w, "page-content", data); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
@ -635,12 +645,11 @@ func PublishArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func RejectArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
func RejectArticle(c *b.Config, db *b.DB, s map[string]*Session) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
session, err := GetSession(w, r, c, s)
|
session, err := ManageSession(w, r, c, s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
http.Error(w, "Die Session ist abgelaufen. Bitte erneut anmelden.", http.StatusUnauthorized)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -658,9 +667,9 @@ func RejectArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
data := new(struct{ Role int })
|
data := new(struct{ Role int })
|
||||||
data.Role = session.Values["role"].(int)
|
data.Role = session.User.Role
|
||||||
|
|
||||||
tmpl, err := template.ParseFiles(c.WebDir + "/templates/hub.html")
|
tmpl, err := template.ParseFiles(filepath.Join(c.WebDir, "templates", "hub.html"))
|
||||||
tmpl = template.Must(tmpl, err)
|
tmpl = template.Must(tmpl, err)
|
||||||
if err = tmpl.ExecuteTemplate(w, "page-content", data); err != nil {
|
if err = tmpl.ExecuteTemplate(w, "page-content", data); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
@ -670,11 +679,10 @@ func RejectArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func ShowCurrentIssue(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
func ShowCurrentIssue(c *b.Config, db *b.DB, s map[string]*Session) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
if _, err := GetSession(w, r, c, s); err != nil {
|
if _, err := ManageSession(w, r, c, s); err != nil {
|
||||||
log.Println(err)
|
http.Error(w, "Die Session ist abgelaufen. Bitte erneut anmelden.", http.StatusUnauthorized)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -685,7 +693,7 @@ func ShowCurrentIssue(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
tmpl, err := template.ParseFiles(c.WebDir + "/templates/current-issue.html")
|
tmpl, err := template.ParseFiles(filepath.Join(c.WebDir, "templates", "current-issue.html"))
|
||||||
if err = template.Must(tmpl, err).ExecuteTemplate(w, "page-content", articles); err != nil {
|
if err = template.Must(tmpl, err).ExecuteTemplate(w, "page-content", articles); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
@ -694,11 +702,10 @@ func ShowCurrentIssue(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func ShowPublishedArticles(c *b.Config, db *b.DB, s *b.CookieStore, action string) http.HandlerFunc {
|
func ShowPublishedArticles(c *b.Config, db *b.DB, s map[string]*Session, action string) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
if _, err := GetSession(w, r, c, s); err != nil {
|
if _, err := ManageSession(w, r, c, s); err != nil {
|
||||||
log.Println(err)
|
http.Error(w, "Die Session ist abgelaufen. Bitte erneut anmelden.", http.StatusUnauthorized)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -721,7 +728,7 @@ func ShowPublishedArticles(c *b.Config, db *b.DB, s *b.CookieStore, action strin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tmpl, err := template.ParseFiles(c.WebDir + "/templates/published-articles.html")
|
tmpl, err := template.ParseFiles(filepath.Join(c.WebDir, "templates", "published-articles.html"))
|
||||||
tmpl = template.Must(tmpl, err)
|
tmpl = template.Must(tmpl, err)
|
||||||
if err = tmpl.ExecuteTemplate(w, "page-content", data); err != nil {
|
if err = tmpl.ExecuteTemplate(w, "page-content", data); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
@ -731,11 +738,10 @@ func ShowPublishedArticles(c *b.Config, db *b.DB, s *b.CookieStore, action strin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func ReviewArticle(c *b.Config, db *b.DB, s *b.CookieStore, action, title, button string) http.HandlerFunc {
|
func ReviewArticle(c *b.Config, db *b.DB, s map[string]*Session, action, title, button string) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
if _, err := GetSession(w, r, c, s); err != nil {
|
if _, err := ManageSession(w, r, c, s); err != nil {
|
||||||
log.Println(err)
|
http.Error(w, "Die Session ist abgelaufen. Bitte erneut anmelden.", http.StatusUnauthorized)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -779,8 +785,8 @@ func ReviewArticle(c *b.Config, db *b.DB, s *b.CookieStore, action, title, butto
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
articleAbsName := fmt.Sprint(c.ArticleDir, "/", article.ID, ".md")
|
articlePath := filepath.Join(c.ArticleDir, fmt.Sprint(article.UUID, ".md"))
|
||||||
content, err := os.ReadFile(articleAbsName)
|
content, err := os.ReadFile(articlePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
@ -817,7 +823,7 @@ func ReviewArticle(c *b.Config, db *b.DB, s *b.CookieStore, action, title, butto
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
tmpl, err := template.ParseFiles(c.WebDir + "/templates/review-article.html")
|
tmpl, err := template.ParseFiles(filepath.Join(c.WebDir, "templates", "review-article.html"))
|
||||||
if err = template.Must(tmpl, err).ExecuteTemplate(w, "page-content", data); err != nil {
|
if err = template.Must(tmpl, err).ExecuteTemplate(w, "page-content", data); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
@ -826,16 +832,22 @@ func ReviewArticle(c *b.Config, db *b.DB, s *b.CookieStore, action, title, butto
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func DeleteArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
func DeleteArticle(c *b.Config, db *b.DB, s map[string]*Session) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
session, err := GetSession(w, r, c, s)
|
session, err := ManageSession(w, r, c, s)
|
||||||
|
if err != nil {
|
||||||
|
http.Error(w, "Die Session ist abgelaufen. Bitte erneut anmelden.", http.StatusUnauthorized)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
id, err := strconv.ParseInt(r.PathValue("id"), 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
id, err := strconv.ParseInt(r.PathValue("id"), 10, 64)
|
article, err := db.GetArticle(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
@ -848,12 +860,19 @@ func DeleteArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = os.Remove(fmt.Sprint(c.ArticleDir, "/", id, ".md")); err != nil {
|
if err = os.Remove(filepath.Join(c.ArticleDir, article.UUID.String()+".md")); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
go func(c *b.Config, db *b.DB) {
|
||||||
|
if err = b.CleanUpImages(c, db); err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
}
|
||||||
|
}(c, db)
|
||||||
|
|
||||||
feed, err := b.GenerateAtomFeed(c, db)
|
feed, err := b.GenerateAtomFeed(c, db)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
@ -867,9 +886,9 @@ func DeleteArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
data := new(struct{ Role int })
|
data := new(struct{ Role int })
|
||||||
data.Role = session.Values["role"].(int)
|
data.Role = session.User.Role
|
||||||
|
|
||||||
tmpl, err := template.ParseFiles(c.WebDir + "/templates/hub.html")
|
tmpl, err := template.ParseFiles(filepath.Join(c.WebDir, "templates", "hub.html"))
|
||||||
tmpl = template.Must(tmpl, err)
|
tmpl = template.Must(tmpl, err)
|
||||||
if err = tmpl.ExecuteTemplate(w, "page-content", data); err != nil {
|
if err = tmpl.ExecuteTemplate(w, "page-content", data); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
@ -879,12 +898,11 @@ func DeleteArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func AllowEditArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
func AllowEditArticle(c *b.Config, db *b.DB, s map[string]*Session) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
session, err := GetSession(w, r, c, s)
|
session, err := ManageSession(w, r, c, s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
http.Error(w, "Die Session ist abgelaufen. Bitte erneut anmelden.", http.StatusUnauthorized)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -903,6 +921,7 @@ func AllowEditArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc
|
|||||||
}
|
}
|
||||||
|
|
||||||
newArticle := *oldArticle
|
newArticle := *oldArticle
|
||||||
|
newArticle.UUID = uuid.New()
|
||||||
newArticle.Published = false
|
newArticle.Published = false
|
||||||
newArticle.Rejected = true
|
newArticle.Rejected = true
|
||||||
newArticle.EditedID = oldArticle.ID
|
newArticle.EditedID = oldArticle.ID
|
||||||
@ -920,8 +939,8 @@ func AllowEditArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
src := fmt.Sprint(c.ArticleDir, "/", oldArticle.ID, ".md")
|
src := filepath.Join(c.ArticleDir, fmt.Sprint(oldArticle.UUID, ".md"))
|
||||||
dst := fmt.Sprint(c.ArticleDir, "/", newArticle.ID, ".md")
|
dst := filepath.Join(c.ArticleDir, fmt.Sprint(newArticle.UUID, ".md"))
|
||||||
if err = b.CopyFile(src, dst); err != nil {
|
if err = b.CopyFile(src, dst); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
@ -961,9 +980,9 @@ func AllowEditArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc
|
|||||||
}
|
}
|
||||||
|
|
||||||
data := new(struct{ Role int })
|
data := new(struct{ Role int })
|
||||||
data.Role = session.Values["role"].(int)
|
data.Role = session.User.Role
|
||||||
|
|
||||||
tmpl := template.Must(template.ParseFiles(c.WebDir + "/templates/hub.html"))
|
tmpl := template.Must(template.ParseFiles(filepath.Join(c.WebDir, "templates", "hub.html")))
|
||||||
if err = tmpl.ExecuteTemplate(w, "page-content", data); err != nil {
|
if err = tmpl.ExecuteTemplate(w, "page-content", data); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
@ -972,11 +991,10 @@ func AllowEditArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func EditArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
func EditArticle(c *b.Config, db *b.DB, s map[string]*Session) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
if _, err := GetSession(w, r, c, s); err != nil {
|
if _, err := ManageSession(w, r, c, s); err != nil {
|
||||||
log.Println(err)
|
http.Error(w, "Die Session ist abgelaufen. Bitte erneut anmelden.", http.StatusUnauthorized)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -998,7 +1016,7 @@ func EditArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|||||||
|
|
||||||
data.Image = data.Article.BannerLink
|
data.Image = data.Article.BannerLink
|
||||||
|
|
||||||
content, err := os.ReadFile(fmt.Sprint(c.ArticleDir, "/", data.Article.ID, ".md"))
|
content, err := os.ReadFile(filepath.Join(c.ArticleDir, fmt.Sprint(data.Article.UUID, ".md")))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
@ -1026,7 +1044,7 @@ func EditArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|||||||
|
|
||||||
data.Action = fmt.Sprint("save/", data.Article.ID)
|
data.Action = fmt.Sprint("save/", data.Article.ID)
|
||||||
|
|
||||||
tmpl, err := template.ParseFiles(c.WebDir + "/templates/editor.html")
|
tmpl, err := template.ParseFiles(filepath.Join(c.WebDir, "templates", "editor.html"))
|
||||||
if err = template.Must(tmpl, err).ExecuteTemplate(w, "page-content", data); err != nil {
|
if err = template.Must(tmpl, err).ExecuteTemplate(w, "page-content", data); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
93
cmd/frontend/docx.go
Normal file
93
cmd/frontend/docx.go
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
package frontend
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"log"
|
||||||
|
"net/http"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/gabriel-vasile/mimetype"
|
||||||
|
"github.com/google/uuid"
|
||||||
|
b "streifling.com/jason/cpolis/cmd/backend"
|
||||||
|
)
|
||||||
|
|
||||||
|
func UploadDocx(c *b.Config, db *b.DB, s map[string]*Session) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
session, err := ManageSession(w, r, c, s)
|
||||||
|
if err != nil {
|
||||||
|
http.Error(w, "Die Session ist abgelaufen. Bitte erneut anmelden.", http.StatusUnauthorized)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
file, fileHeader, err := r.FormFile("docx-upload")
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
defer file.Close()
|
||||||
|
|
||||||
|
var buf bytes.Buffer
|
||||||
|
if _, err = io.Copy(&buf, file); err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
mime := mimetype.Detect(buf.Bytes())
|
||||||
|
if !mime.Is("application/vnd.openxmlformats-officedocument.wordprocessingml.document") {
|
||||||
|
http.Error(w, "Die Datei ist kein DOCX Worddokument.", http.StatusBadRequest)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
docxFilepath := filepath.Join(os.TempDir(), fmt.Sprint(uuid.New(), ".docx"))
|
||||||
|
if err = os.WriteFile(docxFilepath, buf.Bytes(), 0644); err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
defer os.Remove(docxFilepath)
|
||||||
|
|
||||||
|
mdString, err := b.ConvertToMarkdown(c, docxFilepath)
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
uuidName := uuid.New()
|
||||||
|
mdFilepath := filepath.Join(c.ArticleDir, fmt.Sprint(uuidName, ".md"))
|
||||||
|
if err = os.WriteFile(mdFilepath, mdString, 0644); err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
article := &b.Article{
|
||||||
|
Created: time.Now(),
|
||||||
|
UUID: uuidName,
|
||||||
|
CreatorID: session.User.ID,
|
||||||
|
Rejected: true,
|
||||||
|
}
|
||||||
|
article.Title = fmt.Sprint(fileHeader.Filename, "-", article.UUID)
|
||||||
|
|
||||||
|
id, err := db.AddArticle(article)
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if err = db.WriteArticleAuthors(id, []int64{session.User.ID}); err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
notifyClient(w, "Hochladen erfolgreich!", http.StatusOK)
|
||||||
|
}
|
||||||
|
}
|
100
cmd/frontend/homepage.go
Normal file
100
cmd/frontend/homepage.go
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
package frontend
|
||||||
|
|
||||||
|
import (
|
||||||
|
"html/template"
|
||||||
|
"log"
|
||||||
|
"net/http"
|
||||||
|
"path/filepath"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
b "streifling.com/jason/cpolis/cmd/backend"
|
||||||
|
)
|
||||||
|
|
||||||
|
func HomePage(c *b.Config, db *b.DB, s map[string]*Session) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
numRows, err := db.CountEntries("users")
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalln(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
data := new(struct {
|
||||||
|
*UserHTMLData
|
||||||
|
Version string
|
||||||
|
})
|
||||||
|
data.UserHTMLData = &UserHTMLData{User: new(b.User)}
|
||||||
|
data.Version = c.Version
|
||||||
|
|
||||||
|
files := make([]string, 2)
|
||||||
|
files[0] = filepath.Join(c.WebDir, "templates", "index.html")
|
||||||
|
if numRows == 0 {
|
||||||
|
data.Role = b.NonExistent
|
||||||
|
data.Title = "Erster Benutzer (Administrator)"
|
||||||
|
data.ButtonText = "Anlegen"
|
||||||
|
data.URL = "/user/add-first"
|
||||||
|
|
||||||
|
files[1] = filepath.Join(c.WebDir, "templates", "edit-user.html")
|
||||||
|
tmpl, err := template.ParseFiles(files...)
|
||||||
|
if err = template.Must(tmpl, err).Execute(w, data); err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
cookie, err := r.Cookie("cpolis_session")
|
||||||
|
if err != nil {
|
||||||
|
files[1] = filepath.Join(c.WebDir, "templates", "login.html")
|
||||||
|
tmpl, err := template.ParseFiles(files...)
|
||||||
|
if err = template.Must(tmpl, err).Execute(w, data); err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
session, ok := s[cookie.Value]
|
||||||
|
if !ok {
|
||||||
|
cookie.Expires = time.Now()
|
||||||
|
http.SetCookie(w, cookie)
|
||||||
|
|
||||||
|
files[1] = filepath.Join(c.WebDir, "templates", "login.html")
|
||||||
|
tmpl, err := template.ParseFiles(files...)
|
||||||
|
if err = template.Must(tmpl, err).Execute(w, data); err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
data.Role = session.User.Role
|
||||||
|
files[1] = filepath.Join(c.WebDir, "templates", "hub.html")
|
||||||
|
tmpl, err := template.ParseFiles(files...)
|
||||||
|
if err = template.Must(tmpl, err).Execute(w, data); err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func ShowHub(c *b.Config, db *b.DB, s map[string]*Session) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
session, err := ManageSession(w, r, c, s)
|
||||||
|
if err != nil {
|
||||||
|
http.Error(w, "Die Session ist abgelaufen. Bitte erneut anmelden.", http.StatusUnauthorized)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
data := new(struct{ Role int })
|
||||||
|
data.Role = session.User.Role
|
||||||
|
|
||||||
|
tmpl, err := template.ParseFiles(filepath.Join(c.WebDir, "templates", "hub.html"))
|
||||||
|
if err = template.Must(tmpl, err).ExecuteTemplate(w, "page-content", data); err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -5,15 +5,15 @@ import (
|
|||||||
"html/template"
|
"html/template"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
b "streifling.com/jason/cpolis/cmd/backend"
|
b "streifling.com/jason/cpolis/cmd/backend"
|
||||||
)
|
)
|
||||||
|
|
||||||
func UploadEasyMDEImage(c *b.Config, s *b.CookieStore) http.HandlerFunc {
|
func UploadArticleImage(c *b.Config, s map[string]*Session) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
if _, err := GetSession(w, r, c, s); err != nil {
|
if _, err := ManageSession(w, r, c, s); err != nil {
|
||||||
log.Println(err)
|
http.Error(w, "Die Session ist abgelaufen. Bitte erneut anmelden.", http.StatusUnauthorized)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ func UploadEasyMDEImage(c *b.Config, s *b.CookieStore) http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
defer file.Close()
|
defer file.Close()
|
||||||
|
|
||||||
filename, err := b.SaveImage(file, c.MaxImgHeight, c.MaxImgWidth, c.PicsDir+"/")
|
filename, err := b.SaveImage(file, c.MaxImgHeight, c.MaxImgWidth, c.ImgDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == b.ErrUnsupportedFormat {
|
if err == b.ErrUnsupportedFormat {
|
||||||
http.Error(w, "Das Dateiformat wird nicht unterstützt.", http.StatusBadRequest)
|
http.Error(w, "Das Dateiformat wird nicht unterstützt.", http.StatusBadRequest)
|
||||||
@ -42,11 +42,10 @@ func UploadEasyMDEImage(c *b.Config, s *b.CookieStore) http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func UploadImage(c *b.Config, s *b.CookieStore, fileKey, htmlFile, htmlTemplate string) http.HandlerFunc {
|
func UploadImage(c *b.Config, s map[string]*Session, fileKey, htmlFile, htmlTemplate string) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
if _, err := GetSession(w, r, c, s); err != nil {
|
if _, err := ManageSession(w, r, c, s); err != nil {
|
||||||
log.Println(err)
|
http.Error(w, "Die Session ist abgelaufen. Bitte erneut anmelden.", http.StatusUnauthorized)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +57,7 @@ func UploadImage(c *b.Config, s *b.CookieStore, fileKey, htmlFile, htmlTemplate
|
|||||||
}
|
}
|
||||||
defer file.Close()
|
defer file.Close()
|
||||||
|
|
||||||
filename, err := b.SaveImage(file, c.MaxBannerHeight, c.MaxBannerWidth, c.PicsDir+"/")
|
filename, err := b.SaveImage(file, c.MaxBannerHeight, c.MaxBannerWidth, c.ImgDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == b.ErrUnsupportedFormat {
|
if err == b.ErrUnsupportedFormat {
|
||||||
http.Error(w, "Das Dateiformat wird nicht unterstützt.", http.StatusBadRequest)
|
http.Error(w, "Das Dateiformat wird nicht unterstützt.", http.StatusBadRequest)
|
||||||
@ -72,7 +71,7 @@ func UploadImage(c *b.Config, s *b.CookieStore, fileKey, htmlFile, htmlTemplate
|
|||||||
data := new(struct{ Image string })
|
data := new(struct{ Image string })
|
||||||
data.Image = filename
|
data.Image = filename
|
||||||
|
|
||||||
tmpl, err := template.ParseFiles(c.WebDir + "/templates/" + htmlFile)
|
tmpl, err := template.ParseFiles(filepath.Join(c.WebDir, "templates", htmlFile))
|
||||||
if err = template.Must(tmpl, err).ExecuteTemplate(w, htmlTemplate, data); err != nil {
|
if err = template.Must(tmpl, err).ExecuteTemplate(w, htmlTemplate, data); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
@ -6,24 +6,18 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
b "streifling.com/jason/cpolis/cmd/backend"
|
b "streifling.com/jason/cpolis/cmd/backend"
|
||||||
)
|
)
|
||||||
|
|
||||||
func PublishLatestIssue(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
func PublishLatestIssue(c *b.Config, db *b.DB, s map[string]*Session) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
session, err := GetSession(w, r, c, s)
|
session, err := ManageSession(w, r, c, s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
http.Error(w, "Die Session ist abgelaufen. Bitte erneut anmelden.", http.StatusUnauthorized)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
session.Values["article"] = nil
|
|
||||||
if err = session.Save(r, w); err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,6 +28,7 @@ func PublishLatestIssue(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFun
|
|||||||
Rejected: false,
|
Rejected: false,
|
||||||
Created: time.Now(),
|
Created: time.Now(),
|
||||||
AutoGenerated: true,
|
AutoGenerated: true,
|
||||||
|
UUID: uuid.New(),
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(article.Title) == 0 {
|
if len(article.Title) == 0 {
|
||||||
@ -49,14 +44,7 @@ func PublishLatestIssue(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFun
|
|||||||
}
|
}
|
||||||
|
|
||||||
authorIDs := make([]int64, 1)
|
authorIDs := make([]int64, 1)
|
||||||
var ok bool
|
authorIDs[0] = session.User.ID
|
||||||
|
|
||||||
if authorIDs[0], ok = session.Values["id"].(int64); !ok {
|
|
||||||
msg := "fälschlicherweise session.Values[\"id\"].(int64) für authorIDs[0] angenommen"
|
|
||||||
log.Println(msg)
|
|
||||||
http.Error(w, msg, http.StatusInternalServerError)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if err = db.WriteArticleAuthors(article.ID, authorIDs); err != nil {
|
if err = db.WriteArticleAuthors(article.ID, authorIDs); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
@ -70,8 +58,8 @@ func PublishLatestIssue(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFun
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
articleAbsName := fmt.Sprint(c.ArticleDir, "/", article.ID, ".md")
|
articlePath := filepath.Join(c.ArticleDir, fmt.Sprint(article.UUID, ".md"))
|
||||||
if err = os.WriteFile(articleAbsName, content, 0644); err != nil {
|
if err = os.WriteFile(articlePath, content, 0644); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
@ -101,17 +89,10 @@ func PublishLatestIssue(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFun
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
session.Values["issue-image"] = nil
|
|
||||||
if err = session.Save(r, w); err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
data := new(struct{ Role int })
|
data := new(struct{ Role int })
|
||||||
data.Role = session.Values["role"].(int)
|
data.Role = session.User.Role
|
||||||
|
|
||||||
tmpl, err := template.ParseFiles(c.WebDir + "/templates/hub.html")
|
tmpl, err := template.ParseFiles(filepath.Join(c.WebDir, "templates", "hub.html"))
|
||||||
tmpl = template.Must(tmpl, err)
|
tmpl = template.Must(tmpl, err)
|
||||||
if err = tmpl.ExecuteTemplate(w, "page-content", data); err != nil {
|
if err = tmpl.ExecuteTemplate(w, "page-content", data); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
|
20
cmd/frontend/notifications.go
Normal file
20
cmd/frontend/notifications.go
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
package frontend
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"html/template"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
func notifyClient(w http.ResponseWriter, message string, status int) {
|
||||||
|
h := w.Header()
|
||||||
|
h.Del("Content-Length")
|
||||||
|
h.Set("Content-Type", "text/html; charset=utf-8")
|
||||||
|
if status >= 400 {
|
||||||
|
h.Set("X-Content-Type-Options", "nosniff")
|
||||||
|
}
|
||||||
|
w.WriteHeader(status)
|
||||||
|
|
||||||
|
safeMsg := template.HTMLEscapeString(message)
|
||||||
|
fmt.Fprintf(w, `<span id="notification-content" hx-swap-oob="true">%s</span>`, safeMsg)
|
||||||
|
}
|
@ -5,20 +5,20 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
b "streifling.com/jason/cpolis/cmd/backend"
|
b "streifling.com/jason/cpolis/cmd/backend"
|
||||||
)
|
)
|
||||||
|
|
||||||
func UploadPDF(c *b.Config, s *b.CookieStore) http.HandlerFunc {
|
func UploadPDF(c *b.Config, s map[string]*Session) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
if _, err := GetSession(w, r, c, s); err != nil {
|
if _, err := ManageSession(w, r, c, s); err != nil {
|
||||||
log.Println(err)
|
http.Error(w, "Die Session ist abgelaufen. Bitte erneut anmelden.", http.StatusUnauthorized)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
file, _, err := r.FormFile("pdf-upload")
|
file, header, err := r.FormFile("pdf-upload")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
@ -44,20 +44,16 @@ func UploadPDF(c *b.Config, s *b.CookieStore) http.HandlerFunc {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
filename := fmt.Sprint(uuid.New(), ".pdf")
|
oldFilename := strings.Join(strings.Split(header.Filename, ".")[:len(header.Filename)-1], ".")
|
||||||
absFilepath, err := filepath.Abs(c.PDFDir + "/" + filename)
|
filename := fmt.Sprint(oldFilename, ".", uuid.New(), ".pdf")
|
||||||
if err != nil {
|
filepath := filepath.Join(c.PDFDir, filename)
|
||||||
|
|
||||||
|
if err = b.WriteFile(filepath, file); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = b.WriteFile(absFilepath, file); err != nil {
|
notifyClient(w, "Hochladen erfolgreich!", http.StatusOK)
|
||||||
log.Println(err)
|
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
w.WriteHeader(http.StatusOK)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,115 +1,115 @@
|
|||||||
package frontend
|
package frontend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"html/template"
|
"html/template"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"path/filepath"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
b "streifling.com/jason/cpolis/cmd/backend"
|
b "streifling.com/jason/cpolis/cmd/backend"
|
||||||
)
|
)
|
||||||
|
|
||||||
func saveSession(w http.ResponseWriter, r *http.Request, s *b.CookieStore, u *b.User) error {
|
type Session struct {
|
||||||
session, err := s.Get(r, "cookie")
|
ctx context.Context
|
||||||
if err != nil {
|
cancel context.CancelFunc
|
||||||
return fmt.Errorf("error getting session: %v", err)
|
cookie *http.Cookie
|
||||||
}
|
User *b.User
|
||||||
|
|
||||||
session.Values["authenticated"] = true
|
|
||||||
session.Values["id"] = u.ID
|
|
||||||
session.Values["name"] = u.FirstName + u.LastName
|
|
||||||
session.Values["role"] = u.Role
|
|
||||||
if err := session.Save(r, w); err != nil {
|
|
||||||
return fmt.Errorf("error saving session: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetSession is used for verifying that the user is logged in and returns their session and an error.
|
func newSession(w http.ResponseWriter, c *b.Config, sessionExpiryChan chan<- string, user *b.User) *Session {
|
||||||
func GetSession(w http.ResponseWriter, r *http.Request, c *b.Config, s *b.CookieStore) (*b.Session, error) {
|
sessionID := uuid.New().String()
|
||||||
msg := "Keine gültige Session. Bitte erneut anmelden."
|
expires := time.Now().Add(time.Hour * time.Duration(c.CookieExpiryHours))
|
||||||
tmpl, tmplErr := template.ParseFiles(c.WebDir+"/templates/index.html", c.WebDir+"/templates/login.html")
|
ctx, cancel := context.WithDeadline(context.Background(), expires)
|
||||||
|
|
||||||
tmpSession, err := s.Get(r, "cookie")
|
session := &Session{
|
||||||
|
ctx: ctx,
|
||||||
|
cancel: cancel,
|
||||||
|
cookie: &http.Cookie{
|
||||||
|
Name: "cpolis_session",
|
||||||
|
Value: sessionID,
|
||||||
|
Expires: expires,
|
||||||
|
Path: "/",
|
||||||
|
HttpOnly: true,
|
||||||
|
Secure: true,
|
||||||
|
SameSite: http.SameSiteStrictMode,
|
||||||
|
},
|
||||||
|
User: user,
|
||||||
|
}
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
<-session.ctx.Done()
|
||||||
|
sessionExpiryChan <- session.cookie.Value
|
||||||
|
session.cookie.Expires = time.Now()
|
||||||
|
http.SetCookie(w, session.cookie)
|
||||||
|
}()
|
||||||
|
|
||||||
|
return session
|
||||||
|
}
|
||||||
|
|
||||||
|
func StartSessions() (map[string]*Session, chan string) {
|
||||||
|
sessions := make(map[string]*Session)
|
||||||
|
sessionExpiryChan := make(chan string)
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
for sessionID := range sessionExpiryChan {
|
||||||
|
delete(sessions, sessionID)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
return sessions, sessionExpiryChan
|
||||||
|
}
|
||||||
|
|
||||||
|
// SessionIsActive is used for verifying that the user is logged in and returns
|
||||||
|
// a bool.
|
||||||
|
func SessionIsActive(r *http.Request, s map[string]*Session) bool {
|
||||||
|
cookie, err := r.Cookie("cpolis_session")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err = template.Must(tmpl, tmplErr).ExecuteTemplate(w, "page-content", msg); err != nil {
|
return false
|
||||||
return nil, fmt.Errorf("error executing template: %v", err)
|
|
||||||
}
|
|
||||||
return nil, fmt.Errorf("error getting session: %v", err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
session := &b.Session{Session: *tmpSession}
|
_, ok := s[cookie.Value]
|
||||||
if session.IsNew {
|
return ok
|
||||||
if err = template.Must(tmpl, tmplErr).ExecuteTemplate(w, "page-content", msg); err != nil {
|
}
|
||||||
|
|
||||||
|
// ManageSession is used for verifying that the user is logged in and returns
|
||||||
|
// their session and an error. It also handles cases where the user is not
|
||||||
|
// logged in.
|
||||||
|
func ManageSession(w http.ResponseWriter, r *http.Request, c *b.Config, s map[string]*Session) (*Session, error) {
|
||||||
|
tmpl, tmplErr := template.ParseFiles(filepath.Join(c.WebDir, "templates", "index.html"), filepath.Join(c.WebDir, "templates", "login.html"))
|
||||||
|
|
||||||
|
cookie, err := r.Cookie("cpolis_session")
|
||||||
|
if err != nil {
|
||||||
|
if err = template.Must(tmpl, tmplErr).ExecuteTemplate(w, "page-content", nil); err != nil {
|
||||||
return nil, fmt.Errorf("error executing template: %v", err)
|
return nil, fmt.Errorf("error executing template: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return nil, errors.New("no cookie set")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
session, ok := s[cookie.Value]
|
||||||
|
if !ok {
|
||||||
|
cookie.Expires = time.Now()
|
||||||
|
http.SetCookie(w, cookie)
|
||||||
|
|
||||||
|
if err = template.Must(tmpl, tmplErr).ExecuteTemplate(w, "page-content", nil); err != nil {
|
||||||
|
return nil, fmt.Errorf("error executing template: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil, errors.New("session does not exist")
|
||||||
|
}
|
||||||
|
|
||||||
|
session.cookie.Expires = time.Now().Add(time.Hour * time.Duration(c.CookieExpiryHours))
|
||||||
|
http.SetCookie(w, session.cookie)
|
||||||
|
|
||||||
return session, nil
|
return session, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func HomePage(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
func Login(c *b.Config, db *b.DB, s map[string]*Session, sessionExpiryChan chan string) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
|
||||||
numRows, err := db.CountEntries("users")
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalln(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
data := new(struct {
|
|
||||||
*UserHTMLData
|
|
||||||
Version string
|
|
||||||
})
|
|
||||||
data.UserHTMLData = &UserHTMLData{User: new(b.User)}
|
|
||||||
data.Version = c.Version
|
|
||||||
|
|
||||||
files := make([]string, 2)
|
|
||||||
files[0] = c.WebDir + "/templates/index.html"
|
|
||||||
if numRows == 0 {
|
|
||||||
data.Role = b.NonExistent
|
|
||||||
data.Title = "Erster Benutzer (Administrator)"
|
|
||||||
data.ButtonText = "Anlegen"
|
|
||||||
data.URL = "/user/add-first"
|
|
||||||
|
|
||||||
files[1] = c.WebDir + "/templates/edit-user.html"
|
|
||||||
tmpl, err := template.ParseFiles(files...)
|
|
||||||
if err = template.Must(tmpl, err).Execute(w, data); err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
session, err := s.Get(r, "cookie")
|
|
||||||
if err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if auth, ok := session.Values["authenticated"].(bool); auth && ok {
|
|
||||||
data.Role = session.Values["role"].(int)
|
|
||||||
files[1] = c.WebDir + "/templates/hub.html"
|
|
||||||
tmpl, err := template.ParseFiles(files...)
|
|
||||||
if err = template.Must(tmpl, err).Execute(w, data); err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
data.Role = b.Author
|
|
||||||
files[1] = c.WebDir + "/templates/login.html"
|
|
||||||
tmpl, err := template.ParseFiles(files...)
|
|
||||||
if err = template.Must(tmpl, err).Execute(w, data); err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func Login(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
userName := r.PostFormValue("username")
|
userName := r.PostFormValue("username")
|
||||||
password := r.PostFormValue("password")
|
password := r.PostFormValue("password")
|
||||||
@ -133,13 +133,11 @@ func Login(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := saveSession(w, r, s, user); err != nil {
|
session := newSession(w, c, sessionExpiryChan, user)
|
||||||
log.Println(err)
|
s[session.cookie.Value] = session
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.SetCookie(w, session.cookie)
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
tmpl, err := template.ParseFiles(c.WebDir + "/templates/hub.html")
|
tmpl, err := template.ParseFiles(filepath.Join(c.WebDir, "templates", "hub.html"))
|
||||||
if err = template.Must(tmpl, err).ExecuteTemplate(w, "page-content", user); err != nil {
|
if err = template.Must(tmpl, err).ExecuteTemplate(w, "page-content", user); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
@ -148,52 +146,32 @@ func Login(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func Logout(c *b.Config, s *b.CookieStore) http.HandlerFunc {
|
func Logout(c *b.Config, s map[string]*Session) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
session, err := GetSession(w, r, c, s)
|
tmpl, tmplErr := template.ParseFiles(filepath.Join(c.WebDir, "templates", "login.html"))
|
||||||
|
|
||||||
|
cookie, err := r.Cookie("cpolis_session")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
if err = template.Must(tmpl, tmplErr).ExecuteTemplate(w, "page-content", nil); err != nil {
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
log.Println(err)
|
||||||
return
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
cookie.Expires = time.Now()
|
||||||
|
http.SetCookie(w, cookie)
|
||||||
|
|
||||||
session.Options.MaxAge = -1
|
session, ok := s[cookie.Value]
|
||||||
if err = session.Save(r, w); err != nil {
|
if !ok {
|
||||||
log.Println(err)
|
if err = template.Must(tmpl, tmplErr).ExecuteTemplate(w, "page-content", nil); err != nil {
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
log.Println(err)
|
||||||
return
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
session.cancel()
|
||||||
|
|
||||||
tmpl, err := template.ParseFiles(c.WebDir + "/templates/login.html")
|
if err = template.Must(tmpl, tmplErr).ExecuteTemplate(w, "page-content", nil); err != nil {
|
||||||
if err = template.Must(tmpl, err).ExecuteTemplate(w, "page-content", nil); err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func ShowHub(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
|
||||||
session, err := GetSession(w, r, c, s)
|
|
||||||
if err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
session.Values["article"] = nil
|
|
||||||
if err = session.Save(r, w); err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
data := new(struct{ Role int })
|
|
||||||
data.Role = session.Values["role"].(int)
|
|
||||||
|
|
||||||
tmpl, err := template.ParseFiles(c.WebDir + "/templates/hub.html")
|
|
||||||
if err = template.Must(tmpl, err).ExecuteTemplate(w, "page-content", data); err != nil {
|
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
|
@ -4,19 +4,19 @@ import (
|
|||||||
"html/template"
|
"html/template"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
b "streifling.com/jason/cpolis/cmd/backend"
|
b "streifling.com/jason/cpolis/cmd/backend"
|
||||||
)
|
)
|
||||||
|
|
||||||
func CreateTag(c *b.Config, s *b.CookieStore) http.HandlerFunc {
|
func CreateTag(c *b.Config, s map[string]*Session) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
if _, err := GetSession(w, r, c, s); err != nil {
|
if _, err := ManageSession(w, r, c, s); err != nil {
|
||||||
log.Println(err)
|
http.Error(w, "Die Session ist abgelaufen. Bitte erneut anmelden.", http.StatusUnauthorized)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
tmpl, err := template.ParseFiles(c.WebDir + "/templates/add-tag.html")
|
tmpl, err := template.ParseFiles(filepath.Join(c.WebDir, "templates", "add-tag.html"))
|
||||||
if err = template.Must(tmpl, err).ExecuteTemplate(w, "page-content", nil); err != nil {
|
if err = template.Must(tmpl, err).ExecuteTemplate(w, "page-content", nil); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
@ -25,12 +25,11 @@ func CreateTag(c *b.Config, s *b.CookieStore) http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func AddTag(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
func AddTag(c *b.Config, db *b.DB, s map[string]*Session) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
session, err := GetSession(w, r, c, s)
|
session, err := ManageSession(w, r, c, s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
http.Error(w, "Die Session ist abgelaufen. Bitte erneut anmelden.", http.StatusUnauthorized)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,9 +41,9 @@ func AddTag(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|||||||
db.AddTag(tag)
|
db.AddTag(tag)
|
||||||
|
|
||||||
data := new(struct{ Role int })
|
data := new(struct{ Role int })
|
||||||
data.Role = session.Values["role"].(int)
|
data.Role = session.User.Role
|
||||||
|
|
||||||
tmpl, err := template.ParseFiles(c.WebDir + "/templates/hub.html")
|
tmpl, err := template.ParseFiles(filepath.Join(c.WebDir, "templates", "hub.html"))
|
||||||
tmpl = template.Must(tmpl, err)
|
tmpl = template.Must(tmpl, err)
|
||||||
if err = tmpl.ExecuteTemplate(w, "page-content", data); err != nil {
|
if err = tmpl.ExecuteTemplate(w, "page-content", data); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"html/template"
|
"html/template"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"path/filepath"
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
@ -43,11 +44,10 @@ func sortUsersByName(users []*b.User) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func CreateUser(c *b.Config, s *b.CookieStore) http.HandlerFunc {
|
func CreateUser(c *b.Config, s map[string]*Session) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
if _, err := GetSession(w, r, c, s); err != nil {
|
if _, err := ManageSession(w, r, c, s); err != nil {
|
||||||
log.Println(err)
|
http.Error(w, "Die Session ist abgelaufen. Bitte erneut anmelden.", http.StatusUnauthorized)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ func CreateUser(c *b.Config, s *b.CookieStore) http.HandlerFunc {
|
|||||||
URL: "/user/add",
|
URL: "/user/add",
|
||||||
}
|
}
|
||||||
|
|
||||||
tmpl, err := template.ParseFiles(c.WebDir + "/templates/edit-user.html")
|
tmpl, err := template.ParseFiles(filepath.Join(c.WebDir, "templates", "edit-user.html"))
|
||||||
if err = template.Must(tmpl, err).ExecuteTemplate(w, "page-content", data); err != nil {
|
if err = template.Must(tmpl, err).ExecuteTemplate(w, "page-content", data); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
@ -67,12 +67,11 @@ func CreateUser(c *b.Config, s *b.CookieStore) http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func AddUser(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
func AddUser(c *b.Config, db *b.DB, s map[string]*Session) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
session, err := GetSession(w, r, c, s)
|
session, err := ManageSession(w, r, c, s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
http.Error(w, "Die Session ist abgelaufen. Bitte erneut anmelden.", http.StatusUnauthorized)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,9 +133,9 @@ func AddUser(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
data := new(struct{ Role int })
|
data := new(struct{ Role int })
|
||||||
data.Role = session.Values["role"].(int)
|
data.Role = session.User.Role
|
||||||
|
|
||||||
tmpl, err := template.ParseFiles(c.WebDir + "/templates/hub.html")
|
tmpl, err := template.ParseFiles(filepath.Join(c.WebDir, "templates", "hub.html"))
|
||||||
tmpl = template.Must(tmpl, err)
|
tmpl = template.Must(tmpl, err)
|
||||||
if err = tmpl.ExecuteTemplate(w, "page-content", data); err != nil {
|
if err = tmpl.ExecuteTemplate(w, "page-content", data); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
@ -146,16 +145,15 @@ func AddUser(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func EditSelf(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
func EditSelf(c *b.Config, db *b.DB, s map[string]*Session) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
session, err := GetSession(w, r, c, s)
|
session, err := ManageSession(w, r, c, s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
http.Error(w, "Die Session ist abgelaufen. Bitte erneut anmelden.", http.StatusUnauthorized)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
user, err := db.GetUser(c, session.Values["id"].(int64))
|
user, err := db.GetUser(c, session.User.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
@ -170,7 +168,7 @@ func EditSelf(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|||||||
Image: user.ProfilePicLink,
|
Image: user.ProfilePicLink,
|
||||||
}
|
}
|
||||||
|
|
||||||
tmpl, err := template.ParseFiles(c.WebDir + "/templates/edit-user.html")
|
tmpl, err := template.ParseFiles(filepath.Join(c.WebDir, "templates", "edit-user.html"))
|
||||||
if err = template.Must(tmpl, err).ExecuteTemplate(w, "page-content", data); err != nil {
|
if err = template.Must(tmpl, err).ExecuteTemplate(w, "page-content", data); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
@ -179,17 +177,16 @@ func EditSelf(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func UpdateSelf(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
func UpdateSelf(c *b.Config, db *b.DB, s map[string]*Session) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
session, err := GetSession(w, r, c, s)
|
session, err := ManageSession(w, r, c, s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
http.Error(w, "Die Session ist abgelaufen. Bitte erneut anmelden.", http.StatusUnauthorized)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
user := &b.User{
|
user := &b.User{
|
||||||
ID: session.Values["id"].(int64),
|
ID: session.User.ID,
|
||||||
UserName: r.PostFormValue("username"),
|
UserName: r.PostFormValue("username"),
|
||||||
FirstName: r.PostFormValue("first-name"),
|
FirstName: r.PostFormValue("first-name"),
|
||||||
LastName: r.PostFormValue("last-name"),
|
LastName: r.PostFormValue("last-name"),
|
||||||
@ -244,9 +241,9 @@ func UpdateSelf(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
data := new(struct{ Role int })
|
data := new(struct{ Role int })
|
||||||
data.Role = session.Values["role"].(int)
|
data.Role = session.User.Role
|
||||||
|
|
||||||
tmpl, err := template.ParseFiles(c.WebDir + "/templates/hub.html")
|
tmpl, err := template.ParseFiles(filepath.Join(c.WebDir, "templates", "hub.html"))
|
||||||
tmpl = template.Must(tmpl, err)
|
tmpl = template.Must(tmpl, err)
|
||||||
if err = tmpl.ExecuteTemplate(w, "page-content", data); err != nil {
|
if err = tmpl.ExecuteTemplate(w, "page-content", data); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
@ -256,7 +253,7 @@ func UpdateSelf(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func AddFirstUser(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
func AddFirstUser(c *b.Config, db *b.DB, s map[string]*Session, sessionExpiryChan chan string) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
var err error
|
var err error
|
||||||
user := &b.User{
|
user := &b.User{
|
||||||
@ -303,22 +300,20 @@ func AddFirstUser(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := saveSession(w, r, s, user); err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if _, err := db.AddIssue(); err != nil {
|
if _, err := db.AddIssue(); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
data := new(struct{ Role int })
|
session := newSession(w, c, sessionExpiryChan, user)
|
||||||
data.Role = 0
|
s[session.cookie.Value] = session
|
||||||
|
http.SetCookie(w, session.cookie)
|
||||||
|
|
||||||
tmpl, err := template.ParseFiles(c.WebDir + "/templates/hub.html")
|
data := new(struct{ Role int })
|
||||||
|
data.Role = user.Role
|
||||||
|
|
||||||
|
tmpl, err := template.ParseFiles(filepath.Join(c.WebDir, "templates", "hub.html"))
|
||||||
if err = template.Must(tmpl, err).ExecuteTemplate(w, "page-content", data); err != nil {
|
if err = template.Must(tmpl, err).ExecuteTemplate(w, "page-content", data); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
@ -327,12 +322,11 @@ func AddFirstUser(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func ShowAllUsers(c *b.Config, db *b.DB, s *b.CookieStore, action string) http.HandlerFunc {
|
func ShowAllUsers(c *b.Config, db *b.DB, s map[string]*Session, action string) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
session, err := GetSession(w, r, c, s)
|
session, err := ManageSession(w, r, c, s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
http.Error(w, "Die Session ist abgelaufen. Bitte erneut anmelden.", http.StatusUnauthorized)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -348,9 +342,9 @@ func ShowAllUsers(c *b.Config, db *b.DB, s *b.CookieStore, action string) http.H
|
|||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
delete(data.Users, session.Values["id"].(int64))
|
delete(data.Users, session.User.ID)
|
||||||
|
|
||||||
tmpl, err := template.ParseFiles(c.WebDir + "/templates/show-all-users.html")
|
tmpl, err := template.ParseFiles(filepath.Join(c.WebDir, "templates", "show-all-users.html"))
|
||||||
if err = template.Must(tmpl, err).ExecuteTemplate(w, "page-content", data); err != nil {
|
if err = template.Must(tmpl, err).ExecuteTemplate(w, "page-content", data); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
@ -359,11 +353,10 @@ func ShowAllUsers(c *b.Config, db *b.DB, s *b.CookieStore, action string) http.H
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func EditUser(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
func EditUser(c *b.Config, db *b.DB, s map[string]*Session) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
if _, err := GetSession(w, r, c, s); err != nil {
|
if _, err := ManageSession(w, r, c, s); err != nil {
|
||||||
log.Println(err)
|
http.Error(w, "Die Session ist abgelaufen. Bitte erneut anmelden.", http.StatusUnauthorized)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -389,7 +382,7 @@ func EditUser(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|||||||
Image: user.ProfilePicLink,
|
Image: user.ProfilePicLink,
|
||||||
}
|
}
|
||||||
|
|
||||||
tmpl, err := template.ParseFiles(c.WebDir + "/templates/edit-user.html")
|
tmpl, err := template.ParseFiles(filepath.Join(c.WebDir, "templates", "edit-user.html"))
|
||||||
if err = template.Must(tmpl, err).ExecuteTemplate(w, "page-content", data); err != nil {
|
if err = template.Must(tmpl, err).ExecuteTemplate(w, "page-content", data); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
@ -398,12 +391,11 @@ func EditUser(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func UpdateUser(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
func UpdateUser(c *b.Config, db *b.DB, s map[string]*Session) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
session, err := GetSession(w, r, c, s)
|
session, err := ManageSession(w, r, c, s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
http.Error(w, "Die Session ist abgelaufen. Bitte erneut anmelden.", http.StatusUnauthorized)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -473,9 +465,9 @@ func UpdateUser(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
data := new(struct{ Role int })
|
data := new(struct{ Role int })
|
||||||
data.Role = session.Values["role"].(int)
|
data.Role = session.User.Role
|
||||||
|
|
||||||
tmpl := template.Must(template.ParseFiles(c.WebDir + "/templates/hub.html"))
|
tmpl := template.Must(template.ParseFiles(filepath.Join(c.WebDir, "templates", "hub.html")))
|
||||||
if err = tmpl.ExecuteTemplate(w, "page-content", data); err != nil {
|
if err = tmpl.ExecuteTemplate(w, "page-content", data); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
@ -484,12 +476,11 @@ func UpdateUser(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func DeleteUser(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
func DeleteUser(c *b.Config, db *b.DB, s map[string]*Session) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
session, err := GetSession(w, r, c, s)
|
session, err := ManageSession(w, r, c, s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
http.Error(w, "Die Session ist abgelaufen. Bitte erneut anmelden.", http.StatusUnauthorized)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -507,9 +498,9 @@ func DeleteUser(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
data := new(struct{ Role int })
|
data := new(struct{ Role int })
|
||||||
data.Role = session.Values["role"].(int)
|
data.Role = session.User.Role
|
||||||
|
|
||||||
tmpl, err := template.ParseFiles(c.WebDir + "/templates/hub.html")
|
tmpl, err := template.ParseFiles(filepath.Join(c.WebDir, "templates", "hub.html"))
|
||||||
tmpl = template.Must(tmpl, err)
|
tmpl = template.Must(tmpl, err)
|
||||||
if err = tmpl.ExecuteTemplate(w, "page-content", data); err != nil {
|
if err = tmpl.ExecuteTemplate(w, "page-content", data); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
|
117
cmd/main.go
117
cmd/main.go
@ -1,20 +1,16 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/gob"
|
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
"time"
|
||||||
|
|
||||||
b "streifling.com/jason/cpolis/cmd/backend"
|
b "streifling.com/jason/cpolis/cmd/backend"
|
||||||
c "streifling.com/jason/cpolis/cmd/calls"
|
c "streifling.com/jason/cpolis/cmd/calls"
|
||||||
f "streifling.com/jason/cpolis/cmd/frontend"
|
f "streifling.com/jason/cpolis/cmd/frontend"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
|
||||||
gob.Register(b.User{})
|
|
||||||
}
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
config, err := b.HandleConfig()
|
config, err := b.HandleConfig()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -28,74 +24,81 @@ func main() {
|
|||||||
defer logFile.Close()
|
defer logFile.Close()
|
||||||
log.SetOutput(logFile)
|
log.SetOutput(logFile)
|
||||||
|
|
||||||
db, err := b.OpenDB(config.DBName)
|
db, err := b.OpenDB(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalln(err)
|
log.Fatalln(err)
|
||||||
}
|
}
|
||||||
defer db.Close()
|
defer db.Close()
|
||||||
|
|
||||||
key, err := b.LoadKey(config.GOBKeyFile)
|
sessions, sessionExpiryChan := f.StartSessions()
|
||||||
|
defer close(sessionExpiryChan)
|
||||||
|
|
||||||
|
index, err := b.InitIndex(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
key, err = b.NewKey()
|
log.Fatalln(err)
|
||||||
if err != nil {
|
|
||||||
log.Fatalln(err)
|
|
||||||
}
|
|
||||||
if err = b.SaveKey(key, config.GOBKeyFile); err != nil {
|
|
||||||
log.Fatalln(err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
store := b.NewCookieStore(key)
|
|
||||||
|
go func(c *b.Config, db *b.DB) {
|
||||||
|
for {
|
||||||
|
if err = b.CleanUpImages(c, db); err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
}
|
||||||
|
time.Sleep(time.Hour * 24)
|
||||||
|
}
|
||||||
|
}(config, db)
|
||||||
|
|
||||||
mux := http.NewServeMux()
|
mux := http.NewServeMux()
|
||||||
mux.Handle("/web/static/", http.StripPrefix("/web/static/",
|
mux.Handle("/web/static/", http.StripPrefix("/web/static/",
|
||||||
http.FileServer(http.Dir(config.WebDir+"/static/"))))
|
http.FileServer(http.Dir(config.WebDir+"/static/"))))
|
||||||
mux.HandleFunc("/", f.HomePage(config, db, store))
|
mux.HandleFunc("/", f.HomePage(config, db, sessions))
|
||||||
|
|
||||||
mux.HandleFunc("GET /article/allow-edit/{id}", f.AllowEditArticle(config, db, store))
|
mux.HandleFunc("GET /article/allow-edit/{id}", f.AllowEditArticle(config, db, sessions))
|
||||||
mux.HandleFunc("GET /article/all-published/review-edit", f.ShowPublishedArticles(config, db, store, "review-edit"))
|
mux.HandleFunc("GET /article/all-published/review-edit", f.ShowPublishedArticles(config, db, sessions, "review-edit"))
|
||||||
mux.HandleFunc("GET /article/all-published/delete", f.ShowPublishedArticles(config, db, store, "review-delete"))
|
mux.HandleFunc("GET /article/all-published/delete", f.ShowPublishedArticles(config, db, sessions, "review-delete"))
|
||||||
mux.HandleFunc("GET /article/all-rejected", f.ShowRejectedArticles(config, db, store))
|
mux.HandleFunc("GET /article/all-rejected", f.ShowRejectedArticles(config, db, sessions))
|
||||||
mux.HandleFunc("GET /article/all-unpublished-unrejected-and-published-rejected", f.ShowUnpublishedUnrejectedAndPublishedRejectedArticles(config, db, store))
|
mux.HandleFunc("GET /article/all-unpublished-unrejected-and-published-rejected", f.ShowUnpublishedUnrejectedAndPublishedRejectedArticles(config, db, sessions))
|
||||||
mux.HandleFunc("GET /article/delete/{id}", f.DeleteArticle(config, db, store))
|
mux.HandleFunc("GET /article/delete/{id}", f.DeleteArticle(config, db, sessions))
|
||||||
mux.HandleFunc("GET /article/edit/{id}", f.EditArticle(config, db, store))
|
mux.HandleFunc("GET /article/edit/{id}", f.EditArticle(config, db, sessions))
|
||||||
mux.HandleFunc("GET /article/publish/{id}", f.PublishArticle(config, db, store))
|
mux.HandleFunc("GET /article/publish/{id}", f.PublishArticle(config, db, sessions, index))
|
||||||
mux.HandleFunc("GET /article/reject/{id}", f.RejectArticle(config, db, store))
|
mux.HandleFunc("GET /article/query/{query}", c.QueryArticles(config, index))
|
||||||
mux.HandleFunc("GET /article/review-delete/{id}", f.ReviewArticle(config, db, store, "delete", "Artikel löschen", "Löschen"))
|
mux.HandleFunc("GET /article/reject/{id}", f.RejectArticle(config, db, sessions))
|
||||||
mux.HandleFunc("GET /article/review-edit/{id}", f.ReviewArticle(config, db, store, "allow-edit", "Artikel bearbeiten", "Bearbeiten erlauben"))
|
mux.HandleFunc("GET /article/review-delete/{id}", f.ReviewArticle(config, db, sessions, "delete", "Artikel löschen", "Löschen"))
|
||||||
mux.HandleFunc("GET /article/review-rejected/{id}", f.ReviewRejectedArticle(config, db, store))
|
mux.HandleFunc("GET /article/review-edit/{id}", f.ReviewArticle(config, db, sessions, "allow-edit", "Artikel bearbeiten", "Bearbeiten erlauben"))
|
||||||
mux.HandleFunc("GET /article/review-unpublished/{id}", f.ReviewArticle(config, db, store, "publish", "Artikel veröffentlichen", "Veröffentlichen"))
|
mux.HandleFunc("GET /article/review-rejected/{id}", f.ReviewRejectedArticle(config, db, sessions))
|
||||||
mux.HandleFunc("GET /article/serve/{id}", c.ServeArticle(config, db))
|
mux.HandleFunc("GET /article/review-unpublished/{id}", f.ReviewArticle(config, db, sessions, "publish", "Artikel veröffentlichen", "Veröffentlichen"))
|
||||||
mux.HandleFunc("GET /article/serve/{id}/clicks", c.ServeClicks(db))
|
mux.HandleFunc("GET /article/serve/{uuid}", c.ServeArticle(config, db))
|
||||||
mux.HandleFunc("GET /article/write", f.WriteArticle(config, db, store))
|
mux.HandleFunc("GET /article/serve/{uuid}/clicks", c.ServeClicks(db))
|
||||||
|
mux.HandleFunc("GET /article/write", f.WriteArticle(config, db, sessions))
|
||||||
mux.HandleFunc("GET /atom/serve", c.ServeAtomFeed(config))
|
mux.HandleFunc("GET /atom/serve", c.ServeAtomFeed(config))
|
||||||
mux.HandleFunc("GET /hub", f.ShowHub(config, db, store))
|
mux.HandleFunc("GET /hub", f.ShowHub(config, db, sessions))
|
||||||
mux.HandleFunc("GET /image/serve/{pic}", c.ServeImage(config, store))
|
mux.HandleFunc("GET /image/serve/{pic}", c.ServeImage(config, sessions))
|
||||||
mux.HandleFunc("GET /issue/this", f.ShowCurrentIssue(config, db, store))
|
mux.HandleFunc("GET /issue/this", f.ShowCurrentIssue(config, db, sessions))
|
||||||
mux.HandleFunc("GET /logout", f.Logout(config, store))
|
mux.HandleFunc("GET /logout", f.Logout(config, sessions))
|
||||||
mux.HandleFunc("GET /pdf/get-list", c.ServePDFList(config))
|
mux.HandleFunc("GET /pdf/get-list", c.ServePDFList(config))
|
||||||
mux.HandleFunc("GET /pdf/serve/{id}", c.ServePDF(config))
|
mux.HandleFunc("GET /pdf/serve/{id}", c.ServePDF(config))
|
||||||
mux.HandleFunc("GET /tag/create", f.CreateTag(config, store))
|
mux.HandleFunc("GET /tag/create", f.CreateTag(config, sessions))
|
||||||
mux.HandleFunc("GET /user/create", f.CreateUser(config, store))
|
mux.HandleFunc("GET /user/create", f.CreateUser(config, sessions))
|
||||||
mux.HandleFunc("GET /user/delete/{id}", f.DeleteUser(config, db, store))
|
mux.HandleFunc("GET /user/delete/{id}", f.DeleteUser(config, db, sessions))
|
||||||
mux.HandleFunc("GET /user/edit/{id}", f.EditUser(config, db, store))
|
mux.HandleFunc("GET /user/edit/{id}", f.EditUser(config, db, sessions))
|
||||||
mux.HandleFunc("GET /user/edit/self", f.EditSelf(config, db, store))
|
mux.HandleFunc("GET /user/edit/self", f.EditSelf(config, db, sessions))
|
||||||
mux.HandleFunc("GET /user/show-all/delete", f.ShowAllUsers(config, db, store, "delete"))
|
mux.HandleFunc("GET /user/show-all/delete", f.ShowAllUsers(config, db, sessions, "delete"))
|
||||||
mux.HandleFunc("GET /user/show-all/edit", f.ShowAllUsers(config, db, store, "edit"))
|
mux.HandleFunc("GET /user/show-all/edit", f.ShowAllUsers(config, db, sessions, "edit"))
|
||||||
|
|
||||||
mux.HandleFunc("POST /article/resubmit/{id}", f.ResubmitArticle(config, db, store))
|
mux.HandleFunc("POST /article/resubmit/{id}", f.ResubmitArticle(config, db, sessions))
|
||||||
mux.HandleFunc("POST /article/submit", f.SubmitArticle(config, db, store))
|
mux.HandleFunc("POST /article/submit", f.SubmitArticle(config, db, sessions))
|
||||||
mux.HandleFunc("POST /article/upload-banner", f.UploadImage(config, store, "article-banner", "editor.html", "article-banner-template"))
|
mux.HandleFunc("POST /article/upload-banner", f.UploadImage(config, sessions, "article-banner", "editor.html", "article-banner-template"))
|
||||||
mux.HandleFunc("POST /article/upload-image", f.UploadEasyMDEImage(config, store))
|
mux.HandleFunc("POST /article/upload-image", f.UploadArticleImage(config, sessions))
|
||||||
mux.HandleFunc("POST /issue/publish", f.PublishLatestIssue(config, db, store))
|
mux.HandleFunc("POST /docx/upload", f.UploadDocx(config, db, sessions))
|
||||||
mux.HandleFunc("POST /issue/upload-banner", f.UploadImage(config, store, "issue-banner", "current-issue.html", "issue-banner-template"))
|
mux.HandleFunc("POST /issue/publish", f.PublishLatestIssue(config, db, sessions))
|
||||||
mux.HandleFunc("POST /login", f.Login(config, db, store))
|
mux.HandleFunc("POST /issue/upload-banner", f.UploadImage(config, sessions, "issue-banner", "current-issue.html", "issue-banner-template"))
|
||||||
mux.HandleFunc("POST /pdf/upload", f.UploadPDF(config, store))
|
mux.HandleFunc("POST /login", f.Login(config, db, sessions, sessionExpiryChan))
|
||||||
mux.HandleFunc("POST /tag/add", f.AddTag(config, db, store))
|
mux.HandleFunc("POST /pdf/upload", f.UploadPDF(config, sessions))
|
||||||
mux.HandleFunc("POST /user/add", f.AddUser(config, db, store))
|
mux.HandleFunc("POST /tag/add", f.AddTag(config, db, sessions))
|
||||||
mux.HandleFunc("POST /user/add-first", f.AddFirstUser(config, db, store))
|
mux.HandleFunc("POST /user/add", f.AddUser(config, db, sessions))
|
||||||
mux.HandleFunc("POST /user/update/{id}", f.UpdateUser(config, db, store))
|
mux.HandleFunc("POST /user/add-first", f.AddFirstUser(config, db, sessions, sessionExpiryChan))
|
||||||
mux.HandleFunc("POST /user/update/self", f.UpdateSelf(config, db, store))
|
mux.HandleFunc("POST /user/update/{id}", f.UpdateUser(config, db, sessions))
|
||||||
mux.HandleFunc("POST /user/upload-profile-pic", f.UploadImage(config, store, "upload-profile-pic", "edit-user.html", "profile-pic-template"))
|
mux.HandleFunc("POST /user/update/self", f.UpdateSelf(config, db, sessions))
|
||||||
|
mux.HandleFunc("POST /user/upload-profile-pic", f.UploadImage(config, sessions, "upload-profile-pic", "edit-user.html", "profile-pic-template"))
|
||||||
|
|
||||||
log.Fatalln(http.ListenAndServe(config.Port, mux))
|
log.Fatalln(http.ListenAndServe(config.Port, mux))
|
||||||
}
|
}
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=cpolis
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
ExecStart=/usr/local/bin/cpolis
|
|
||||||
Restart=on-failure
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=default.target
|
|
118
go.mod
118
go.mod
@ -3,76 +3,90 @@ module streifling.com/jason/cpolis
|
|||||||
go 1.23.2
|
go 1.23.2
|
||||||
|
|
||||||
require (
|
require (
|
||||||
firebase.google.com/go/v4 v4.15.0
|
firebase.google.com/go/v4 v4.15.2
|
||||||
git.streifling.com/jason/atom v1.0.0
|
git.streifling.com/jason/atom v1.0.1
|
||||||
github.com/BurntSushi/toml v1.4.0
|
github.com/BurntSushi/toml v1.4.0
|
||||||
|
github.com/blevesearch/bleve v1.0.14
|
||||||
github.com/chai2010/webp v1.1.1
|
github.com/chai2010/webp v1.1.1
|
||||||
github.com/disintegration/imaging v1.6.2
|
github.com/disintegration/imaging v1.6.2
|
||||||
github.com/go-sql-driver/mysql v1.8.1
|
github.com/gabriel-vasile/mimetype v1.4.8
|
||||||
|
github.com/go-sql-driver/mysql v1.9.0
|
||||||
github.com/google/uuid v1.6.0
|
github.com/google/uuid v1.6.0
|
||||||
github.com/gorilla/sessions v1.4.0
|
|
||||||
github.com/microcosm-cc/bluemonday v1.0.27
|
github.com/microcosm-cc/bluemonday v1.0.27
|
||||||
github.com/yuin/goldmark v1.7.8
|
github.com/yuin/goldmark v1.7.8
|
||||||
golang.org/x/crypto v0.28.0
|
golang.org/x/crypto v0.36.0
|
||||||
golang.org/x/term v0.25.0
|
golang.org/x/term v0.30.0
|
||||||
google.golang.org/api v0.203.0
|
google.golang.org/api v0.224.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
cel.dev/expr v0.18.0 // indirect
|
cel.dev/expr v0.22.0 // indirect
|
||||||
cloud.google.com/go v0.116.0 // indirect
|
cloud.google.com/go v0.118.3 // indirect
|
||||||
cloud.google.com/go/auth v0.9.9 // indirect
|
cloud.google.com/go/auth v0.15.0 // indirect
|
||||||
cloud.google.com/go/auth/oauth2adapt v0.2.4 // indirect
|
cloud.google.com/go/auth/oauth2adapt v0.2.7 // indirect
|
||||||
cloud.google.com/go/compute/metadata v0.5.2 // indirect
|
cloud.google.com/go/compute/metadata v0.6.0 // indirect
|
||||||
cloud.google.com/go/firestore v1.17.0 // indirect
|
cloud.google.com/go/firestore v1.18.0 // indirect
|
||||||
cloud.google.com/go/iam v1.2.2 // indirect
|
cloud.google.com/go/iam v1.4.1 // indirect
|
||||||
cloud.google.com/go/longrunning v0.6.2 // indirect
|
cloud.google.com/go/longrunning v0.6.5 // indirect
|
||||||
cloud.google.com/go/monitoring v1.21.2 // indirect
|
cloud.google.com/go/monitoring v1.24.0 // indirect
|
||||||
cloud.google.com/go/storage v1.45.0 // indirect
|
cloud.google.com/go/storage v1.50.0 // indirect
|
||||||
filippo.io/edwards25519 v1.1.0 // indirect
|
filippo.io/edwards25519 v1.1.0 // indirect
|
||||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.24.3 // indirect
|
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.27.0 // indirect
|
||||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.48.3 // indirect
|
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.51.0 // indirect
|
||||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.48.3 // indirect
|
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.51.0 // indirect
|
||||||
github.com/MicahParks/keyfunc v1.9.0 // indirect
|
github.com/MicahParks/keyfunc v1.9.0 // indirect
|
||||||
|
github.com/RoaringBitmap/roaring v1.9.4 // indirect
|
||||||
github.com/aymerick/douceur v0.2.0 // indirect
|
github.com/aymerick/douceur v0.2.0 // indirect
|
||||||
github.com/census-instrumentation/opencensus-proto v0.4.1 // indirect
|
github.com/bits-and-blooms/bitset v1.21.0 // indirect
|
||||||
|
github.com/blevesearch/go-porterstemmer v1.0.3 // indirect
|
||||||
|
github.com/blevesearch/mmap-go v1.0.4 // indirect
|
||||||
|
github.com/blevesearch/segment v0.9.1 // indirect
|
||||||
|
github.com/blevesearch/snowballstem v0.9.0 // indirect
|
||||||
|
github.com/blevesearch/zap/v11 v11.0.14 // indirect
|
||||||
|
github.com/blevesearch/zap/v12 v12.0.14 // indirect
|
||||||
|
github.com/blevesearch/zap/v13 v13.0.6 // indirect
|
||||||
|
github.com/blevesearch/zap/v14 v14.0.5 // indirect
|
||||||
|
github.com/blevesearch/zap/v15 v15.0.3 // indirect
|
||||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||||
github.com/cncf/xds/go v0.0.0-20240905190251-b4127c9b8d78 // indirect
|
github.com/cncf/xds/go v0.0.0-20250121191232-2f005788dc42 // indirect
|
||||||
github.com/envoyproxy/go-control-plane v0.13.1 // indirect
|
github.com/couchbase/vellum v1.0.2 // indirect
|
||||||
github.com/envoyproxy/protoc-gen-validate v1.1.0 // indirect
|
github.com/envoyproxy/go-control-plane/envoy v1.32.4 // indirect
|
||||||
|
github.com/envoyproxy/protoc-gen-validate v1.2.1 // indirect
|
||||||
github.com/felixge/httpsnoop v1.0.4 // indirect
|
github.com/felixge/httpsnoop v1.0.4 // indirect
|
||||||
github.com/go-logr/logr v1.4.2 // indirect
|
github.com/go-logr/logr v1.4.2 // indirect
|
||||||
github.com/go-logr/stdr v1.2.2 // indirect
|
github.com/go-logr/stdr v1.2.2 // indirect
|
||||||
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
|
github.com/golang-jwt/jwt/v4 v4.5.1 // indirect
|
||||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
|
||||||
github.com/golang/protobuf v1.5.4 // indirect
|
github.com/golang/protobuf v1.5.4 // indirect
|
||||||
github.com/google/s2a-go v0.1.8 // indirect
|
github.com/golang/snappy v1.0.0 // indirect
|
||||||
github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect
|
github.com/google/s2a-go v0.1.9 // indirect
|
||||||
github.com/googleapis/gax-go/v2 v2.13.0 // indirect
|
github.com/googleapis/enterprise-certificate-proxy v0.3.5 // indirect
|
||||||
|
github.com/googleapis/gax-go/v2 v2.14.1 // indirect
|
||||||
github.com/gorilla/css v1.0.1 // indirect
|
github.com/gorilla/css v1.0.1 // indirect
|
||||||
github.com/gorilla/securecookie v1.1.2 // indirect
|
github.com/mschoch/smat v0.2.0 // indirect
|
||||||
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
|
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
|
||||||
go.opencensus.io v0.24.0 // indirect
|
github.com/steveyen/gtreap v0.1.0 // indirect
|
||||||
go.opentelemetry.io/contrib/detectors/gcp v1.31.0 // indirect
|
github.com/willf/bitset v1.1.11 // indirect
|
||||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.56.0 // indirect
|
go.etcd.io/bbolt v1.4.0 // indirect
|
||||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 // indirect
|
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
|
||||||
go.opentelemetry.io/otel v1.31.0 // indirect
|
go.opentelemetry.io/contrib/detectors/gcp v1.35.0 // indirect
|
||||||
go.opentelemetry.io/otel/metric v1.31.0 // indirect
|
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.60.0 // indirect
|
||||||
go.opentelemetry.io/otel/sdk v1.31.0 // indirect
|
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0 // indirect
|
||||||
go.opentelemetry.io/otel/sdk/metric v1.31.0 // indirect
|
go.opentelemetry.io/otel v1.35.0 // indirect
|
||||||
go.opentelemetry.io/otel/trace v1.31.0 // indirect
|
go.opentelemetry.io/otel/metric v1.35.0 // indirect
|
||||||
golang.org/x/image v0.21.0 // indirect
|
go.opentelemetry.io/otel/sdk v1.35.0 // indirect
|
||||||
golang.org/x/net v0.30.0 // indirect
|
go.opentelemetry.io/otel/sdk/metric v1.35.0 // indirect
|
||||||
golang.org/x/oauth2 v0.23.0 // indirect
|
go.opentelemetry.io/otel/trace v1.35.0 // indirect
|
||||||
golang.org/x/sync v0.8.0 // indirect
|
golang.org/x/image v0.25.0 // indirect
|
||||||
golang.org/x/sys v0.26.0 // indirect
|
golang.org/x/net v0.37.0 // indirect
|
||||||
golang.org/x/text v0.19.0 // indirect
|
golang.org/x/oauth2 v0.28.0 // indirect
|
||||||
golang.org/x/time v0.7.0 // indirect
|
golang.org/x/sync v0.12.0 // indirect
|
||||||
|
golang.org/x/sys v0.31.0 // indirect
|
||||||
|
golang.org/x/text v0.23.0 // indirect
|
||||||
|
golang.org/x/time v0.11.0 // indirect
|
||||||
google.golang.org/appengine/v2 v2.0.6 // indirect
|
google.golang.org/appengine/v2 v2.0.6 // indirect
|
||||||
google.golang.org/genproto v0.0.0-20241021214115-324edc3d5d38 // indirect
|
google.golang.org/genproto v0.0.0-20250303144028-a0af3efb3deb // indirect
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20241021214115-324edc3d5d38 // indirect
|
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb // indirect
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38 // indirect
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb // indirect
|
||||||
google.golang.org/grpc v1.67.1 // indirect
|
google.golang.org/grpc v1.71.0 // indirect
|
||||||
google.golang.org/grpc/stats/opentelemetry v0.0.0-20241025232817-cb329375b14e // indirect
|
google.golang.org/protobuf v1.36.5 // indirect
|
||||||
google.golang.org/protobuf v1.35.1 // indirect
|
|
||||||
)
|
)
|
||||||
|
413
go.sum
413
go.sum
@ -1,270 +1,307 @@
|
|||||||
cel.dev/expr v0.18.0 h1:CJ6drgk+Hf96lkLikr4rFf19WrU0BOWEihyZnI2TAzo=
|
cel.dev/expr v0.22.0 h1:+hFFhLPmquBImfs1BiN2PZmkr5ASse2ZOuaxIs9e4R8=
|
||||||
cel.dev/expr v0.18.0/go.mod h1:MrpN08Q+lEBs+bGYdLxxHkZoUSsCp0nSKTs0nTymJgw=
|
cel.dev/expr v0.22.0/go.mod h1:MrpN08Q+lEBs+bGYdLxxHkZoUSsCp0nSKTs0nTymJgw=
|
||||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
cloud.google.com/go v0.118.3 h1:jsypSnrE/w4mJysioGdMBg4MiW/hHx/sArFpaBWHdME=
|
||||||
cloud.google.com/go v0.116.0 h1:B3fRrSDkLRt5qSHWe40ERJvhvnQwdZiHu0bJOpldweE=
|
cloud.google.com/go v0.118.3/go.mod h1:Lhs3YLnBlwJ4KA6nuObNMZ/fCbOQBPuWKPoE0Wa/9Vc=
|
||||||
cloud.google.com/go v0.116.0/go.mod h1:cEPSRWPzZEswwdr9BxE6ChEn01dWlTaF05LiC2Xs70U=
|
cloud.google.com/go/auth v0.15.0 h1:Ly0u4aA5vG/fsSsxu98qCQBemXtAtJf+95z9HK+cxps=
|
||||||
cloud.google.com/go/auth v0.9.9 h1:BmtbpNQozo8ZwW2t7QJjnrQtdganSdmqeIBxHxNkEZQ=
|
cloud.google.com/go/auth v0.15.0/go.mod h1:WJDGqZ1o9E9wKIL+IwStfyn/+s59zl4Bi+1KQNVXLZ8=
|
||||||
cloud.google.com/go/auth v0.9.9/go.mod h1:xxA5AqpDrvS+Gkmo9RqrGGRh6WSNKKOXhY3zNOr38tI=
|
cloud.google.com/go/auth/oauth2adapt v0.2.7 h1:/Lc7xODdqcEw8IrZ9SvwnlLX6j9FHQM74z6cBk9Rw6M=
|
||||||
cloud.google.com/go/auth/oauth2adapt v0.2.4 h1:0GWE/FUsXhf6C+jAkWgYm7X9tK8cuEIfy19DBn6B6bY=
|
cloud.google.com/go/auth/oauth2adapt v0.2.7/go.mod h1:NTbTTzfvPl1Y3V1nPpOgl2w6d/FjO7NNUQaWSox6ZMc=
|
||||||
cloud.google.com/go/auth/oauth2adapt v0.2.4/go.mod h1:jC/jOpwFP6JBxhB3P5Rr0a9HLMC/Pe3eaL4NmdvqPtc=
|
cloud.google.com/go/compute/metadata v0.6.0 h1:A6hENjEsCDtC1k8byVsgwvVcioamEHvZ4j01OwKxG9I=
|
||||||
cloud.google.com/go/compute/metadata v0.5.2 h1:UxK4uu/Tn+I3p2dYWTfiX4wva7aYlKixAHn3fyqngqo=
|
cloud.google.com/go/compute/metadata v0.6.0/go.mod h1:FjyFAW1MW0C203CEOMDTu3Dk1FlqW3Rga40jzHL4hfg=
|
||||||
cloud.google.com/go/compute/metadata v0.5.2/go.mod h1:C66sj2AluDcIqakBq/M8lw8/ybHgOZqin2obFxa/E5k=
|
cloud.google.com/go/firestore v1.18.0 h1:cuydCaLS7Vl2SatAeivXyhbhDEIR8BDmtn4egDhIn2s=
|
||||||
cloud.google.com/go/firestore v1.17.0 h1:iEd1LBbkDZTFsLw3sTH50eyg4qe8eoG6CjocmEXO9aQ=
|
cloud.google.com/go/firestore v1.18.0/go.mod h1:5ye0v48PhseZBdcl0qbl3uttu7FIEwEYVaWm0UIEOEU=
|
||||||
cloud.google.com/go/firestore v1.17.0/go.mod h1:69uPx1papBsY8ZETooc71fOhoKkD70Q1DwMrtKuOT/Y=
|
cloud.google.com/go/iam v1.4.1 h1:cFC25Nv+u5BkTR/BT1tXdoF2daiVbZ1RLx2eqfQ9RMM=
|
||||||
cloud.google.com/go/iam v1.2.2 h1:ozUSofHUGf/F4tCNy/mu9tHLTaxZFLOUiKzjcgWHGIA=
|
cloud.google.com/go/iam v1.4.1/go.mod h1:2vUEJpUG3Q9p2UdsyksaKpDzlwOrnMzS30isdReIcLM=
|
||||||
cloud.google.com/go/iam v1.2.2/go.mod h1:0Ys8ccaZHdI1dEUilwzqng/6ps2YB6vRsjIe00/+6JY=
|
cloud.google.com/go/logging v1.13.0 h1:7j0HgAp0B94o1YRDqiqm26w4q1rDMH7XNRU34lJXHYc=
|
||||||
cloud.google.com/go/logging v1.12.0 h1:ex1igYcGFd4S/RZWOCU51StlIEuey5bjqwH9ZYjHibk=
|
cloud.google.com/go/logging v1.13.0/go.mod h1:36CoKh6KA/M0PbhPKMq6/qety2DCAErbhXT62TuXALA=
|
||||||
cloud.google.com/go/logging v1.12.0/go.mod h1:wwYBt5HlYP1InnrtYI0wtwttpVU1rifnMT7RejksUAM=
|
cloud.google.com/go/longrunning v0.6.5 h1:sD+t8DO8j4HKW4QfouCklg7ZC1qC4uzVZt8iz3uTW+Q=
|
||||||
cloud.google.com/go/longrunning v0.6.2 h1:xjDfh1pQcWPEvnfjZmwjKQEcHnpz6lHjfy7Fo0MK+hc=
|
cloud.google.com/go/longrunning v0.6.5/go.mod h1:Et04XK+0TTLKa5IPYryKf5DkpwImy6TluQ1QTLwlKmY=
|
||||||
cloud.google.com/go/longrunning v0.6.2/go.mod h1:k/vIs83RN4bE3YCswdXC5PFfWVILjm3hpEUlSko4PiI=
|
cloud.google.com/go/monitoring v1.24.0 h1:csSKiCJ+WVRgNkRzzz3BPoGjFhjPY23ZTcaenToJxMM=
|
||||||
cloud.google.com/go/monitoring v1.21.2 h1:FChwVtClH19E7pJ+e0xUhJPGksctZNVOk2UhMmblmdU=
|
cloud.google.com/go/monitoring v1.24.0/go.mod h1:Bd1PRK5bmQBQNnuGwHBfUamAV1ys9049oEPHnn4pcsc=
|
||||||
cloud.google.com/go/monitoring v1.21.2/go.mod h1:hS3pXvaG8KgWTSz+dAdyzPrGUYmi2Q+WFX8g2hqVEZU=
|
cloud.google.com/go/storage v1.50.0 h1:3TbVkzTooBvnZsk7WaAQfOsNrdoM8QHusXA1cpk6QJs=
|
||||||
cloud.google.com/go/storage v1.45.0 h1:5av0QcIVj77t+44mV4gffFC/LscFRUhto6UBMB5SimM=
|
cloud.google.com/go/storage v1.50.0/go.mod h1:l7XeiD//vx5lfqE3RavfmU9yvk5Pp0Zhcv482poyafY=
|
||||||
cloud.google.com/go/storage v1.45.0/go.mod h1:wpPblkIuMP5jCB/E48Pz9zIo2S/zD8g+ITmxKkPCITE=
|
cloud.google.com/go/trace v1.11.3 h1:c+I4YFjxRQjvAhRmSsmjpASUKq88chOX854ied0K/pE=
|
||||||
cloud.google.com/go/trace v1.11.1 h1:UNqdP+HYYtnm6lb91aNA5JQ0X14GnxkABGlfz2PzPew=
|
cloud.google.com/go/trace v1.11.3/go.mod h1:pt7zCYiDSQjC9Y2oqCsh9jF4GStB/hmjrYLsxRR27q8=
|
||||||
cloud.google.com/go/trace v1.11.1/go.mod h1:IQKNQuBzH72EGaXEodKlNJrWykGZxet2zgjtS60OtjA=
|
|
||||||
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
|
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
|
||||||
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
||||||
firebase.google.com/go/v4 v4.15.0 h1:k27M+cHbyN1YpBI2Cf4NSjeHnnYRB9ldXwpqA5KikN0=
|
firebase.google.com/go/v4 v4.15.2 h1:KJtV4rAfO2CVCp40hBfVk+mqUqg7+jQKx7yOgFDnXBg=
|
||||||
firebase.google.com/go/v4 v4.15.0/go.mod h1:S/4MJqVZn1robtXkHhpRUbwOC4gdYtgsiMMJQ4x+xmQ=
|
firebase.google.com/go/v4 v4.15.2/go.mod h1:qkD/HtSumrPMTLs0ahQrje5gTw2WKFKrzVFoqy4SbKA=
|
||||||
git.streifling.com/jason/atom v1.0.0 h1:E88z4S7JeT6T+WuAaJWnGwCWTx+vzSJ6giUL51MdptI=
|
git.streifling.com/jason/atom v1.0.1 h1:G1PtNt1+qlzxpwjlD6iDeseFmzoac1IYxdq9twofTFY=
|
||||||
git.streifling.com/jason/atom v1.0.0/go.mod h1:FNTYJfatYaIOQn4OKy8y+Mtohqm3MeyEGZUu4bMtZ9E=
|
git.streifling.com/jason/atom v1.0.1/go.mod h1:FNTYJfatYaIOQn4OKy8y+Mtohqm3MeyEGZUu4bMtZ9E=
|
||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0=
|
github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0=
|
||||||
github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
|
github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
|
||||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.24.3 h1:cb3br57K508pQEFgBxn9GDhPS9HefpyMPK1RzmtMNzk=
|
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.27.0 h1:ErKg/3iS1AKcTkf3yixlZ54f9U1rljCkQyEXWUnIUxc=
|
||||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.24.3/go.mod h1:itPGVDKf9cC/ov4MdvJ2QZ0khw4bfoo9jzwTJlaxy2k=
|
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.27.0/go.mod h1:yAZHSGnqScoU556rBOVkwLze6WP5N+U11RHuWaGVxwY=
|
||||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.48.3 h1:xir5X8TS8UBVPWg2jHL+cSTf0jZgqYQSA54TscSt1/0=
|
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.51.0 h1:fYE9p3esPxA/C0rQ0AHhP0drtPXDRhaWiwg1DPqO7IU=
|
||||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.48.3/go.mod h1:SsdWig2J5PMnfMvfJuEb1uZa8Y+kvNyvrULFo69gTFk=
|
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.51.0/go.mod h1:BnBReJLvVYx2CS/UHOgVz2BXKXD9wsQPxZug20nZhd0=
|
||||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/cloudmock v0.48.3 h1:Nl7phYyHjnqofWDpD+6FYdiwtNIxebn0AHLry7Sxb0M=
|
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/cloudmock v0.51.0 h1:OqVGm6Ei3x5+yZmSJG1Mh2NwHvpVmZ08CB5qJhT9Nuk=
|
||||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/cloudmock v0.48.3/go.mod h1:pNP/L2wDlaQnQlFvkDKGSruDoYRpmAxB6drgsskfYwg=
|
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/cloudmock v0.51.0/go.mod h1:SZiPHWGOOk3bl8tkevxkoiwPgsIl6CwrWcbwjfHZpdM=
|
||||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.48.3 h1:2vcVkrNdSMJpoOVAWi9ApsQR5iqNeFGt5Qx8Xlt3IoI=
|
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.51.0 h1:6/0iUd0xrnX7qt+mLNRwg5c0PGv8wpE8K90ryANQwMI=
|
||||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.48.3/go.mod h1:wRbFgBQUVm1YXrvWKofAEmq9HNJTDphbAaJSSX01KUI=
|
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.51.0/go.mod h1:otE2jQekW/PqXk1Awf5lmfokJx4uwuqcj1ab5SpGeW0=
|
||||||
github.com/MicahParks/keyfunc v1.9.0 h1:lhKd5xrFHLNOWrDc4Tyb/Q1AJ4LCzQ48GVJyVIID3+o=
|
github.com/MicahParks/keyfunc v1.9.0 h1:lhKd5xrFHLNOWrDc4Tyb/Q1AJ4LCzQ48GVJyVIID3+o=
|
||||||
github.com/MicahParks/keyfunc v1.9.0/go.mod h1:IdnCilugA0O/99dW+/MkvlyrsX8+L8+x95xuVNtM5jw=
|
github.com/MicahParks/keyfunc v1.9.0/go.mod h1:IdnCilugA0O/99dW+/MkvlyrsX8+L8+x95xuVNtM5jw=
|
||||||
|
github.com/RoaringBitmap/roaring v0.4.23/go.mod h1:D0gp8kJQgE1A4LQ5wFLggQEyvDi06Mq5mKs52e1TwOo=
|
||||||
|
github.com/RoaringBitmap/roaring v1.9.4 h1:yhEIoH4YezLYT04s1nHehNO64EKFTop/wBhxv2QzDdQ=
|
||||||
|
github.com/RoaringBitmap/roaring v1.9.4/go.mod h1:6AXUsoIEzDTFFQCe1RbGA6uFONMhvejWj5rqITANK90=
|
||||||
|
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
|
||||||
github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk=
|
github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk=
|
||||||
github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4=
|
github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4=
|
||||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
github.com/bits-and-blooms/bitset v1.12.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
|
||||||
github.com/census-instrumentation/opencensus-proto v0.4.1 h1:iKLQ0xPNFxR/2hzXZMrBo8f1j86j5WHzznCCQxV/b8g=
|
github.com/bits-and-blooms/bitset v1.21.0 h1:9RlxRbMI5dRNNburKqfDSiz5POfImKgtablyV01WUw0=
|
||||||
github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw=
|
github.com/bits-and-blooms/bitset v1.21.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
|
||||||
|
github.com/blevesearch/bleve v1.0.14 h1:Q8r+fHTt35jtGXJUM0ULwM3Tzg+MRfyai4ZkWDy2xO4=
|
||||||
|
github.com/blevesearch/bleve v1.0.14/go.mod h1:e/LJTr+E7EaoVdkQZTfoz7dt4KoDNvDbLb8MSKuNTLQ=
|
||||||
|
github.com/blevesearch/blevex v1.0.0 h1:pnilj2Qi3YSEGdWgLj1Pn9Io7ukfXPoQcpAI1Bv8n/o=
|
||||||
|
github.com/blevesearch/blevex v1.0.0/go.mod h1:2rNVqoG2BZI8t1/P1awgTKnGlx5MP9ZbtEciQaNhswc=
|
||||||
|
github.com/blevesearch/cld2 v0.0.0-20200327141045-8b5f551d37f5/go.mod h1:PN0QNTLs9+j1bKy3d/GB/59wsNBFC4sWLWG3k69lWbc=
|
||||||
|
github.com/blevesearch/go-porterstemmer v1.0.3 h1:GtmsqID0aZdCSNiY8SkuPJ12pD4jI+DdXTAn4YRcHCo=
|
||||||
|
github.com/blevesearch/go-porterstemmer v1.0.3/go.mod h1:angGc5Ht+k2xhJdZi511LtmxuEf0OVpvUUNrwmM1P7M=
|
||||||
|
github.com/blevesearch/mmap-go v1.0.2/go.mod h1:ol2qBqYaOUsGdm7aRMRrYGgPvnwLe6Y+7LMvAB5IbSA=
|
||||||
|
github.com/blevesearch/mmap-go v1.0.4 h1:OVhDhT5B/M1HNPpYPBKIEJaD0F3Si+CrEKULGCDPWmc=
|
||||||
|
github.com/blevesearch/mmap-go v1.0.4/go.mod h1:EWmEAOmdAS9z/pi/+Toxu99DnsbhG1TIxUoRmJw/pSs=
|
||||||
|
github.com/blevesearch/segment v0.9.0/go.mod h1:9PfHYUdQCgHktBgvtUOF4x+pc4/l8rdH0u5spnW85UQ=
|
||||||
|
github.com/blevesearch/segment v0.9.1 h1:+dThDy+Lvgj5JMxhmOVlgFfkUtZV2kw49xax4+jTfSU=
|
||||||
|
github.com/blevesearch/segment v0.9.1/go.mod h1:zN21iLm7+GnBHWTao9I+Au/7MBiL8pPFtJBJTsk6kQw=
|
||||||
|
github.com/blevesearch/snowballstem v0.9.0 h1:lMQ189YspGP6sXvZQ4WZ+MLawfV8wOmPoD/iWeNXm8s=
|
||||||
|
github.com/blevesearch/snowballstem v0.9.0/go.mod h1:PivSj3JMc8WuaFkTSRDW2SlrulNWPl4ABg1tC/hlgLs=
|
||||||
|
github.com/blevesearch/zap/v11 v11.0.14 h1:IrDAvtlzDylh6H2QCmS0OGcN9Hpf6mISJlfKjcwJs7k=
|
||||||
|
github.com/blevesearch/zap/v11 v11.0.14/go.mod h1:MUEZh6VHGXv1PKx3WnCbdP404LGG2IZVa/L66pyFwnY=
|
||||||
|
github.com/blevesearch/zap/v12 v12.0.14 h1:2o9iRtl1xaRjsJ1xcqTyLX414qPAwykHNV7wNVmbp3w=
|
||||||
|
github.com/blevesearch/zap/v12 v12.0.14/go.mod h1:rOnuZOiMKPQj18AEKEHJxuI14236tTQ1ZJz4PAnWlUg=
|
||||||
|
github.com/blevesearch/zap/v13 v13.0.6 h1:r+VNSVImi9cBhTNNR+Kfl5uiGy8kIbb0JMz/h8r6+O4=
|
||||||
|
github.com/blevesearch/zap/v13 v13.0.6/go.mod h1:L89gsjdRKGyGrRN6nCpIScCvvkyxvmeDCwZRcjjPCrw=
|
||||||
|
github.com/blevesearch/zap/v14 v14.0.5 h1:NdcT+81Nvmp2zL+NhwSvGSLh7xNgGL8QRVZ67njR0NU=
|
||||||
|
github.com/blevesearch/zap/v14 v14.0.5/go.mod h1:bWe8S7tRrSBTIaZ6cLRbgNH4TUDaC9LZSpRGs85AsGY=
|
||||||
|
github.com/blevesearch/zap/v15 v15.0.3 h1:Ylj8Oe+mo0P25tr9iLPp33lN6d4qcztGjaIsP51UxaY=
|
||||||
|
github.com/blevesearch/zap/v15 v15.0.3/go.mod h1:iuwQrImsh1WjWJ0Ue2kBqY83a0rFtJTqfa9fp1rbVVU=
|
||||||
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
||||||
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||||
github.com/chai2010/webp v1.1.1 h1:jTRmEccAJ4MGrhFOrPMpNGIJ/eybIgwKpcACsrTEapk=
|
github.com/chai2010/webp v1.1.1 h1:jTRmEccAJ4MGrhFOrPMpNGIJ/eybIgwKpcACsrTEapk=
|
||||||
github.com/chai2010/webp v1.1.1/go.mod h1:0XVwvZWdjjdxpUEIf7b9g9VkHFnInUSYujwqTLEuldU=
|
github.com/chai2010/webp v1.1.1/go.mod h1:0XVwvZWdjjdxpUEIf7b9g9VkHFnInUSYujwqTLEuldU=
|
||||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
github.com/cncf/xds/go v0.0.0-20250121191232-2f005788dc42 h1:Om6kYQYDUk5wWbT0t0q6pvyM49i9XZAv9dDrkDA7gjk=
|
||||||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
github.com/cncf/xds/go v0.0.0-20250121191232-2f005788dc42/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8=
|
||||||
github.com/cncf/xds/go v0.0.0-20240905190251-b4127c9b8d78 h1:QVw89YDxXxEe+l8gU8ETbOasdwEV+avkR75ZzsVV9WI=
|
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
|
||||||
github.com/cncf/xds/go v0.0.0-20240905190251-b4127c9b8d78/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8=
|
github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk=
|
||||||
|
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
||||||
|
github.com/couchbase/ghistogram v0.1.0/go.mod h1:s1Jhy76zqfEecpNWJfWUiKZookAFaiGOEoyzgHt9i7k=
|
||||||
|
github.com/couchbase/moss v0.1.0/go.mod h1:9MaHIaRuy9pvLPUJxB8sh8OrLfyDczECVL37grCIubs=
|
||||||
|
github.com/couchbase/vellum v1.0.2 h1:BrbP0NKiyDdndMPec8Jjhy0U47CZ0Lgx3xUC2r9rZqw=
|
||||||
|
github.com/couchbase/vellum v1.0.2/go.mod h1:FcwrEivFpNi24R3jLOs3n+fs5RnuQnQqCLBJ1uAg1W4=
|
||||||
|
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
|
||||||
|
github.com/cznic/b v0.0.0-20181122101859-a26611c4d92d h1:SwD98825d6bdB+pEuTxWOXiSjBrHdOl/UVp75eI7JT8=
|
||||||
|
github.com/cznic/b v0.0.0-20181122101859-a26611c4d92d/go.mod h1:URriBxXwVq5ijiJ12C7iIZqlA69nTlI+LgI6/pwftG8=
|
||||||
|
github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548/go.mod h1:e6NPNENfs9mPDVNRekM7lKScauxd5kXTr1Mfyig6TDM=
|
||||||
|
github.com/cznic/strutil v0.0.0-20181122101858-275e90344537/go.mod h1:AHHPPPXTw0h6pVabbcbyGRK1DckRn7r/STdZEeIDzZc=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1ei82L+c=
|
github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1ei82L+c=
|
||||||
github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4=
|
github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4=
|
||||||
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
github.com/envoyproxy/go-control-plane v0.13.4 h1:zEqyPVyku6IvWCFwux4x9RxkLOMUL+1vC9xUFv5l2/M=
|
||||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
github.com/envoyproxy/go-control-plane v0.13.4/go.mod h1:kDfuBlDVsSj2MjrLEtRWtHlsWIFcGyB2RMO44Dc5GZA=
|
||||||
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
github.com/envoyproxy/go-control-plane/envoy v1.32.4 h1:jb83lalDRZSpPWW2Z7Mck/8kXZ5CQAFYVjQcdVIr83A=
|
||||||
github.com/envoyproxy/go-control-plane v0.13.1 h1:vPfJZCkob6yTMEgS+0TwfTUfbHjfy/6vOJ8hUWX/uXE=
|
github.com/envoyproxy/go-control-plane/envoy v1.32.4/go.mod h1:Gzjc5k8JcJswLjAx1Zm+wSYE20UrLtt7JZMWiWQXQEw=
|
||||||
github.com/envoyproxy/go-control-plane v0.13.1/go.mod h1:X45hY0mufo6Fd0KW3rqsGvQMw58jvjymeCzBU3mWyHw=
|
github.com/envoyproxy/go-control-plane/ratelimit v0.1.0 h1:/G9QYbddjL25KvtKTv3an9lx6VBE2cnb8wp1vEGNYGI=
|
||||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
github.com/envoyproxy/go-control-plane/ratelimit v0.1.0/go.mod h1:Wk+tMFAFbCXaJPzVVHnPgRKdUdwW/KdbRt94AzgRee4=
|
||||||
github.com/envoyproxy/protoc-gen-validate v1.1.0 h1:tntQDh69XqOCOZsDz0lVJQez/2L6Uu2PdjCQwWCJ3bM=
|
github.com/envoyproxy/protoc-gen-validate v1.2.1 h1:DEo3O99U8j4hBFwbJfrz9VtgcDfUKS7KJ7spH3d86P8=
|
||||||
github.com/envoyproxy/protoc-gen-validate v1.1.0/go.mod h1:sXRDRVmzEbkM7CVcM06s9shE/m23dg3wzjl0UWqJ2q4=
|
github.com/envoyproxy/protoc-gen-validate v1.2.1/go.mod h1:d/C80l/jxXLdfEIhX1W2TmLfsJ31lvEjwamM4DxlWXU=
|
||||||
|
github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64=
|
||||||
|
github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg=
|
||||||
|
github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0=
|
||||||
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
|
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
|
||||||
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
|
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
|
||||||
|
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||||
|
github.com/gabriel-vasile/mimetype v1.4.8 h1:FfZ3gj38NjllZIeJAmMhr+qKL8Wu+nOoI3GqacKw1NM=
|
||||||
|
github.com/gabriel-vasile/mimetype v1.4.8/go.mod h1:ByKUIKGjh1ODkGM1asKUbQZOLGrPjydw3hYPU2YU9t8=
|
||||||
|
github.com/glycerine/go-unsnap-stream v0.0.0-20181221182339-f9677308dec2/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE=
|
||||||
|
github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24=
|
||||||
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
||||||
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
|
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
|
||||||
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||||
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
||||||
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
||||||
github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y=
|
github.com/go-sql-driver/mysql v1.9.0 h1:Y0zIbQXhQKmQgTp44Y1dp3wTXcn804QoTptLZT1vtvo=
|
||||||
github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg=
|
github.com/go-sql-driver/mysql v1.9.0/go.mod h1:pDetrLJeA3oMujJuvXc8RJoasr589B6A9fwzD3QMrqw=
|
||||||
github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
|
github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
|
||||||
github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg=
|
github.com/golang-jwt/jwt/v4 v4.5.1 h1:JdqV9zKUdtaa9gdPlywC3aeoEsR681PlKC+4F5gQgeo=
|
||||||
github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
|
github.com/golang-jwt/jwt/v4 v4.5.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
|
||||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
|
||||||
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
|
||||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
|
|
||||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
|
||||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
|
||||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
|
||||||
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
|
||||||
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
|
||||||
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
|
||||||
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
|
||||||
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
|
|
||||||
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
|
||||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||||
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||||
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
github.com/golang/snappy v1.0.0 h1:Oy607GVXHs7RtbggtPBnr2RmDArIsAefDwvrdWvRhGs=
|
||||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
github.com/golang/snappy v1.0.0/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||||
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
|
||||||
github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
|
||||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
||||||
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
|
|
||||||
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
|
||||||
github.com/google/martian/v3 v3.3.3 h1:DIhPTQrbPkgs2yJYdXU/eNACCG5DVQjySNRNlflZ9Fc=
|
github.com/google/martian/v3 v3.3.3 h1:DIhPTQrbPkgs2yJYdXU/eNACCG5DVQjySNRNlflZ9Fc=
|
||||||
github.com/google/martian/v3 v3.3.3/go.mod h1:iEPrYcgCF7jA9OtScMFQyAlZZ4YXTKEtJ1E6RWzmBA0=
|
github.com/google/martian/v3 v3.3.3/go.mod h1:iEPrYcgCF7jA9OtScMFQyAlZZ4YXTKEtJ1E6RWzmBA0=
|
||||||
github.com/google/s2a-go v0.1.8 h1:zZDs9gcbt9ZPLV0ndSyQk6Kacx2g/X+SKYovpnz3SMM=
|
github.com/google/s2a-go v0.1.9 h1:LGD7gtMgezd8a/Xak7mEWL0PjoTQFvpRudN895yqKW0=
|
||||||
github.com/google/s2a-go v0.1.8/go.mod h1:6iNWHTpQ+nfNRN5E00MSdfDwVesa8hhS32PhPO8deJA=
|
github.com/google/s2a-go v0.1.9/go.mod h1:YA0Ei2ZQL3acow2O62kdp9UlnvMmU7kA6Eutn0dXayM=
|
||||||
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
|
||||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/googleapis/enterprise-certificate-proxy v0.3.4 h1:XYIDZApgAnrN1c855gTgghdIA6Stxb52D5RnLI1SLyw=
|
github.com/googleapis/enterprise-certificate-proxy v0.3.5 h1:VgzTY2jogw3xt39CusEnFJWm7rlsq5yL5q9XdLOuP5g=
|
||||||
github.com/googleapis/enterprise-certificate-proxy v0.3.4/go.mod h1:YKe7cfqYXjKGpGvmSg28/fFvhNzinZQm8DGnaburhGA=
|
github.com/googleapis/enterprise-certificate-proxy v0.3.5/go.mod h1:MkHOF77EYAE7qfSuSS9PU6g4Nt4e11cnsDUowfwewLA=
|
||||||
github.com/googleapis/gax-go/v2 v2.13.0 h1:yitjD5f7jQHhyDsnhKEBU52NdvvdSeGzlAnDPT0hH1s=
|
github.com/googleapis/gax-go/v2 v2.14.1 h1:hb0FFeiPaQskmvakKu5EbCbpntQn48jyHuvrkurSS/Q=
|
||||||
github.com/googleapis/gax-go/v2 v2.13.0/go.mod h1:Z/fvTZXF8/uw7Xu5GuslPw+bplx6SS338j1Is2S+B7A=
|
github.com/googleapis/gax-go/v2 v2.14.1/go.mod h1:Hb/NubMaVM88SrNkvl8X/o8XWwDJEPqouaLeN2IUxoA=
|
||||||
|
github.com/gopherjs/gopherjs v0.0.0-20190910122728-9d188e94fb99/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||||
github.com/gorilla/css v1.0.1 h1:ntNaBIghp6JmvWnxbZKANoLyuXTPZ4cAMlo6RyhlbO8=
|
github.com/gorilla/css v1.0.1 h1:ntNaBIghp6JmvWnxbZKANoLyuXTPZ4cAMlo6RyhlbO8=
|
||||||
github.com/gorilla/css v1.0.1/go.mod h1:BvnYkspnSzMmwRK+b8/xgNPLiIuNZr6vbZBTPQ2A3b0=
|
github.com/gorilla/css v1.0.1/go.mod h1:BvnYkspnSzMmwRK+b8/xgNPLiIuNZr6vbZBTPQ2A3b0=
|
||||||
github.com/gorilla/securecookie v1.1.2 h1:YCIWL56dvtr73r6715mJs5ZvhtnY73hBvEF8kXD8ePA=
|
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
||||||
github.com/gorilla/securecookie v1.1.2/go.mod h1:NfCASbcHqRSY+3a8tlWJwsQap2VX5pwzwo4h3eOamfo=
|
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||||
github.com/gorilla/sessions v1.4.0 h1:kpIYOp/oi6MG/p5PgxApU8srsSw9tuFbt46Lt7auzqQ=
|
github.com/ikawaha/kagome.ipadic v1.1.2/go.mod h1:DPSBbU0czaJhAb/5uKQZHMc9MTVRpDugJfX+HddPHHg=
|
||||||
github.com/gorilla/sessions v1.4.0/go.mod h1:FLWm50oby91+hl7p/wRxDth9bWSuk0qVL2emc7lT5ik=
|
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||||
|
github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U=
|
||||||
|
github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ=
|
||||||
|
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
||||||
|
github.com/kljensen/snowball v0.6.0/go.mod h1:27N7E8fVU5H68RlUmnWwZCfxgt4POBJfENGMvNRhldw=
|
||||||
|
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
|
||||||
github.com/microcosm-cc/bluemonday v1.0.27 h1:MpEUotklkwCSLeH+Qdx1VJgNqLlpY2KXwXFM08ygZfk=
|
github.com/microcosm-cc/bluemonday v1.0.27 h1:MpEUotklkwCSLeH+Qdx1VJgNqLlpY2KXwXFM08ygZfk=
|
||||||
github.com/microcosm-cc/bluemonday v1.0.27/go.mod h1:jFi9vgW+H7c3V0lb6nR74Ib/DIB5OBs92Dimizgw2cA=
|
github.com/microcosm-cc/bluemonday v1.0.27/go.mod h1:jFi9vgW+H7c3V0lb6nR74Ib/DIB5OBs92Dimizgw2cA=
|
||||||
|
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||||
|
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||||
|
github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE+eKJXWVjKXM4ck2QobLqTDytGJbLLhJg=
|
||||||
|
github.com/mschoch/smat v0.2.0 h1:8imxQsjDm8yFEAVBe7azKmKSgzSkZXDuKkSq9374khM=
|
||||||
|
github.com/mschoch/smat v0.2.0/go.mod h1:kc9mz7DoBKqDyiRL7VZN8KvXQMWeTaVnttLRXOlotKw=
|
||||||
|
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||||
|
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||||
|
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||||
|
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
||||||
|
github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU=
|
||||||
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo=
|
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo=
|
||||||
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8=
|
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
|
||||||
|
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
|
||||||
|
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
|
||||||
|
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
|
||||||
|
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
||||||
|
github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU=
|
||||||
|
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
|
||||||
|
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||||
|
github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
|
||||||
|
github.com/steveyen/gtreap v0.1.0 h1:CjhzTa274PyJLJuMZwIzCO1PfC00oRa8d1Kc78bFXJM=
|
||||||
|
github.com/steveyen/gtreap v0.1.0/go.mod h1:kl/5J7XbrOmlIbYIXdRHDDE5QxHqpk0cmkT7Z4dM9/Y=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE=
|
||||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ=
|
||||||
|
github.com/tebeka/snowball v0.4.2/go.mod h1:4IfL14h1lvwZcp1sfXuuc7/7yCsvVffTWxWxCLfFpYg=
|
||||||
|
github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok=
|
||||||
|
github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8=
|
||||||
|
github.com/tinylib/msgp v1.1.0/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE=
|
||||||
|
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
|
||||||
|
github.com/willf/bitset v1.1.10/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
|
||||||
|
github.com/willf/bitset v1.1.11 h1:N7Z7E9UvjW+sGsEl7k/SJrvY2reP1A07MrGuCjIOjRE=
|
||||||
|
github.com/willf/bitset v1.1.11/go.mod h1:83CECat5yLh5zVOf4P1ErAgKA5UDvKtgyUABdr3+MjI=
|
||||||
|
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
|
||||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||||
github.com/yuin/goldmark v1.7.8 h1:iERMLn0/QJeHFhxSt3p6PeN9mGnvIKSpG9YYorDMnic=
|
github.com/yuin/goldmark v1.7.8 h1:iERMLn0/QJeHFhxSt3p6PeN9mGnvIKSpG9YYorDMnic=
|
||||||
github.com/yuin/goldmark v1.7.8/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
|
github.com/yuin/goldmark v1.7.8/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
|
||||||
go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0=
|
go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
|
||||||
go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo=
|
go.etcd.io/bbolt v1.4.0 h1:TU77id3TnN/zKr7CO/uk+fBCwF2jGcMuw2B/FMAzYIk=
|
||||||
go.opentelemetry.io/contrib/detectors/gcp v1.31.0 h1:G1JQOreVrfhRkner+l4mrGxmfqYCAuy76asTDAo0xsA=
|
go.etcd.io/bbolt v1.4.0/go.mod h1:AsD+OCi/qPN1giOX1aiLAha3o1U8rAz65bvN4j0sRuk=
|
||||||
go.opentelemetry.io/contrib/detectors/gcp v1.31.0/go.mod h1:tzQL6E1l+iV44YFTkcAeNQqzXUiekSYP9jjJjXwEd00=
|
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
|
||||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.56.0 h1:yMkBS9yViCc7U7yeLzJPM2XizlfdVvBRSmsQDWu6qc0=
|
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
|
||||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.56.0/go.mod h1:n8MR6/liuGB5EmTETUBeU5ZgqMOlqKRxUaqPQBOANZ8=
|
go.opentelemetry.io/contrib/detectors/gcp v1.35.0 h1:bGvFt68+KTiAKFlacHW6AhA56GF2rS0bdD3aJYEnmzA=
|
||||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 h1:UP6IpuHFkUgOQL9FFQFrZ+5LiwhhYRbi7VZSIx6Nj5s=
|
go.opentelemetry.io/contrib/detectors/gcp v1.35.0/go.mod h1:qGWP8/+ILwMRIUf9uIVLloR1uo5ZYAslM4O6OqUi1DA=
|
||||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0/go.mod h1:qxuZLtbq5QDtdeSHsS7bcf6EH6uO6jUAgk764zd3rhM=
|
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.60.0 h1:x7wzEgXfnzJcHDwStJT+mxOz4etr2EcexjqhBvmoakw=
|
||||||
go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY=
|
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.60.0/go.mod h1:rg+RlpR5dKwaS95IyyZqj5Wd4E13lk/msnTS0Xl9lJM=
|
||||||
go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE=
|
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0 h1:sbiXRNDSWJOTobXh5HyQKjq6wUC5tNybqjIqDpAY4CU=
|
||||||
go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE=
|
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0/go.mod h1:69uWxva0WgAA/4bu2Yy70SLDBwZXuQ6PbBpbsa5iZrQ=
|
||||||
go.opentelemetry.io/otel/metric v1.31.0/go.mod h1:C3dEloVbLuYoX41KpmAhOqNriGbA+qqH6PQ5E5mUfnY=
|
go.opentelemetry.io/otel v1.35.0 h1:xKWKPxrxB6OtMCbmMY021CqC45J+3Onta9MqjhnusiQ=
|
||||||
go.opentelemetry.io/otel/sdk v1.31.0 h1:xLY3abVHYZ5HSfOg3l2E5LUj2Cwva5Y7yGxnSW9H5Gk=
|
go.opentelemetry.io/otel v1.35.0/go.mod h1:UEqy8Zp11hpkUrL73gSlELM0DupHoiq72dR+Zqel/+Y=
|
||||||
go.opentelemetry.io/otel/sdk v1.31.0/go.mod h1:TfRbMdhvxIIr/B2N2LQW2S5v9m3gOQ/08KsbbO5BPT0=
|
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.29.0 h1:WDdP9acbMYjbKIyJUhTvtzj601sVJOqgWdUxSdR/Ysc=
|
||||||
go.opentelemetry.io/otel/sdk/metric v1.31.0 h1:i9hxxLJF/9kkvfHppyLL55aW7iIJz4JjxTeYusH7zMc=
|
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.29.0/go.mod h1:BLbf7zbNIONBLPwvFnwNHGj4zge8uTCM/UPIVW1Mq2I=
|
||||||
go.opentelemetry.io/otel/sdk/metric v1.31.0/go.mod h1:CRInTMVvNhUKgSAMbKyTMxqOBC0zgyxzW55lZzX43Y8=
|
go.opentelemetry.io/otel/metric v1.35.0 h1:0znxYu2SNyuMSQT4Y9WDWej0VpcsxkuklLa4/siN90M=
|
||||||
go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys=
|
go.opentelemetry.io/otel/metric v1.35.0/go.mod h1:nKVFgxBZ2fReX6IlyW28MgZojkoAkJGaE8CpgeAU3oE=
|
||||||
go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A=
|
go.opentelemetry.io/otel/sdk v1.35.0 h1:iPctf8iprVySXSKJffSS79eOjl9pvxV9ZqOWT0QejKY=
|
||||||
|
go.opentelemetry.io/otel/sdk v1.35.0/go.mod h1:+ga1bZliga3DxJ3CQGg3updiaAJoNECOgJREo9KHGQg=
|
||||||
|
go.opentelemetry.io/otel/sdk/metric v1.35.0 h1:1RriWBmCKgkeHEhM7a2uMjMUfP7MsOF5JpUCaEqEI9o=
|
||||||
|
go.opentelemetry.io/otel/sdk/metric v1.35.0/go.mod h1:is6XYCUMpcKi+ZsOvfluY5YstFnhW0BidkR+gL+qN+w=
|
||||||
|
go.opentelemetry.io/otel/trace v1.35.0 h1:dPpEfJu1sDIqruz7BHFG3c7528f6ddfSWfFDVt/xgMs=
|
||||||
|
go.opentelemetry.io/otel/trace v1.35.0/go.mod h1:WUk7DtFp1Aw2MkvqGdwiXYDZZNvA/1J8o6xRXLrIkyc=
|
||||||
|
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
|
||||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw=
|
golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34=
|
||||||
golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U=
|
golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc=
|
||||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
|
||||||
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||||
golang.org/x/image v0.21.0 h1:c5qV36ajHpdj4Qi0GnE0jUc/yuo33OLFaa0d+crTD5s=
|
golang.org/x/image v0.25.0 h1:Y6uW6rH1y5y/LK1J8BPWZtr6yZ7hrsy6hFrXjgsc2fQ=
|
||||||
golang.org/x/image v0.21.0/go.mod h1:vUbsLavqK/W303ZroQQVKQ+Af3Yl6Uz1Ppu5J/cLz78=
|
golang.org/x/image v0.25.0/go.mod h1:tCAmOEGthTtkalusGp1g3xa2gke8J6c2N565dTyl9Rs=
|
||||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
|
||||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
|
||||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
|
||||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
|
||||||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
|
||||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
|
||||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
|
||||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
|
||||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||||
golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4=
|
golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c=
|
||||||
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU=
|
golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
|
||||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
golang.org/x/oauth2 v0.28.0 h1:CrgCKl8PPAVtLnU3c+EDw6x11699EWlsDeWNWKdIOkc=
|
||||||
golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs=
|
golang.org/x/oauth2 v0.28.0/go.mod h1:onh5ek6nERTohokkhCD/y2cV4Do3fxFHFuAejCkRWT8=
|
||||||
golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
|
|
||||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
|
golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw=
|
||||||
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20181221143128-b4a75ba826a6/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
|
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
|
||||||
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||||
golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24=
|
golang.org/x/term v0.30.0 h1:PQ39fJZ+mfadBm0y5WlL4vlM7Sx1Hgf13sMIY2+QS9Y=
|
||||||
golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M=
|
golang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||||
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
|
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
|
||||||
golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM=
|
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
|
||||||
golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
|
golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
|
||||||
golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ=
|
golang.org/x/time v0.11.0 h1:/bpjEDfN9tkoN/ryeYHnv5hcMlc8ncjMcM4XBk5NWV0=
|
||||||
golang.org/x/time v0.7.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
|
golang.org/x/time v0.11.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg=
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
|
||||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
|
||||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
|
||||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
|
||||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
google.golang.org/api v0.203.0 h1:SrEeuwU3S11Wlscsn+LA1kb/Y5xT8uggJSkIhD08NAU=
|
google.golang.org/api v0.224.0 h1:Ir4UPtDsNiwIOHdExr3fAj4xZ42QjK7uQte3lORLJwU=
|
||||||
google.golang.org/api v0.203.0/go.mod h1:BuOVyCSYEPwJb3npWvDnNmFI92f3GeRnHNkETneT3SI=
|
google.golang.org/api v0.224.0/go.mod h1:3V39my2xAGkodXy0vEqcEtkqgw2GtrFL5WuBZlCTCOQ=
|
||||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
|
||||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
|
||||||
google.golang.org/appengine/v2 v2.0.6 h1:LvPZLGuchSBslPBp+LAhihBeGSiRh1myRoYK4NtuBIw=
|
google.golang.org/appengine/v2 v2.0.6 h1:LvPZLGuchSBslPBp+LAhihBeGSiRh1myRoYK4NtuBIw=
|
||||||
google.golang.org/appengine/v2 v2.0.6/go.mod h1:WoEXGoXNfa0mLvaH5sV3ZSGXwVmy8yf7Z1JKf3J3wLI=
|
google.golang.org/appengine/v2 v2.0.6/go.mod h1:WoEXGoXNfa0mLvaH5sV3ZSGXwVmy8yf7Z1JKf3J3wLI=
|
||||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
google.golang.org/genproto v0.0.0-20250303144028-a0af3efb3deb h1:ITgPrl429bc6+2ZraNSzMDk3I95nmQln2fuPstKwFDE=
|
||||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
google.golang.org/genproto v0.0.0-20250303144028-a0af3efb3deb/go.mod h1:sAo5UzpjUwgFBCzupwhcLcxHVDK7vG5IqI30YnwX2eE=
|
||||||
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
|
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb h1:p31xT4yrYrSM/G4Sn2+TNUkVhFCbG9y8itM2S6Th950=
|
||||||
google.golang.org/genproto v0.0.0-20241021214115-324edc3d5d38 h1:Q3nlH8iSQSRUwOskjbcSMcF2jiYMNiQYZ0c2KEJLKKU=
|
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb/go.mod h1:jbe3Bkdp+Dh2IrslsFCklNhweNTBgSYanP1UXhJDhKg=
|
||||||
google.golang.org/genproto v0.0.0-20241021214115-324edc3d5d38/go.mod h1:xBI+tzfqGGN2JBeSebfKXFSdBpWVQ7sLW40PTupVRm4=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb h1:TLPQVbx1GJ8VKZxz52VAxl1EBgKXXbTiU9Fc5fZeLn4=
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20241021214115-324edc3d5d38 h1:2oV8dfuIkM1Ti7DwXc0BJfnwr9csz4TDXI9EmiI+Rbw=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb/go.mod h1:LuRYeWDFV6WOn90g357N17oMCaxpgCnbi/44qJvDn2I=
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20241021214115-324edc3d5d38/go.mod h1:vuAjtvlwkDKF6L1GQ0SokiRLCGFfeBUXWr/aFFkHACc=
|
google.golang.org/grpc v1.71.0 h1:kF77BGdPTQ4/JZWMlb9VpJ5pa25aqvVqogsxNHHdeBg=
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38 h1:zciRKQ4kBpFgpfC5QQCVtnnNAcLIqweL7plyZRQHVpI=
|
google.golang.org/grpc v1.71.0/go.mod h1:H0GRtasmQOh9LkFoCPDu3ZrwUtD1YGE+b2vYBYd/8Ec=
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI=
|
|
||||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
|
||||||
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
|
||||||
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
|
|
||||||
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
|
||||||
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
|
|
||||||
google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E=
|
|
||||||
google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA=
|
|
||||||
google.golang.org/grpc/stats/opentelemetry v0.0.0-20241025232817-cb329375b14e h1:SoMI+r+Qsp379U9BlVzrHtqAqYP3NEv9vNhYqUaAWOg=
|
|
||||||
google.golang.org/grpc/stats/opentelemetry v0.0.0-20241025232817-cb329375b14e/go.mod h1:jzYlkSMbKypzuu6xoAEijsNVo9ZeDF1u/zCfFgsx7jg=
|
|
||||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
|
||||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
|
||||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
|
||||||
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
|
||||||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
|
||||||
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
|
||||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
|
||||||
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
|
||||||
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
|
||||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||||
google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||||
google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA=
|
google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM=
|
||||||
google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
|
google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||||
|
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||||
|
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
|
||||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
|
||||||
|
14
init/cpolis.service
Normal file
14
init/cpolis.service
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=cpolis
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/usr/local/bin/cpolis
|
||||||
|
User=cpolis
|
||||||
|
Group=cpolis
|
||||||
|
Restart=always
|
||||||
|
RestartSec=2s
|
||||||
|
Type=simple
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
@ -38,6 +38,7 @@ CREATE TABLE articles (
|
|||||||
clicks INT NOT NULL,
|
clicks INT NOT NULL,
|
||||||
is_in_issue BOOL NOT NULL,
|
is_in_issue BOOL NOT NULL,
|
||||||
auto_generated BOOL NOT NULL,
|
auto_generated BOOL NOT NULL,
|
||||||
|
uuid VARCHAR(36) NOT NULL,
|
||||||
PRIMARY KEY (id),
|
PRIMARY KEY (id),
|
||||||
FOREIGN KEY (creator_id) REFERENCES users (id),
|
FOREIGN KEY (creator_id) REFERENCES users (id),
|
||||||
FOREIGN KEY (issue_id) REFERENCES issues (id)
|
FOREIGN KEY (issue_id) REFERENCES issues (id)
|
33
scripts/create_toc.lua
Normal file
33
scripts/create_toc.lua
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
-- Helper function: remove all image inlines from a list of inlines.
|
||||||
|
local function remove_images(inlines)
|
||||||
|
local result = {}
|
||||||
|
for _, item in ipairs(inlines) do
|
||||||
|
if item.t ~= "Image" then
|
||||||
|
table.insert(result, item)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return result
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Build a bullet list representing the table of contents.
|
||||||
|
local function build_toc(doc)
|
||||||
|
local toc_items = {}
|
||||||
|
for _, block in ipairs(doc.blocks) do
|
||||||
|
if block.t == "Header" then
|
||||||
|
local clean_inlines = remove_images(block.content)
|
||||||
|
local header_text = pandoc.utils.stringify(clean_inlines)
|
||||||
|
if header_text ~= "" then
|
||||||
|
local link = pandoc.Link(clean_inlines, "#" .. block.identifier)
|
||||||
|
table.insert(toc_items, { link })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return pandoc.BulletList(toc_items)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- The Pandoc function runs after the document is fully constructed.
|
||||||
|
function Pandoc(doc)
|
||||||
|
local toc = build_toc(doc)
|
||||||
|
table.insert(doc.blocks, 1, toc) -- Insert the TOC at the very beginning of the document.
|
||||||
|
return doc
|
||||||
|
end
|
58
update.sh
58
update.sh
@ -1,58 +0,0 @@
|
|||||||
#! /bin/sh -
|
|
||||||
|
|
||||||
CPOLIS_REPO_URL="https://git.streifling.com/api/v1/repos/jason/cpolis/releases"
|
|
||||||
EXTRACTION_DIR=$HOME
|
|
||||||
CPOLIS_DIR=$EXTRACTION_DIR/cpolis
|
|
||||||
TAILWINDCSS_REPO_URL=https://api.github.com/repos/tailwindlabs/tailwindcss/releases/latest
|
|
||||||
TMP_DIR=/tmp
|
|
||||||
BIN_DIR=/usr/local/bin
|
|
||||||
SYSTEMD_DIR=/etc/systemd/system
|
|
||||||
|
|
||||||
check_dependency() {
|
|
||||||
if ! which $1 >/dev/null 2>&1; then
|
|
||||||
echo "$1 needs to be installed" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
if ! groups | grep -E 'root|wheel|sudo' >/dev/null; then
|
|
||||||
echo "You need administrative privileges for this script" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
check_dependency curl
|
|
||||||
check_dependency go
|
|
||||||
check_dependency jq
|
|
||||||
check_dependency tar
|
|
||||||
check_dependency xargs
|
|
||||||
|
|
||||||
echo '\nDownloading cpolis...' >&2
|
|
||||||
rm -fr $CPOLIS_DIR/*
|
|
||||||
latest_release=$(curl -s $CPOLIS_REPO_URL | jq -r '.[0].tag_name')
|
|
||||||
curl -Lo $TMP_DIR/cpolis.tar.gz https://git.streifling.com/jason/cpolis/archive/$latest_release.tar.gz
|
|
||||||
tar -xzf $TMP_DIR/cpolis.tar.gz -C $EXTRACTION_DIR
|
|
||||||
rm $TMP_DIR/cpolis.tar.gz
|
|
||||||
|
|
||||||
echo '\nDownloading TailwindCSS...' >&2
|
|
||||||
curl -s $TAILWINDCSS_REPO_URL |
|
|
||||||
grep -F browser_download_url |
|
|
||||||
grep -F linux-x64 |
|
|
||||||
cut -d'"' -f4 |
|
|
||||||
xargs -r curl -Lo $CPOLIS_DIR/tailwindcss
|
|
||||||
chmod +x $CPOLIS_DIR/tailwindcss
|
|
||||||
$CPOLIS_DIR/tailwindcss -i $CPOLIS_DIR/web/static/css/input.css -o $CPOLIS_DIR/web/static/css/style.css
|
|
||||||
|
|
||||||
echo '\nBuilding cpolis...' >&2
|
|
||||||
cd $CPOLIS_DIR
|
|
||||||
go build -o $BIN_DIR/cpolis cmd/main.go
|
|
||||||
cd
|
|
||||||
|
|
||||||
echo '\nSetting up system files...' >&2
|
|
||||||
sudo chown root:root $BIN_DIR/cpolis
|
|
||||||
chmod +x $BIN_DIR/cpolis
|
|
||||||
|
|
||||||
echo '\nSetting up service...' >&2
|
|
||||||
sudo mv $CPOLIS_DIR/cpolis.service $SYSTEMD_DIR
|
|
||||||
sudo chown root:root $SYSTEMD_DIR/cpolis.service
|
|
||||||
sudo systemctl daemon-reload
|
|
||||||
sudo systemctl is-active --quiet cpolis.service && sudo systemctl restart cpolis.service
|
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
<div class="flex flex-col gap-1">
|
<div class="flex flex-col gap-1">
|
||||||
<h3>Artikel</h3>
|
<h3>Artikel</h3>
|
||||||
<textarea id="easyMDE">{{.Content}}</textarea>
|
<div id="editor"></div>
|
||||||
<input id="article-content" name="article-content" type="hidden" value="{{.Content}}" />
|
<input id="article-content" name="article-content" type="hidden" value="{{.Content}}" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -75,9 +75,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<input id="creator" name="creator" type="checkbox" value="contributor" {{if eq .Creator.ArticleRole
|
<input id="creator" name="creator" type="checkbox" value="author" {{if eq .Creator.ArticleRole
|
||||||
2}}checked{{end}} />
|
1}}checked{{end}} />
|
||||||
<label for="creator">Ich bin nicht der Autor.</label>
|
<label for="creator">Ich bin Autor.</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="btn-area">
|
<div class="btn-area">
|
||||||
@ -88,34 +88,37 @@
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var easyMDE = new EasyMDE({
|
var editor = new toastui.Editor({
|
||||||
element: document.getElementById('easyMDE'),
|
el: document.querySelector('#editor'),
|
||||||
hideIcons: ['image'],
|
height: '500px',
|
||||||
imageTexts: {sbInit: ''},
|
hooks: {
|
||||||
showIcons: ["code", "table", "upload-image"],
|
addImageBlobHook: (blob, callback) => {
|
||||||
uploadImage: true,
|
const formData = new FormData();
|
||||||
|
formData.append('article-image', blob);
|
||||||
|
|
||||||
imageUploadFunction: function (file, onSuccess, onError) {
|
fetch('/article/upload-image', {
|
||||||
var formData = new FormData();
|
method: 'POST',
|
||||||
formData.append('article-image', file);
|
body: formData
|
||||||
|
|
||||||
fetch('/article/upload-image', {
|
|
||||||
method: 'POST',
|
|
||||||
body: formData
|
|
||||||
})
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => {
|
|
||||||
onSuccess(data);
|
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.then(response => response.json())
|
||||||
htmx.trigger(htmx.find('#notification'), 'htmx:responseError', {xhr: {responseText: error.message}});
|
.then(data => {
|
||||||
onError(error);
|
callback(data, 'Alternativtext');
|
||||||
});
|
})
|
||||||
|
.catch(error => {
|
||||||
|
htmx.trigger(htmx.find('#notification'), 'htmx:responseError', {xhr: {responseText: error.message}});
|
||||||
|
console.error('Upload fehlgeschlagen:', error);
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
initialEditType: 'wysiwyg',
|
||||||
|
initialValue: '{{.Content}}',
|
||||||
|
language: 'de',
|
||||||
|
theme: localStorage.theme,
|
||||||
|
usageStatistics: 'false'
|
||||||
});
|
});
|
||||||
|
|
||||||
easyMDE.codemirror.on("change", () => {
|
editor.on('change', () => {
|
||||||
document.getElementById('article-content').value = easyMDE.value();
|
document.getElementById('article-content').value = editor.getMarkdown();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
@ -7,6 +7,11 @@
|
|||||||
<h2>Artikel</h2>
|
<h2>Artikel</h2>
|
||||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-x-4 gap-y-2">
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-x-4 gap-y-2">
|
||||||
<button class="btn" hx-get="/article/write" hx-target="#page-content">Artikel schreiben</button>
|
<button class="btn" hx-get="/article/write" hx-target="#page-content">Artikel schreiben</button>
|
||||||
|
<form class="flex" hx-encoding="multipart/form-data">
|
||||||
|
<label class="btn text-center" for="docx-upload">Word-Dokument hochladen</label>
|
||||||
|
<input accept=".docx" class="hidden" id="docx-upload" name="docx-upload" type="file"
|
||||||
|
hx-post="/docx/upload" />
|
||||||
|
</form>
|
||||||
<button class="btn" hx-get="/article/all-rejected" hx-target="#page-content">Artikel bearbeiten</button>
|
<button class="btn" hx-get="/article/all-rejected" hx-target="#page-content">Artikel bearbeiten</button>
|
||||||
{{if lt .Role 3}}<button class="btn" hx-get="/article/all-unpublished-unrejected-and-published-rejected"
|
{{if lt .Role 3}}<button class="btn" hx-get="/article/all-unpublished-unrejected-and-published-rejected"
|
||||||
hx-target="#page-content">Artikel veröffentlichen</button>{{end}}
|
hx-target="#page-content">Artikel veröffentlichen</button>{{end}}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<title>Orient Editor</title>
|
<title>Orient Editor</title>
|
||||||
|
|
||||||
<link href="/web/static/css/style.css" rel="stylesheet">
|
<link href="/web/static/css/style.css" rel="stylesheet">
|
||||||
<link rel="stylesheet" href="https://unpkg.com/easymde/dist/easymde.min.css">
|
<link rel="stylesheet" href="https://uicdn.toast.com/editor/latest/toastui-editor.min.css" />
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body
|
<body
|
||||||
@ -29,7 +29,8 @@
|
|||||||
|
|
||||||
<main class="mx-4">
|
<main class="mx-4">
|
||||||
<div class="hidden bg-slate-950 dark:bg-slate-50 fixed font-bold p-4 right-8 rounded-lg shadow-lg text-slate-100 dark:text-slate-900 top-8 z-50"
|
<div class="hidden bg-slate-950 dark:bg-slate-50 fixed font-bold p-4 right-8 rounded-lg shadow-lg text-slate-100 dark:text-slate-900 top-8 z-50"
|
||||||
id="notification">
|
id="notification" hx-swap="innerHTML">
|
||||||
|
<span id="notification-content"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="page-content">
|
<div id="page-content">
|
||||||
@ -38,12 +39,14 @@
|
|||||||
</main>
|
</main>
|
||||||
|
|
||||||
<footer class="text-center text-gray-500 my-8">
|
<footer class="text-center text-gray-500 my-8">
|
||||||
<p>© 2024 Jason Streifling. Alle Rechte vorbehalten.</p>
|
<p>© 2025 Jason Streifling. Alle Rechte vorbehalten.</p>
|
||||||
<p>{{.Version}} - <strong>Alpha: Drastische Änderungen und Fehler vorbehalten.</strong></p>
|
<p>{{.Version}} - <strong>Alpha: Drastische Änderungen und Fehler vorbehalten.</strong></p>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script src="https://unpkg.com/htmx.org@2.0.3"></script>
|
<script src="https://unpkg.com/htmx.org@2.0.4"></script>
|
||||||
<script src="https://unpkg.com/easymde/dist/easymde.min.js"></script>
|
<script src="https://uicdn.toast.com/editor/latest/toastui-editor-all.min.js"></script>
|
||||||
|
<script src="https://uicdn.toast.com/editor/latest/i18n/de-de.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
const toggleSwitch = document.getElementById('theme-toggle');
|
const toggleSwitch = document.getElementById('theme-toggle');
|
||||||
@ -70,13 +73,28 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
htmx.on('htmx:afterSwap', function (event) {
|
||||||
|
var notificationContent = document.getElementById('notification-content');
|
||||||
|
if (notificationContent.textContent.trim() !== "") {
|
||||||
|
var notification = document.getElementById('notification');
|
||||||
|
notification.classList.remove('hidden');
|
||||||
|
setTimeout(function () {
|
||||||
|
notification.classList.add('hidden');
|
||||||
|
notificationContent.textContent = "";
|
||||||
|
}, 5000);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
htmx.on('htmx:responseError', function (event) {
|
htmx.on('htmx:responseError', function (event) {
|
||||||
|
var notificationContent = document.getElementById('notification-content');
|
||||||
var notification = document.getElementById('notification');
|
var notification = document.getElementById('notification');
|
||||||
notification.innerText = event.detail.xhr.responseText;
|
notificationContent.textContent = event.detail.xhr.responseText;
|
||||||
notification.classList.remove('hidden');
|
notification.classList.remove('hidden');
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
notification.classList.add('hidden');
|
notification.classList.add('hidden');
|
||||||
|
notificationContent.textContent = "";
|
||||||
}, 5000);
|
}, 5000);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
Reference in New Issue
Block a user