From b02f813e519dc890f2eb4827ff52cff3ff90c828 Mon Sep 17 00:00:00 2001 From: FChannel <> Date: Sun, 19 Jun 2022 12:47:32 -0700 Subject: v0.1.0 --- post/util.go | 10 +- route/routes/api.go | 2 +- static/anews.html | 40 ----- static/archive.html | 90 ----------- static/bottom.html | 50 ------ static/clover.png | Bin 92559 -> 0 bytes static/css/themes/default.css | 249 ------------------------------ static/css/themes/gruvbox.css | 235 ----------------------------- static/faq.html | 66 -------- static/favicon.png | Bin 12901 -> 0 bytes static/index.html | 78 ---------- static/js/footerscript.js | 44 ------ static/js/posts.js | 344 ------------------------------------------ static/js/themes.js | 40 ----- static/js/timer.js | 38 ----- static/locked.png | Bin 717 -> 0 bytes static/main.html | 67 -------- static/nadmin.html | 89 ----------- static/ncatalog.html | 114 -------------- static/news.html | 34 ----- static/notfound.png | Bin 96599 -> 0 bytes static/npost.html | 66 -------- static/nposts.html | 65 -------- static/onion.png | Bin 107039 -> 0 bytes static/pin.png | Bin 6118 -> 0 bytes static/posts.html | 122 --------------- static/rules.html | 12 -- static/sensitive.png | Bin 3737 -> 0 bytes static/top.html | 130 ---------------- views/faq.html | 3 - views/npost.html | 2 + views/partials/footer.html | 3 +- views/partials/top.html | 6 +- 33 files changed, 12 insertions(+), 1987 deletions(-) delete mode 100644 static/anews.html delete mode 100644 static/archive.html delete mode 100644 static/bottom.html delete mode 100644 static/clover.png delete mode 100644 static/css/themes/default.css delete mode 100644 static/css/themes/gruvbox.css delete mode 100644 static/faq.html delete mode 100644 static/favicon.png delete mode 100644 static/index.html delete mode 100644 static/js/footerscript.js delete mode 100644 static/js/posts.js delete mode 100644 static/js/themes.js delete mode 100644 static/js/timer.js delete mode 100644 static/locked.png delete mode 100644 static/main.html delete mode 100644 static/nadmin.html delete mode 100644 static/ncatalog.html delete mode 100644 static/news.html delete mode 100644 static/notfound.png delete mode 100644 static/npost.html delete mode 100644 static/nposts.html delete mode 100644 static/onion.png delete mode 100644 static/pin.png delete mode 100644 static/posts.html delete mode 100644 static/rules.html delete mode 100644 static/sensitive.png delete mode 100644 static/top.html diff --git a/post/util.go b/post/util.go index bc2580b..922dd11 100644 --- a/post/util.go +++ b/post/util.go @@ -472,15 +472,17 @@ func ParseAttachment(obj activitypub.ObjectBase, catalog bool) template.HTML { func ParseContent(board activitypub.Actor, op string, content string, thread activitypub.ObjectBase, id string, _type string) (template.HTML, error) { // TODO: should escape more than just < and >, should also escape &, ", and ' nContent := strings.ReplaceAll(content, `<`, "<") + + if _type == "new" { + nContent = ParseTruncate(nContent, board, op, id) + } + nContent, err := ParseLinkComments(board, op, nContent, thread) if err != nil { return "", util.MakeError(err, "ParseContent") } - if _type == "new" { - nContent = ParseTruncate(nContent, board, op, id) - } nContent = ParseCommentQuotes(nContent) nContent = strings.ReplaceAll(nContent, `/\<`, ">") @@ -497,7 +499,7 @@ func ParseTruncate(content string, board activitypub.Actor, op string, id string content += lines[i] } - content += fmt.Sprintf("(view full post...)", board.Id+"/"+util.ShortURL(board.Outbox, op)+"#"+util.ShortURL(board.Outbox+"/outbox", id)) + content += fmt.Sprintf("(view full post...)", board.Id+"/"+util.ShortURL(board.Outbox, op)+"#"+util.ShortURL(board.Outbox, id)) } return content diff --git a/route/routes/api.go b/route/routes/api.go index 70607e9..23b2213 100644 --- a/route/routes/api.go +++ b/route/routes/api.go @@ -35,7 +35,7 @@ func RouteImages(ctx *fiber.Ctx, media string) error { defer resp.Body.Close() if resp.StatusCode != 200 { - fileBytes, err := ioutil.ReadFile("./static/notfound.png") + fileBytes, err := ioutil.ReadFile("./views/notfound.png") if err != nil { return util.MakeError(err, "RouteImages") } diff --git a/static/anews.html b/static/anews.html deleted file mode 100644 index 355f310..0000000 --- a/static/anews.html +++ /dev/null @@ -1,40 +0,0 @@ -{{ define "header" }} -{{ .Title }} - - - - - - - - - - - - - - -{{ end }} - -{{ define "top" }}{{ end }} -{{ define "content" }} -
-

{{ .Title }}

- -
- {{ range $i, $e := .NewsItems }} -
-

{{unixtoreadable $e.Time}} - {{$e.Title}}{{ if $.Board.ModCred }} [Delete] {{end}}

-
- -

{{$e.Content}}

-
- {{ end }} -
- -
-{{ end }} -{{ define "bottom" }}{{ end }} - -{{ define "script" }} -{{ end }} diff --git a/static/archive.html b/static/archive.html deleted file mode 100644 index 8420b97..0000000 --- a/static/archive.html +++ /dev/null @@ -1,90 +0,0 @@ -{{ define "header" }} -/{{ .Board.Name }}/ - Archive - - - - - - - - - - - -{{ if (index .Posts 0).Preview }} - - -{{ end }} - - -{{ end }} - -{{ define "top" }} -

/{{ .Board.Name }}/ - {{ .Board.PrefName }}

-

{{ .Board.Summary }}

-

Archived Posts

-{{ end }} - -{{ define "content" }} -{{ $board := .Board }} - -
- -
- - - - {{ if eq $board.ModCred $board.Domain $board.Actor.Id }} - - {{ end }} - - - - - {{ range $i, $e := .Posts }} - {{ if mod $i 2 }} - - {{ if eq $board.ModCred $board.Domain $board.Actor.Id }} - - {{ end }} - - - - - {{ else }} - - {{ if eq $board.ModCred $board.Domain $board.Actor.Id }} - - {{ end }} - - - - - {{ end }} - {{ end }} -
No.Excerpt
[Pop]{{ short $board.Actor.Outbox $e.Id }}{{ shortExcerpt $e }}[View]
[Pop]{{ short $board.Actor.Outbox $e.Id }}{{ shortExcerpt $e }}[View]
- -
- - - -
- -{{ end }} - -{{ define "script" }} - - -{{ end }} diff --git a/static/bottom.html b/static/bottom.html deleted file mode 100644 index d48db20..0000000 --- a/static/bottom.html +++ /dev/null @@ -1,50 +0,0 @@ -{{ define "bottom" }} - - - -{{ end }} diff --git a/static/clover.png b/static/clover.png deleted file mode 100644 index 305748e..0000000 Binary files a/static/clover.png and /dev/null differ diff --git a/static/css/themes/default.css b/static/css/themes/default.css deleted file mode 100644 index 98edc29..0000000 --- a/static/css/themes/default.css +++ /dev/null @@ -1,249 +0,0 @@ -a, a:link, a:visited, a:hover, a:active { - text-decoration: none -} - -a:link, a:visited, a:active { - color: black; -} - -a:hover { - color: #de0808; -} - -body { - background-color: #eef2fe; - color: black; -} - -body.nsfw { - background-color: #ffffee; - color: #820404 -} - -h1, h2, h3, h4, h5, h6 { - color: #af0a0f; -} - -.popup-box { - border: 4px solid #d3caf0; - background-color: #eff5ff; -} - -.nsfw .popup-box { - border: 4px solid #f0e2d9; - background-color: #f9f9e0; -} - -.box { - background-color: #eff5ff; -} - -.nsfw .box { - background-color: #f9f9e0; -} - -.box-alt { - background-color: #d3caf0; -} - -.nsfw .box-alt { - background-color: #f0e2d9; -} - - -.quote { - color: #789922; -} - -.post { - background-color: #d5daf0; -} - -.nsfw .post { - background-color: #f0e0d6; -} - -:target > div > .post { - background-color: #d6bad0; -} - -.nsfw :target > div > .post { - background-color: #f0c0b0; -} - -.title { - color: #0f0c5d; -} - -.name, .tripcode { - color: #117743; -} - -a.reply { - color: #af0a0f; - text-decoration: 1px underline; -} - -.replyLink { - color: #000080; - font-size: 0.8em; -} - -#newpostbtn { - text-align: center; - margin-top: 80px; -} - -#postForm { - margin: auto; -} - -#postForm tr > td:first-child { - background-color: #98e; - border: 1px black; - padding-left: 0.5em; - padding-right: 0.5em; -} - -.nsfw #postForm tr > td:first-child { - background-color: #ea8; -} - -#postForm input[type="text"], -#postForm textarea, -#reply-name, #reply-options, #reply-comment { - box-sizing: border-box; - -webkit-box-sizing:border-box; - -moz-box-sizing: border-box; -} - -#postForm input[type="text"], -#postForm textarea, -#reply-name, #reply-options, #reply-comment { - box-sizing: border-box; - -webkit-box-sizing:border-box; - -moz-box-sizing: border-box; -} - -#reply-comment { - min-width: 300px; - width: 396px; - height: 200px; -} - -#reply-name { - width: 75%; - float: left; -} - -#reply-options { - width: 25%; - float: right; -} - -#reply-header { - display: inline-block; - width: 100%; - cursor: move; -} - -#postForm #captcha { - display: block; - width: 100%; -} - -.popup-box { - position: fixed; - min-width: 300px; - width: min-content; - z-index: 9; - display: block; -} - -/* TODO: rename */ -.box2 { - border: 4px solid #f0e2d9; - background-color: #f9f9e0; -} - -.newsbox { - padding: 25px; - border: 4px solid #f0e2d9; - background-color: #f9f9e0; -} - -.newsbox h2 { - margin: 0; - padding: 0; -} - -.newsbox-news { - text-align: left; - margin-top: 25px; - padding: 25px; -} - -.newsbox-news p, -.newsbox-news h3 { - margin: 0; -} - -#stopTablePost { - float: right; - display: none; -} - -#boardGrid { - display: grid; - grid-auto-columns: 1fr; - border: 4px solid #820404; - background-color: #f9f9e0; -} - -#boardGridHeader { - border-bottom: 2px solid #820404; - display: inline-grid; -} - -.boardGridCell { - white-space: nowrap; - display: inline-grid; - text-align: left; - padding: 5px; - border-top: 2px solid #820404; - border-left: 2px solid #820404; -} - -/* these may or may not work. my CSS is poor so i just kinda did stuff until it worked. */ -.boardGridCell:nth-child(-n+4) { - border-top: none; -} - -.boardGridCell:nth-child(3n+2) { - border-left: none; -} - -#threadfooter { - width: 100%; - table-layout: fixed; - border-collapse: collapse; -} - -#threadfooter td { - padding: 0; - margin: 0; -} - -#threadfooter #threadStats { - float: right; -} - -#navlinks, #boardlinks { - padding: 0; - margin: 0; -} - -#navlinks > li, -#boardlinks > li { - display: inline; -} diff --git a/static/css/themes/gruvbox.css b/static/css/themes/gruvbox.css deleted file mode 100644 index 8704482..0000000 --- a/static/css/themes/gruvbox.css +++ /dev/null @@ -1,235 +0,0 @@ -a, a:link, a:visited, a:active { - color: #b16286; - text-decoration: none -} - -a.reply { - color: #cc241d; - text-decoration: 1px underline; -} - -a:hover.reply { - color: #fb4934; -} - -body { - background: #282828; - color: #ebdbb2; - - font-family: monospace, sans-serif; - font-size: 0.9em; -} - -.popup-box { - border: 4px solid #928374; - background-color: #3c3836; -} - -.box, .box-alt { - background-color: #3c3836; -} - -.quote { - color: #98971a; -} - -.post { - background-color: #1d2021; -} - -:target > div > .post { - background-color: #504945; -} - -.subject { - color: #458588; -} - -.name { - color: #b8bb26; -} - -.tripcode { - color: #689d6a; -} - -h1,h2,h3,h4,h5,h6 { - color: #fb4934; - margin-bottom: 0.1em; -} - -.replyLink { - color: #83a598; - font-size: 0.8em; -} - -#newpostbtn { - text-align: center; - margin-top: 80px; -} - -input[type="text"] { - -webkit-appearance: none; - -webkit-border-radius: 0; -} - -#postForm { - border: 4px solid #928374; - background-color: #3c3836; - margin: auto; -} - -#postForm tr > td:first-child { - background-color: #504945; - padding-left: 0.5em; - padding-right: 0.5em; -} - -#postForm input[type="text"], -#postForm textarea, -#reply-name, #reply-options, #reply-comment { - background-color: #504945; - color: #ebdbb2; - border: 0; - border-bottom: 2px solid #3c3836; - font-family: monospace, sans-serif; - - box-sizing: border-box; - -webkit-box-sizing:border-box; - -moz-box-sizing: border-box; -} - -#postForm input[type="text"]:focus, -#postForm textarea:focus, -#reply-name:focus, #reply-options:focus, #reply-comment:focus { - outline: none; -} - -#reply-comment { - min-width: 300px; - width: 396px; - height: 200px; -} - -#reply-name { - width: 75%; - float: left; -} - -#reply-options { - width: 25%; - border-left: 2px solid #3c3836; - float: right; -} - -#reply-header { - display: inline-block; - width: 100%; - cursor: move; -} - -#postForm #captcha { - display: block; - width: 100%; -} - -.popup-box { - position: fixed; - min-width: 300px; - width: min-content; - z-index: 9; - display: block; -} - -/* TODO: rename */ -.box2 { - border: 4px solid #928374; - background-color: #3c3836; -} - -.newsbox { - padding: 25px; - border: 4px solid #928374; - background-color: #3c3836; -} - -.newsbox h2 { - margin: 0; - padding: 0; -} - -.newsbox-news { - text-align: left; - background-color: #504945; - margin-top: 25px; - padding: 25px; -} - -.newsbox-news p, -.newsbox-news h3 { - margin: 0; -} - -#stopTablePost { - float: right; - display: none; -} - -#boardGrid { - display: grid; - grid-auto-columns: 1fr; - border: 4px solid #928374; - background-color: #3c3836; -} - -#boardGridHeader { - border-bottom: 2px solid #928374; - display: inline-grid; -} - -.boardGridCell { - white-space: nowrap; - display: inline-grid; - text-align: left; - padding: 5px; - border-top: 2px solid #928374; - border-left: 2px solid #928374; -} - -/* these may or may not work. my CSS is poor so i just kinda did stuff until it worked. */ -.boardGridCell:nth-child(-n+4) { - border-top: none; -} - -.boardGridCell:nth-child(3n+2) { - border-left: none; -} - -#threadfooter { - width: 100%; - table-layout: fixed; - border-collapse: collapse; -} - -#threadfooter td { - padding: 0; - margin: 0; -} - -#threadfooter #threadStats { - float: right; -} - -#navlinks, #boardlinks { - padding: 0; - margin: 0; -} - -#navlinks > li, -#boardlinks > li { - display: inline; -} - -hr { - border: 1px solid #928374; -} diff --git a/static/faq.html b/static/faq.html deleted file mode 100644 index 0305b7e..0000000 --- a/static/faq.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - [Back] -

FAQ

-
-

What is fchan?

-

fchan, short for FChannel, is a federated image board based on ActivityPub, a protocol which allows social sites like social media and image boards to be decentralized. Boards across sites which are on the opposite sides of the Globe can be connected and feeds can be shared or followed. It pulls likeness from other chans for ease of familiarity and use.

You can get the source code on https://github.com/FChannel0 which is available under AGPLv3, which means that you can modify the source code of fchan however you like as long as you share your source code with everyone else. We appreciate and encourage any positive contributions to the source code!

- -

What are the "Options" used for when posting?

-

The "Options" field can be used for special options when posting.

- -

What is a "tripcode"?

-

A tripcode is a way to uniquely identify yourself on an imageboard. This is the closest you will get to registering. There are two kinds of tripcodes that can identify yourself with, however, it's recommended that you use secure tripcodes only if you take your identification number seriously.

-

- -

How do I quote?

-

Use the greater-than symbol (>) to quote strings of text. Use double (>>) followed by the URL id of the post you are referencing or click on the unique ID of the post (for example, FIDV40Q2) if you want to reference a post (keep in mind that this will be changed later for better use).

- - -

Click the "No." next to the post to view its thread.

- -

What kind of files can I upload?

-

The maximum file size is 7 MiB (mebibyte). The supported file types are:

- - -

Why use JavaScript?

-

A version of the frontend with no JavaScript will be made eventually. Current version requires it as it is needed for some basic functionality. There are no external libraries used by the frontend, just basic selection of DOM elements and modifying their styling. Perhaps (You) could contribute a frontend that uses no JavaScript?

- -

Why do the posts not have sequential ID numbers?

-

Sequential ID numbers have run their course, random base36 is better.

- -

ActivityPub specific examples

-

Soon™.

- -

What version is this FChannel instance?

-

v0.0.15-release

-
-
- [Home][Rules][FAQ] -

All trademarks and copyrights on this page are owned by their respective parties.

-
- - diff --git a/static/favicon.png b/static/favicon.png deleted file mode 100644 index b90281e..0000000 Binary files a/static/favicon.png and /dev/null differ diff --git a/static/index.html b/static/index.html deleted file mode 100644 index d45dd77..0000000 --- a/static/index.html +++ /dev/null @@ -1,78 +0,0 @@ -{{ define "header" }} -{{ .Title }} - - - - - - - - - - - - - - -{{ end }} - -{{ define "top" }}{{ end }} -{{ define "content" }} -
-

{{ .Title }}

-

{{ .PreferredUsername }} is a federated image board based on ActivityPub. The current version of the code running on the server is still a work-in-progress product, expect a bumpy ride for the time being. Get the server code here: https://github.com/FChannel0.

- - {{ if .Boards }} - {{ $l := len .Boards }} -
-
- {{ if lt $l 2 }} -
Local boards
- {{ else if eq $l 2 }} -
Local boards
- {{ else }} -
Local boards
- {{ end }} - {{ range .Boards }} - - {{ end }} - {{ if gt $l 2 }} - {{ range .BoardRemainer }} -
- {{ end }} - {{ end }} -
-
- {{ end }} - - {{ if .NewsItems }} -
-

{{ .PreferredUsername }} News

- {{ range $i, $e := .NewsItems }} -
-

{{unixtoreadable $e.Time}} - {{$e.Title}}{{ if $.Board.ModCred }} [Delete] {{end}}

-
- -

{{$e.Content}}

-
- {{ end }} -
- {{ end }} - -
-

Current known instances

- (always use a proxy) - - {{ range .InstanceIndex }} - - - - {{ end }} -
{{ .Id }}
-
-
-{{ end }} -{{ define "bottom" }}{{ end }} - -{{ define "script" }} -{{ end }} diff --git a/static/js/footerscript.js b/static/js/footerscript.js deleted file mode 100644 index 69e56e7..0000000 --- a/static/js/footerscript.js +++ /dev/null @@ -1,44 +0,0 @@ -var imgs = document.querySelectorAll('#img'); -var imgArray = [].slice.call(imgs); - -imgArray.forEach(function(img, i){ - img.addEventListener("click", function(e){ - var id = img.getAttribute("id"); - var media = document.getElementById("media-" + id); - var sensitive = document.getElementById("sensitive-" + id); - - if(img.getAttribute("enlarge") == "0") - { - var attachment = img.getAttribute("attachment"); - img.setAttribute("enlarge", "1"); - img.setAttribute("style", "float: left; margin-right: 10px; cursor: pointer;"); - img.src = attachment; - } - else - { - var preview = img.getAttribute("preview"); - img.setAttribute("enlarge", "0"); - if(img.getAttribute("main") == 1) - { - img.setAttribute("style", "float: left; margin-right: 10px; max-width: 250px; max-height: 250px; cursor: pointer;"); - img.src = preview; - } - else - { - img.setAttribute("style", "float: left; margin-right: 10px; max-width: 125px; max-height: 125px; cursor: pointer;"); - img.src = preview; - } - } - }); -}); - - -function viewLink(board, actor) { - var posts = document.querySelectorAll('#view'); - var postsArray = [].slice.call(posts); - - postsArray.forEach(function(p, i){ - var id = p.getAttribute("post"); - p.href = "/" + board + "/" + shortURL(actor, id); - }); -} diff --git a/static/js/posts.js b/static/js/posts.js deleted file mode 100644 index 87f6228..0000000 --- a/static/js/posts.js +++ /dev/null @@ -1,344 +0,0 @@ -function startNewPost(){ - var el = document.getElementById("newpostbtn"); - el.style="display:none;"; - el.setAttribute("state", "1"); - document.getElementById("newpost").style = ""; - document.getElementById("stopTablePost").style = "display:unset;"; - sessionStorage.setItem("newpostState", true); -} - -function stopNewPost(){ - var el = document.getElementById("newpostbtn"); - el.style="display:block;margin-bottom:100px;"; - el.setAttribute("state", "0"); - document.getElementById("newpost").style = "display: none;"; - sessionStorage.setItem("newpostState", false); -} - -function shortURL(actorName, url) -{ - re = /.+\//g; - temp = re.exec(url); - - var output; - - if(stripTransferProtocol(temp[0]) == stripTransferProtocol(actorName) + "/") - { - var short = url.replace("https://", ""); - short = short.replace("http://", ""); - short = short.replace("www.", ""); - - var re = /^.{3}/g; - - var u = re.exec(short); - - re = /\w+$/g; - - output = re.exec(short); - }else{ - var short = url.replace("https://", ""); - short = short.replace("http://", ""); - short = short.replace("www.", ""); - - var re = /^.{3}/g; - - var u = re.exec(short); - - re = /\w+$/g; - - u = re.exec(short); - - str = short.replace(/\/+/g, " "); - - str = str.replace(u, " ").trim(); - - re = /(\w|[!@#$%^&*<>])+$/; - - v = re.exec(str); - - output = "f" + v[0] + "-" + u - } - - return output; -} - -function getBoardId(url) -{ - var re = /\/([^/\n]+)(.+)?/gm; - var matches = re.exec(url); - return matches[1]; -} - -function convertContent(actorName, content, opid) -{ - var re = /(>>)(https?:\/\/)?(www\.)?.+\/\w+/gm; - var match = content.match(re); - var newContent = content; - if(match) - { - match.forEach(function(quote, i){ - var link = quote.replace('>>', ''); - var isOP = ""; - if(link == opid) - { - isOP = " (OP)"; - } - - var q = link; - - if(document.getElementById(link + "-content") != null) { - q = document.getElementById(link + "-content").innerText; - q = q.replaceAll('>', '/\>'); - q = q.replaceAll('"', ''); - q = q.replaceAll("'", ""); - } - newContent = newContent.replace(quote, '>>' + shortURL(actorName, link) + isOP + ''); - - }); - } - - re = /^(\s+)?>.+/gm; - - match = newContent.match(re); - if(match) - { - match.forEach(function(quote, i) { - - newContent = newContent.replace(quote, '' + quote + ''); - }); - } - - return newContent.replaceAll('/\>', '>'); -} - -function convertContentNoLink(actorName, content, opid) -{ - var re = /(>>)(https?:\/\/)?(www\.)?.+\/\w+/gm; - var match = content.match(re); - var newContent = content; - if(match) - { - match.forEach(function(quote, i){ - var link = quote.replace('>>', ''); - var isOP = ""; - if(link == opid) - { - isOP = " (OP)"; - } - - var q = link; - - if(document.getElementById(link + "-content") != null) { - q = document.getElementById(link + "-content").innerText; - } - - newContent = newContent.replace(quote, '>>' + shortURL(actorName, link) + isOP); - }); - } - newContent = newContent.replaceAll("'", ""); - return newContent.replaceAll('"', ''); -} - -function closeReply() -{ - document.getElementById("reply-box").style.display = "none"; - document.getElementById("reply-comment").value = ""; - - sessionStorage.setItem("element-closed-reply", true); -} - -function closeReport() -{ - document.getElementById("report-box").style.display = "none"; - document.getElementById("report-comment").value = ""; - - sessionStorage.setItem("element-closed-report", true); -} - -function quote(actorName, opid, id) -{ - sessionStorage.setItem("element-closed-reply", false); - var box = document.getElementById("reply-box"); - var header = document.getElementById("reply-header"); - var header_text = document.getElementById("reply-header-text"); - var comment = document.getElementById("reply-comment"); - var inReplyTo = document.getElementById("inReplyTo-box"); - - var w = window.innerWidth / 2 - 200; - var h = 300; //document.getElementById(id + "-content").offsetTop - 348; - - const boxStyle = "top: " + h + "px; left: " + w + "px;"; - box.setAttribute("style", boxStyle); - sessionStorage.setItem("element-reply-style", boxStyle); - sessionStorage.setItem("reply-top", h); - sessionStorage.setItem("reply-left", w); - - - if (inReplyTo.value != opid) - comment.value = ""; - - header_text.innerText = "Replying to Thread No. " + shortURL(actorName, opid); - inReplyTo.value = opid; - sessionStorage.setItem("element-reply-actor", actorName); - sessionStorage.setItem("element-reply-id", inReplyTo.value); - - if(id != "reply") - comment.value += ">>" + id + "\n"; - sessionStorage.setItem("element-reply-comment", comment.value); - - dragElement(header); -} - -function report(actorName, id) -{ - sessionStorage.setItem("element-closed-report", false); - var box = document.getElementById("report-box"); - var header = document.getElementById("report-header"); - var comment = document.getElementById("report-comment"); - var inReplyTo = document.getElementById("report-inReplyTo-box"); - - var w = window.innerWidth / 2 - 200; - var h = 300; //document.getElementById(id + "-content").offsetTop - 348; - - const boxStyle = "top: " + h + "px; left: " + w + "px;"; - box.setAttribute("style", boxStyle); - sessionStorage.setItem("element-report-style", boxStyle); - sessionStorage.setItem("report-top", h); - sessionStorage.setItem("report-left", w); - - header.innerText = "Report Post No. " + shortURL(actorName, id); - inReplyTo.value = id; - sessionStorage.setItem("element-report-actor", actorName); - sessionStorage.setItem("element-report-id", id); - - dragElement(header); -} - -var pos1, pos2, pos3, pos4; -var elmnt; - -function closeDragElement(e) { - // stop moving when mouse button is released: - document.onmouseup = null; - document.onmousemove = null; - sessionStorage.setItem("eventhandler", false); -} - -function elementDrag(e) { - e = e || window.event; - e.preventDefault(); - // calculate the new cursor position: - pos1 = pos3 - e.clientX; - pos2 = pos4 - e.clientY; - pos3 = e.clientX; - pos4 = e.clientY; - sessionStorage.setItem("pos1", pos1); - sessionStorage.setItem("pos2", pos2); - sessionStorage.setItem("pos3", pos3); - sessionStorage.setItem("pos4", pos4); - - // set the element's new position: - elmnt.parentElement.style.top = (elmnt.parentElement.offsetTop - pos2) + "px"; - elmnt.parentElement.style.left = (elmnt.parentElement.offsetLeft - pos1) + "px"; - if(elmnt.id.startsWith("report")){ - sessionStorage.setItem("report-top", elmnt.parentElement.style.top); - sessionStorage.setItem("report-left", elmnt.parentElement.style.left); - }else if(elmnt.id.startsWith("reply")){ - sessionStorage.setItem("reply-top", elmnt.parentElement.style.top); - sessionStorage.setItem("reply-left", elmnt.parentElement.style.left); - } -} - -function dragMouseDown(e) { - e = e || window.event; - e.preventDefault(); - - // get the mouse cursor position at startup: - pos3 = e.clientX; - pos4 = e.clientY; - sessionStorage.setItem("pos3", pos3); - sessionStorage.setItem("pos4", pos4); - - elmnt = e.currentTarget; - - // call a function whenever the cursor moves: - document.onmouseup = closeDragElement; - document.onmousemove = elementDrag; - sessionStorage.setItem("eventhandler", true); - -} - -function dragElement(elmnt) { - elmnt.onmousedown = dragMouseDown; -} - -const stateLoadHandler = function(event){ - pos1 = parseInt(sessionStorage.getItem("pos1")); - pos2 = parseInt(sessionStorage.getItem("pos2")); - pos3 = parseInt(sessionStorage.getItem("pos3")); - pos4 = parseInt(sessionStorage.getItem("pos4")); - - if(sessionStorage.getItem("element-closed-report") === "false"){ - var box = document.getElementById("report-box"); - var header = document.getElementById("report-header"); - var comment = document.getElementById("report-comment"); - var inReplyTo = document.getElementById("report-inReplyTo-box"); - - header.onmousedown = dragMouseDown; - inReplyTo.value = parseInt(sessionStorage.getItem("element-report-id")); - header.innerText = "Report Post No. " + shortURL(sessionStorage.getItem("element-report-actor"), sessionStorage.getItem("element-report-id")); - comment.value = sessionStorage.getItem("element-report-comment"); - - box.setAttribute("style", sessionStorage.getItem("element-report-style")); - - box.style.top = sessionStorage.getItem("report-top"); - box.style.left = sessionStorage.getItem("report-left"); - - if(sessionStorage.getItem("eventhandler") === "true"){ - elmnt = header; - document.onmouseup = closeDragElement; - document.onmousemove = elementDrag; - }else{ - document.onmouseup = null; - document.onmousemove = null; - } - } - if(sessionStorage.getItem("element-closed-reply") === "false"){ - var box = document.getElementById("reply-box"); - var header = document.getElementById("reply-header"); - var header_text = document.getElementById("reply-header-text"); - var comment = document.getElementById("reply-comment"); - var inReplyTo = document.getElementById("inReplyTo-box"); - - header.onmousedown = dragMouseDown; - inReplyTo.value = parseInt(sessionStorage.getItem("element-reply-id")); - header_text.innerText = "Replying to Thread No. " + shortURL(sessionStorage.getItem("element-reply-actor"), sessionStorage.getItem("element-reply-id")); - comment.value = sessionStorage.getItem("element-reply-comment"); - - pos1 = parseInt(sessionStorage.getItem("pos1")); - pos2 = parseInt(sessionStorage.getItem("pos2")); - pos3 = parseInt(sessionStorage.getItem("pos3")); - pos4 = parseInt(sessionStorage.getItem("pos4")); - - box.setAttribute("style", sessionStorage.getItem("element-reply-style")); - - box.style.top = sessionStorage.getItem("reply-top"); - box.style.left = sessionStorage.getItem("reply-left"); - - if(sessionStorage.getItem("eventhandler") === "true"){ - elmnt = header; - document.onmouseup = closeDragElement; - document.onmousemove = elementDrag; - }else{ - document.onmouseup = null; - document.onmousemove = null; - } - } -}; - -document.addEventListener("DOMContentLoaded", stateLoadHandler, false); - -function stripTransferProtocol(value){ - var re = /(https:\/\/|http:\/\/)?(www.)?/; - return value.replace(re, ""); -} diff --git a/static/js/themes.js b/static/js/themes.js deleted file mode 100644 index ccdd277..0000000 --- a/static/js/themes.js +++ /dev/null @@ -1,40 +0,0 @@ -function setCookie(key, value, age) { - document.cookie = key + "=" + encodeURIComponent(value) + ";sameSite=strict;max-age=" + (60 * 60 * 24 * age) + ";path=/"; -} - -function getCookie(key) { - if (document.cookie.length != 0) { - return document.cookie.split('; ').find(row => row.startsWith(key)).split('=')[1]; - } - return ""; -} - -function setTheme(name) { - for (let i = 0, tags = document.getElementsByTagName("link"); i < tags.length; i++) { - if (tags[i].type === "text/css" && tags[i].title) { - tags[i].disabled = !(tags[i].title === name); - } - } - - setCookie("theme", name, 3650); -} - -function applyTheme() { - // HACK: disable all of the themes first. this for some reason makes things work. - for (let i = 0, tags = document.getElementsByTagName("link"); i < tags.length; i++) { - if (tags[i].type === "text/css" && tags[i].title) { - tags[i].disabled = true; - } - } - let theme = getCookie("theme") || "default"; - setTheme(theme); - - // reflect this in the switcher - let switcher = document.getElementById("themeSwitcher"); - for(var i = 0; i < switcher.options.length; i++) { - if (switcher.options[i].value === theme) { - switcher.selectedIndex = i; - break; - } - } -} diff --git a/static/js/timer.js b/static/js/timer.js deleted file mode 100644 index d8be9de..0000000 --- a/static/js/timer.js +++ /dev/null @@ -1,38 +0,0 @@ -var timerCount; -var timerToggle = false; -var timer; -const contentLoadHandler = function(event){ - timerToggle = !!document.getElementById("autoreload-checkbox").checked; - if(timerToggle){ - timerCount = 45; - document.getElementById("autoreload-countdown").innerHTML = "45"; - document.getElementById("autoreload-countdown").style.visibility = "visible"; - timer = setInterval(timerFunction, 1000); - document.removeEventListener("DOMContentLoaded", contentLoadHandler, false); - } -}; - -document.addEventListener("DOMContentLoaded", contentLoadHandler, false); - -function timerFunction(){ - timerCount--; - document.getElementById("autoreload-countdown").innerHTML = timerCount; - if(timerCount <= 0){ - document.getElementById("autoreload-countdown").innerHTML = "Refreshing..."; - clearInterval(timer); - location.reload(); - } -} - -function autoTimer(){ - timerToggle = !timerToggle; - if(timerToggle === true){ - timerCount = 45; - document.getElementById("autoreload-countdown").innerHTML = "45"; - document.getElementById("autoreload-countdown").style.visibility = "visible"; - timer = setInterval(timerFunction, 1000); - }else{ - clearInterval(timer); - document.getElementById("autoreload-countdown").style.visibility = "hidden"; - } -} diff --git a/static/locked.png b/static/locked.png deleted file mode 100644 index 7792d16..0000000 Binary files a/static/locked.png and /dev/null differ diff --git a/static/main.html b/static/main.html deleted file mode 100644 index 1f7cc2f..0000000 --- a/static/main.html +++ /dev/null @@ -1,67 +0,0 @@ -{{ define "layout" }} - - - - - - - - - - {{ if gt (len .ThemeCookie) 0 }} - - {{ else }} - - {{ end }} - {{ range .Themes }} - - {{ end }} - {{ template "header" . }} - - - - {{ if .Board.ModCred }} - {{ if eq .Board.ModCred .Board.Domain .Board.Actor.Id }} - [Manage Board] - {{ end }} - {{ end }} - {{ template "top" . }} - - {{ template "content" . }} - - {{ template "bottom" . }} - -
- [Home] [Rules] [FAQ] -

All trademarks and copyrights on this page are owned by their respective parties.

-
- -
- Theme: - -
- - -{{ template "script" . }} - - - -{{ end }} diff --git a/static/nadmin.html b/static/nadmin.html deleted file mode 100644 index 8ee4800..0000000 --- a/static/nadmin.html +++ /dev/null @@ -1,89 +0,0 @@ -{{ define "title" }}{{ .Title }}{{ end }} -{{ define "header" }} {{ end }} -{{ define "top" }}{{ end }} -{{ define "content" }} -
-

Add Board

-
-
-
-
-
-
-
-
- -
- -
- - -
-

Subscribed

-
-
- -
- -
- - - -
-

Create News

-
-
-
-
-
-
-
- -
-

Regex Post Blacklist

-
-
-
-
-
-
- {{ if .PostBlacklist }} - - {{ end }} -
- - - - - - -{{ end }} -{{ define "bottom" }}{{ end }} - -{{ define "script" }} -{{ end }} diff --git a/static/ncatalog.html b/static/ncatalog.html deleted file mode 100644 index 8039c5b..0000000 --- a/static/ncatalog.html +++ /dev/null @@ -1,114 +0,0 @@ -{{ define "header" }} -/{{ .Board.Name }}/ - catalog - - - - - - - - - - - - -{{ end }} - -{{ define "content" }} -{{ $board := .Board }} -
- - - -
- -
- {{ range .Posts }} -
- {{ if eq $board.ModCred $board.Domain $board.Actor.Id }} - [Delete Post] - {{ end }} - {{ if .Attachment }} - {{ if eq $board.ModCred $board.Domain $board.Actor.Id }} - [Delete Attachment] - [Mark Sensitive] - {{ end }} - - - -
{{ parseAttachment . true }}
-
- - {{ end }} - -
- {{ $replies := .Replies }} - {{ if $replies }} - R: {{ $replies.TotalItems }}{{ if $replies.TotalImgs }}/ A: {{ $replies.TotalImgs }}{{ end }} - {{ end }} - {{ if .Name }} -
- {{ .Name }} - {{ end }} - - {{ if .Content }} -
- {{.Content}} - {{ end }} -
-
-
- {{ end }} -
-
- - - -
-{{ end }} -{{ define "bottom" }} -{{ end }} - -{{ define "script" }} -{{ end }} diff --git a/static/news.html b/static/news.html deleted file mode 100644 index a83c406..0000000 --- a/static/news.html +++ /dev/null @@ -1,34 +0,0 @@ -{{ define "header" }} -{{ .Title }} - - - - - - - - - - - - - - -{{ end }} - -{{ define "top" }}{{ end }} -{{ define "content" }} -
- - {{ range .NewsItems }} -
-

{{unixtoreadable .Time}} - {{.Title}}


{{.Content}}

-
- {{ end }} - -
-{{ end }} -{{ define "bottom" }}{{ end }} - -{{ define "script" }} -{{ end }} diff --git a/static/notfound.png b/static/notfound.png deleted file mode 100644 index 1253e47..0000000 Binary files a/static/notfound.png and /dev/null differ diff --git a/static/npost.html b/static/npost.html deleted file mode 100644 index cf78db7..0000000 --- a/static/npost.html +++ /dev/null @@ -1,66 +0,0 @@ -{{ define "header" }} -/{{ .Board.Name }}/ - {{ .PostId }} - - - - - - - - - - - -{{ if (index .Posts 0).Preview }} - - -{{ end }} -{{ end }} - -{{ define "content" }} -{{ $board := .Board }} - -
- -
- -{{ template "posts" . }} - -
- - - - - {{ if eq (index .Posts 0).Type "Note" }} - - {{ end }} - - -
- - - [Post a Reply] - - {{ $replies := (index .Posts 0).Replies }} - {{ $replies.TotalItems }} / {{ $replies.TotalImgs }} -
- -
-{{ end }} - -{{ define "script" }} - - - -{{ end }} diff --git a/static/nposts.html b/static/nposts.html deleted file mode 100644 index 336edb6..0000000 --- a/static/nposts.html +++ /dev/null @@ -1,65 +0,0 @@ -{{ define "header" }} -{{ .Title }} - - - - - - - - - - -{{ end }} - -{{ define "content" }} -{{ $board := .Board }} -
- - -{{ template "posts" . }} - -
- - - -
-{{ if gt .TotalPage 0 }} -{{ $totalPage := .TotalPage }} - -{{ end }} -{{ end }} - -{{ define "script" }} - - -{{ end }} diff --git a/static/onion.png b/static/onion.png deleted file mode 100644 index 0cb9527..0000000 Binary files a/static/onion.png and /dev/null differ diff --git a/static/pin.png b/static/pin.png deleted file mode 100644 index 6952601..0000000 Binary files a/static/pin.png and /dev/null differ diff --git a/static/posts.html b/static/posts.html deleted file mode 100644 index 936ed58..0000000 --- a/static/posts.html +++ /dev/null @@ -1,122 +0,0 @@ -{{ define "posts" }} -{{ $board := .Board }} -{{ $len := len .Posts }} -{{ range .Posts }} -{{ $thread := . }} -{{ $opId := .Id }} -{{ if eq $board.InReplyTo "" }} -
-{{ end }} -
-
- {{ if eq $board.ModCred $board.Domain $board.Actor.Id }} - [Delete Post] - {{ end }} - {{ if .Attachment }} - {{ if eq $board.ModCred $board.Domain $board.Actor.Id }} - [Ban Media] - [Delete Attachment] - [Mark Sensitive] - {{ end }} - File: {{ shortImg (index .Attachment 0).Name }} ({{ convertSize (index .Attachment 0).Size }}) - - -
{{ parseAttachment . false }}
- - {{ end }} - {{ .Name }} - {{ if .AttributedTo }} {{.AttributedTo }} {{ else }} Anonymous {{ end }} - {{ .TripCode }} - {{ .Published | timeToReadableLong }} No. {{ short $board.Actor.Outbox .Id }} {{ if ne .Type "Tombstone" }}[Report]{{ end }} -

{{ parseContent $board.Actor $opId .Content $thread }}

- {{ if .Replies }} - {{ $replies := .Replies }} - {{ if gt $replies.TotalItems 5 }} - {{ if gt $len 1 }} - {{ $replies.TotalItems }} replies{{ if gt $replies.TotalImgs 0}} and {{ $replies.TotalImgs }} images{{ end }}, Click here to view all. - {{ end }} - {{ end }} - {{ range $replies.OrderedItems }} -
-
-
>>
-
- {{ if eq $board.ModCred $board.Domain $board.Actor.Id }} - [Delete Post] - {{ end }} - {{ if .Attachment }} - {{ if eq $board.ModCred $board.Domain $board.Actor.Id }} - [Ban Media] - [Delete Attachment] - [Mark Sensitive] - {{ end }} - File {{ shortImg (index .Attachment 0).Name }} ({{ convertSize (index .Attachment 0).Size }}) - - -
-
{{ parseAttachment . false }}
- - {{ end }} - {{ .Name }} - {{ if .AttributedTo }} {{.AttributedTo }} {{ else }} Anonymous {{ end }} - {{ .TripCode }} - {{ .Published | timeToReadableLong }} No. {{ short $board.Actor.Outbox .Id }} {{ if ne .Type "Tombstone" }}[Report]{{ end }} - {{ $parentId := .Id }} - {{ if .Replies.OrderedItems }} - {{ range .Replies.OrderedItems }} - {{ parseReplyLink $board.Actor.Id $opId .Id .Content }} - {{ end }} - {{ end }} -

{{ parseContent $board.Actor $opId .Content $thread }}

-
-
-
- {{ end }} - {{ end }} -
-
-{{ end }} -{{ end }} diff --git a/static/rules.html b/static/rules.html deleted file mode 100644 index afb0319..0000000 --- a/static/rules.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - [Back] -

Rules and Agreements:

-
    -
  1. Do not break any laws of the U.S.A.
  2. -
  3. You must be 18 to post or access this website.
  4. -
  5. Blue boards are restricted to work-safe (SFW) posts only.
  6. -
- - diff --git a/static/sensitive.png b/static/sensitive.png deleted file mode 100644 index ea706c8..0000000 Binary files a/static/sensitive.png and /dev/null differ diff --git a/static/top.html b/static/top.html deleted file mode 100644 index 8a1af95..0000000 --- a/static/top.html +++ /dev/null @@ -1,130 +0,0 @@ -{{ define "top" }} -
-

/{{ .Board.Name }}/ - {{ .Board.PrefName }}

-

{{ .Board.Summary }}

- {{ $len := len .Posts }} - {{ if eq $len 0 }} - {{ if .Board.InReplyTo }} - - {{ else }} - - {{ end }} -
-
- - - - - - - - - - - {{ if eq .Board.InReplyTo "" }} - - - - - {{ end }} - - - - - - - - - - - - -
- [X] -
{{ if .Board.InReplyTo }}{{ end }}
-
Mark sensitive
-
- -
- -
- - - - - - -
-
- - {{ else }} - - {{ if eq (index .Posts 0).Type "Note" }} - {{ if .Board.InReplyTo }} - - {{ else }} - - {{ end }} - {{ $len := len .Posts }} -
-
- - - - - - - - - - {{ if eq .Board.InReplyTo "" }} - - - - - {{ end }} - - - - - - - - - - - - -
- [X] -
{{ if .Board.InReplyTo }}{{ end }}
-
Mark sensitive
-
- -
- -
- - - - - -
-
- -
- {{ else }} -

Archived Post

- {{ end }} - {{ end }} - - -{{ end }} diff --git a/views/faq.html b/views/faq.html index 0305b7e..5b151a4 100644 --- a/views/faq.html +++ b/views/faq.html @@ -54,9 +54,6 @@

ActivityPub specific examples

Soon™.

- -

What version is this FChannel instance?

-

v0.0.15-release

[Home][Rules][FAQ] diff --git a/views/npost.html b/views/npost.html index 7c22b9b..04a0d97 100644 --- a/views/npost.html +++ b/views/npost.html @@ -25,6 +25,7 @@ + {{ if gt (len .page.Posts) 0 }} {{ if eq (index .page.Posts 0).Type "Note" }} [Post a Reply] @@ -35,6 +36,7 @@ {{ $replies := (index .page.Posts 0).Replies }} {{ $replies.TotalItems }} / {{ $replies.TotalImgs }} + {{ end }} diff --git a/views/partials/footer.html b/views/partials/footer.html index 2253039..cfae619 100644 --- a/views/partials/footer.html +++ b/views/partials/footer.html @@ -4,7 +4,8 @@
- Theme: +

v0.1.0

+ Theme: