diff options
author | FChannel <=> | 2021-01-28 00:27:36 -0800 |
---|---|---|
committer | FChannel <=> | 2021-01-28 00:27:36 -0800 |
commit | faee9db270a22a42e45210529c7998dcede0087b (patch) | |
tree | 4b3c90b197f8a784e8ce3c57e6e57d4b423e83e8 | |
parent | c171ea82b48f9b2f5c9b8132755e4fb8545290d9 (diff) |
added red board layout
-rw-r--r-- | Database.go | 4 | ||||
-rw-r--r-- | activityPubStruct.go | 2 | ||||
-rw-r--r-- | client.go | 7 | ||||
-rw-r--r-- | main.go | 1 | ||||
-rw-r--r-- | static/js/posts.js | 6 | ||||
-rw-r--r-- | static/main.html | 42 | ||||
-rw-r--r-- | static/posts.html | 2 |
7 files changed, 54 insertions, 10 deletions
diff --git a/Database.go b/Database.go index f433cbe..aac87c7 100644 --- a/Database.go +++ b/Database.go @@ -50,9 +50,9 @@ func GetActorByNameFromDB(db *sql.DB, name string) Actor { func CreateNewBoardDB(db *sql.DB, actor Actor) Actor{ - query := `insert into actor (type, id, name, preferedusername, inbox, outbox, following, followers, summary) values ($1, $2, $3, $4, $5, $6, $7, $8, $9)` + query := `insert into actor (type, id, name, preferedusername, inbox, outbox, following, followers, summary, restricted) values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)` - _, err := db.Exec(query, actor.Type, actor.Id, actor.Name, actor.PreferredUsername, actor.Inbox, actor.Outbox, actor.Following, actor.Followers, actor.Summary) + _, err := db.Exec(query, actor.Type, actor.Id, actor.Name, actor.PreferredUsername, actor.Inbox, actor.Outbox, actor.Following, actor.Followers, actor.Summary, actor.Restricted) if err != nil { fmt.Println("board exists") diff --git a/activityPubStruct.go b/activityPubStruct.go index ff6f237..12c9dd1 100644 --- a/activityPubStruct.go +++ b/activityPubStruct.go @@ -76,7 +76,7 @@ type Actor struct { PreferredUsername string `json:"prefereedUsername,omitempty"` Summary string `json:"summary,omitempty"` AuthRequirement []string `json:"authrequirement,omitempty"` - Restricted bool `json:"restricted,omitempty"` + Restricted bool `json:"restricted"` } type Activity struct { @@ -32,6 +32,7 @@ type Board struct{ ModCred string Domain string TP string + Restricted bool } type PageData struct { @@ -84,6 +85,7 @@ func IndexGet(w http.ResponseWriter, r *http.Request, db *sql.DB) { board.PrefName = boardActor.PreferredUsername board.Location = "/" + boardActor.Name boardCollection = append(boardCollection, board) + board.Restricted = boardActor.Restricted } var data PageData @@ -118,6 +120,7 @@ func OutboxGet(w http.ResponseWriter, r *http.Request, db *sql.DB, collection Co returnData.Board.Actor = actor.Id returnData.Board.ModCred, _ = GetPasswordFromSession(r) returnData.Board.Domain = Domain + returnData.Board.Restricted = actor.Restricted returnData.CurrentPage = page returnData.Board.Captcha = GetCaptcha(*actor) @@ -239,6 +242,7 @@ func CatalogGet(w http.ResponseWriter, r *http.Request, db *sql.DB, collection C returnData.Board.Summary = actor.Summary returnData.Board.ModCred, _ = GetPasswordFromSession(r) returnData.Board.Domain = Domain + returnData.Board.Restricted = actor.Restricted returnData.Key = *Key returnData.Board.Captcha = GetCaptcha(*actor) @@ -272,7 +276,8 @@ func PostGet(w http.ResponseWriter, r *http.Request, db *sql.DB){ returnData.Board.Actor = actor.Id returnData.Board.Summary = actor.Summary returnData.Board.ModCred, _ = GetPasswordFromSession(r) - returnData.Board.Domain = Domain + returnData.Board.Domain = Domain + returnData.Board.Restricted = actor.Restricted if GetDomainURL(actor) != "" { @@ -147,7 +147,6 @@ func main() { if method == "GET" { GetActorOutbox(w, r, db) } else if method == "POST" { - fmt.Println("parsing outbox req") ParseOutboxRequest(w, r, db) } else { w.WriteHeader(http.StatusForbidden) diff --git a/static/js/posts.js b/static/js/posts.js index e9feefe..a6963de 100644 --- a/static/js/posts.js +++ b/static/js/posts.js @@ -125,7 +125,7 @@ function convertContent(actorName, content, opid) isOP = " (OP)"; } - newContent = newContent.replace(quote, '<a title="' + link + '" href="'+ (actorName) + "/" + shortURL(actorName, opid) + '#' + shortURL(actorName, link) + '"style="color:#af0a0f;">>>' + shortURL(actorName, link) + isOP + '</a>'); + newContent = newContent.replace(quote, '<a class="reply" title="' + link + '" href="'+ (actorName) + "/" + shortURL(actorName, opid) + '#' + shortURL(actorName, link) + '";">>>' + shortURL(actorName, link) + isOP + '</a>'); }) } @@ -136,7 +136,7 @@ function convertContent(actorName, content, opid) if(match) { match.forEach(function(quote, i) { - newContent = newContent.replace(quote, '<span style="color: green;">' + quote + '</span>'); + newContent = newContent.replace(quote, '<span class="quote">' + quote + '</span>'); }) } @@ -176,7 +176,7 @@ function quote(actorName, opid, id) var w = window.innerWidth / 2 - 200; var h = document.getElementById(id + "-content").offsetTop - 448; - box.setAttribute("style", "display: block; position: absolute; background-color: #eff5ff; width: 400px; height: 550px; z-index: 9; top: " + h + "px; left: " + w + "px; padding: 5px; border: 4px solid #d3caf0;"); + box.setAttribute("style", "display: block; position: absolute; width: 400px; height: 550px; z-index: 9; top: " + h + "px; left: " + w + "px; padding: 5px;"); if (inReplyTo.value != opid) diff --git a/static/main.html b/static/main.html index f4007d1..180e91f 100644 --- a/static/main.html +++ b/static/main.html @@ -16,10 +16,50 @@ a:hover { color: #de0808; } + + body { + {{ if .Board.Restricted }} + background-color: #eef2fe; + color: black; + {{ else }} + background-color: #ffffee; + color: #820404 + {{ end }} + } + + #reply-box { + {{ if .Board.Restricted }} + border: 4px solid #d3caf0; + background-color: #eff5ff; + {{ else }} + border: 4px solid #f0e2d9; + background-color: #f9f9e0; + {{ end }} + } + + .quote { + color: #789922; + } + + .reply { + {{ if .Board.Restricted }} + color:#af0a0f; + {{ else }} + color:#000080; + {{ end }} + } + + .post { + {{ if .Board.Restricted }} + background-color: #d5daf0; + {{ else }} + background-color: #f0e0d6; + {{ end }} + } </style> {{ template "header" . }} </head> - <body style="background-color: #eef2fe;"> + <body> <ul style="display: inline; padding:0;"> {{range .Boards}} <li style="display: inline;"><a href="{{.Location}}">{{.Name}}</a></li> diff --git a/static/posts.html b/static/posts.html index ebe8f4e..ab15aeb 100644 --- a/static/posts.html +++ b/static/posts.html @@ -71,7 +71,7 @@ <div id="{{ .Id }}"> <div style="display: inline-block; overflow: auto;"> <div style="float: left; display: block; margin-right: 5px;">>></div> - <div style="overflow: auto;background-color: #d5daf0; padding: 5px; margin-bottom: 2px;"> + <div class="post" style="overflow: auto; padding: 5px; margin-bottom: 2px;"> {{ if eq $board.ModCred $board.Domain $board.Actor }} <a href="/delete?id={{ .Id }}">[Delete Post]</a> {{ end }} |