Compare commits

..

No commits in common. "783d59805b1a37cf7fa4cd0a2af158dc16bb2560" and "822ca2b8ab640317bbc9c5ea80a4846e0f4b48fe" have entirely different histories.

14 changed files with 49 additions and 71 deletions

View File

@ -3,52 +3,42 @@ testdata_dir = "testdata"
tmp_dir = "tmp" tmp_dir = "tmp"
[build] [build]
args_bin = [ args_bin = []
"-desc 'Freiheit, Gleichheit, Brüderlichkeit, Toleranz und Humanität'", bin = "./tmp/main -domain localhost:8080 -key tmp/key.gob -log tmp/cpolis.log -pics tmp/pics -rss tmp/orientexpress_alle.rss -web web"
"-domain localhost:8080", cmd = "go build -o ./tmp/main ./cmd/main.go"
"-key tmp/key.gob", delay = 0
"-link https://distrikt-ni-st.de", exclude_dir = ["assets", "tmp", "vendor", "testdata"]
"-log tmp/cpolis.log", exclude_file = []
"-pics tmp/pics", exclude_regex = ["_test.go"]
"-rss tmp/orientexpress_alle.rss", exclude_unchanged = false
"-title 'Freimaurer Distrikt Niedersachsen und Sachsen-Anhalt'", follow_symlink = false
"-web web" full_bin = ""
] include_dir = []
bin = "./tmp/main" include_ext = ["go", "tpl", "tmpl", "html", "css"]
cmd = "go build -o ./tmp/main ./cmd/main.go" include_file = []
delay = 0 kill_delay = "0s"
exclude_dir = ["assets", "tmp", "vendor", "testdata"] log = "build-errors.log"
exclude_file = [] poll = false
exclude_regex = ["_test.go"] poll_interval = 0
exclude_unchanged = false rerun = false
follow_symlink = false rerun_delay = 500
full_bin = "" send_interrupt = false
include_dir = [] stop_on_error = false
include_ext = ["go", "tpl", "tmpl", "html", "css"]
include_file = []
kill_delay = "0s"
log = "build-errors.log"
poll = false
poll_interval = 0
rerun = false
rerun_delay = 500
send_interrupt = false
stop_on_error = false
[color] [color]
app = "" app = ""
build = "yellow" build = "yellow"
main = "magenta" main = "magenta"
runner = "green" runner = "green"
watcher = "cyan" watcher = "cyan"
[log] [log]
main_only = false main_only = false
time = false time = false
[misc] [misc]
clean_on_exit = false clean_on_exit = false
[screen] [screen]
clear_on_rebuild = false clear_on_rebuild = false
keep_scroll = true keep_scroll = true

View File

@ -7,17 +7,14 @@ import (
) )
type CliArgs struct { type CliArgs struct {
Description string DBName string
DBName string Domain string
Domain string KeyFile string
KeyFile string LogFile string
Link string Port string
LogFile string PicsDir string
Port string RSSFile string
PicsDir string WebDir string
RSSFile string
Title string
WebDir string
} }
func HandleCliArgs() (*CliArgs, error) { func HandleCliArgs() (*CliArgs, error) {
@ -25,15 +22,12 @@ func HandleCliArgs() (*CliArgs, error) {
cliArgs := new(CliArgs) cliArgs := new(CliArgs)
flag.StringVar(&cliArgs.DBName, "db", "cpolis", "DB name") flag.StringVar(&cliArgs.DBName, "db", "cpolis", "DB name")
flag.StringVar(&cliArgs.Description, "desc", "Description", "Channel description")
flag.StringVar(&cliArgs.Domain, "domain", "", "domain name") flag.StringVar(&cliArgs.Domain, "domain", "", "domain name")
keyFile := flag.String("key", "/var/www/cpolis/cpolis.key", "key file") keyFile := flag.String("key", "/var/www/cpolis/cpolis.key", "key file")
flag.StringVar(&cliArgs.Link, "link", "Link", "Channel Link")
logFile := flag.String("log", "/var/log/cpolis.log", "log file") logFile := flag.String("log", "/var/log/cpolis.log", "log file")
flag.StringVar(&cliArgs.PicsDir, "pics", "pics", "pictures directory") flag.StringVar(&cliArgs.PicsDir, "pics", "pics", "pictures directory")
port := flag.Int("port", 8080, "port") port := flag.Int("port", 8080, "port")
rssFile := flag.String("rss", "/var/www/cpolis/cpolis.rss", "RSS file") rssFile := flag.String("rss", "/var/www/cpolis/cpolis.rss", "RSS file")
flag.StringVar(&cliArgs.Title, "title", "Title", "Channel title")
webDir := flag.String("web", "/var/www/cpolis/web", "web directory") webDir := flag.String("web", "/var/www/cpolis/web", "web directory")
flag.Parse() flag.Parse()

View File

@ -97,7 +97,7 @@ func GenerateRSS(db *model.DB, title, link, desc string) (*string, error) {
channel.Items = append(channel.Items, &rss.Item{ channel.Items = append(channel.Items, &rss.Item{
Title: articleTitle, Title: articleTitle,
Author: user.FirstName + " " + user.LastName, Author: user.FirstName + user.LastName,
PubDate: article.Created.Format(time.RFC1123Z), PubDate: article.Created.Format(time.RFC1123Z),
Description: articleDescription, Description: articleDescription,
Content: &rss.Content{Value: articleContent}, Content: &rss.Content{Value: articleContent},

View File

@ -338,7 +338,12 @@ func PublishArticle(c *control.CliArgs, db *model.DB, s *control.CookieStore) ht
return return
} }
feed, err := control.GenerateRSS(db, c.Title, c.Link, c.Description) feed, err := control.GenerateRSS(
db,
"Freimaurer Distrikt Niedersachsen und Sachsen-Anhalt",
"https://distrikt-ni-st.de",
"Freiheit, Gleichheit, Brüderlichkeit, Toleranz und Humanität",
)
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)

View File

@ -1,6 +1,5 @@
{{define "page-content"}} {{define "page-content"}}
<h2>Neuer Benutzer</h2> <h2>Neuer Benutzer</h2>
<form> <form>
<div class="grid grid-cols-3 gap-4"> <div class="grid grid-cols-3 gap-4">
<div> <div>

View File

@ -1,6 +1,4 @@
{{define "page-content"}} {{define "page-content"}}
<h2>Aktuelle Artikel</h2>
<div class="flex flex-col gap-4"> <div class="flex flex-col gap-4">
{{range .}} {{range .}}
<div class="border px-2 py-1 rounded-md"> <div class="border px-2 py-1 rounded-md">

View File

@ -1,6 +1,4 @@
{{define "page-content"}} {{define "page-content"}}
<h2>Benutzerdaten bearbeiten</h2>
<form> <form>
<div class="grid grid-cols-3 gap-4"> <div class="grid grid-cols-3 gap-4">
<div> <div>

View File

@ -1,6 +1,5 @@
{{define "page-content"}} {{define "page-content"}}
<h2>Editor</h2> <h2>Editor</h2>
<form> <form>
<div class="flex flex-col gap-y-1"> <div class="flex flex-col gap-y-1">
<label for="article-title">Titel</label> <label for="article-title">Titel</label>

3
web/templates/feed.rss Normal file
View File

@ -0,0 +1,3 @@
{{define "page-content"}}
{{.}}
{{end}}

View File

@ -1,6 +1,5 @@
{{define "page-content"}} {{define "page-content"}}
<h2>Anmeldung</h2> <h2>Anmeldung</h2>
<form> <form>
<div class="btn-area"> <div class="btn-area">
<input class="w-full" name="username" placeholder="Benutzername" type="text" /> <input class="w-full" name="username" placeholder="Benutzername" type="text" />

View File

@ -1,6 +1,4 @@
{{define "page-content"}} {{define "page-content"}}
<h2>Abgelehnte Artikel</h2>
<div class="flex flex-col gap-4"> <div class="flex flex-col gap-4">
{{range .RejectedArticles}} {{range .RejectedArticles}}
{{if index $.MyIDs .ID}} {{if index $.MyIDs .ID}}

View File

@ -1,6 +1,5 @@
{{define "page-content"}} {{define "page-content"}}
<h2>Editor</h2> <h2>Editor</h2>
<form> <form>
<div class="flex flex-col gap-y-1"> <div class="flex flex-col gap-y-1">
<label for="article-title">Titel</label> <label for="article-title">Titel</label>

View File

@ -1,6 +1,4 @@
{{define "page-content"}} {{define "page-content"}}
<h2>Artikel veröffentlichen</h2>
<div> <div>
<span>Titel</span> <span>Titel</span>
<div class="bg-white border mb-3 px-2 py-2 rounded-md w-full"> <div class="bg-white border mb-3 px-2 py-2 rounded-md w-full">

View File

@ -1,6 +1,4 @@
{{define "page-content"}} {{define "page-content"}}
<h2>Unveröffentlichte Artikel</h2>
<div class="flex flex-col gap-4"> <div class="flex flex-col gap-4">
{{range .}} {{range .}}
<button class="btn" hx-get="/review-unpublished-article/{{.ID}}" hx-target="#page-content"> <button class="btn" hx-get="/review-unpublished-article/{{.ID}}" hx-target="#page-content">