aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFChannel <>2021-07-31 12:10:31 -0700
committerFChannel <>2021-07-31 12:10:31 -0700
commit4a9452985a127a53572358c3b86a425a5df616e1 (patch)
treef83f0a0ee92e8167195f06f286bff28fe892581d
parentac288d40da3235b9382d685c9958ad167a758bcd (diff)
removed javascript causing errors and updated readme with xmpp room
-rw-r--r--README.md37
-rw-r--r--client.go18
-rw-r--r--static/faq.html2
-rw-r--r--static/js/posts.js7
-rw-r--r--static/ncatalog.html5
-rw-r--r--static/npost.html1
-rw-r--r--static/posts.html8
7 files changed, 44 insertions, 34 deletions
diff --git a/README.md b/README.md
index 6c82993..a05eed7 100644
--- a/README.md
+++ b/README.md
@@ -9,21 +9,21 @@ It is a testing environment, so the instances might come and go.
## To Do List
Current things that will be implemented first are:
-- A way to automatically index new instances into a list so others can discover instances as they come online.
-- Setting up a server proxy so that clearnet instances can talk to TOR/Loki/I2P instances.
+- A way to automatically index new instances into a list so others can discover instances as they come online.
+- Setting up a server proxy so that clearnet instances can talk to TOR/Loki/I2P instances.
- Other improvements will be made over time, first it needs to be as easy as possible for new instances to come online and connect with others reliably.
Try and run your own instances and federate with one of the instances above.
-Any contributions or suggestions are appreciated. Best way to give immediate feedback is the Matrix channel #fchan:matrix.org
+Any contributions or suggestions are appreciated. Best way to give immediate feedback is the XMPP: general@rooms.fchannel.org or Matrix: #fchan:matrix.org
# Server Installation and Configuration
## Minimum Server Requirements
- Go v1.16+
-
+
- PostgreSQL
-
+
- Redis
- ImageMagick
@@ -47,24 +47,24 @@ Any contributions or suggestions are appreciated. Best way to give immediate fee
### config file
`instance:fchan.xyz` Domain name that the host can be located at without www and `http://` or `https://`
-
+
`instancetp:https://` Transfer protocol your domain is using, should be https if possible. Do not put `https://` if you are using `http://`
-
+
`instanceport:3000` Port the server is running on locally, on your server.
-
+
`instancename:FChan` Full name that you want your instances to be called.
-
+
`instancesummary:FChan is a federated image board instance.` Brief description of your instance.
`dbhost:localhost` Database host. Most likely leave as `localhost`.
-
+
`dbport:5432` Port number for database. Most likely leave the default value.
-
+
`dbname:fchan_server` Database name for psql.
-
+
`dbuser:admin` Database user that can connect to dbname.
-
+
`dbpass:password` Database password for dbuser.
`torproxy:127.0.0.1:9050` Tor proxy route and port, leave blank if you do not want to support
@@ -75,13 +75,13 @@ Any contributions or suggestions are appreciated. Best way to give immediate fee
Currently e-mail is not implemented to do anything special, but the code is in place
-
+
`emailserver:mail.fchan.xyz`
-
+
`emailport:465`
-
+
`emailaddress:contact@fchan.xyz`
-
+
`emailpass:password`
### Local testing
@@ -109,7 +109,7 @@ Use [Certbot](https://github.com/certbot/certbot), (or your tool of choice) to s
```
server {
- listen 80;
+ listen 80;
listen [::]:80;
root /var/www/html;
@@ -158,4 +158,3 @@ server {
Any support is appreciated all funds go to hosting and development of the project
XMR - 85ma5KYR8Jk8zhGospQ8DeMNUrY74rQqEgiiPHvKHbowa37TAa5MLUD8RBaupw5oAxWmpFDrSAxsDbeXcfoAwiZF69mq4CE
-
diff --git a/client.go b/client.go
index c157416..c3e89cd 100644
--- a/client.go
+++ b/client.go
@@ -203,6 +203,9 @@ func OutboxGet(w http.ResponseWriter, r *http.Request, db *sql.DB, collection Co
"convertSize": func(size int64) string {
return ConvertSize(size)
},
+ "isOnion": func(url string) bool {
+ return IsOnion(url)
+ },
"parseReplyLink": func(actorId string, op string, id string, content string) template.HTML {
actor := FingerActor(actorId)
title := strings.ReplaceAll(ParseLinkTitle(actor.Id, op, content), `/\&lt;`, ">")
@@ -276,6 +279,9 @@ func CatalogGet(w http.ResponseWriter, r *http.Request, db *sql.DB, collection C
"parseAttachment": func(obj ObjectBase, catalog bool) template.HTML {
return ParseAttachment(obj, catalog)
},
+ "isOnion": func(url string) bool {
+ return IsOnion(url)
+ },
"sub": func (i, j int) int { return i - j }}).ParseFiles("./static/main.html", "./static/ncatalog.html", "./static/top.html"))
actor := collection.Actor
@@ -377,6 +383,9 @@ func PostGet(w http.ResponseWriter, r *http.Request, db *sql.DB){
"convertSize": func(size int64) string {
return ConvertSize(size)
},
+ "isOnion": func(url string) bool {
+ return IsOnion(url)
+ },
"parseReplyLink": func(actorId string, op string, id string, content string) template.HTML {
actor := FingerActor(actorId)
title := strings.ReplaceAll(ParseLinkTitle(actor.Id, op, content), `/\&lt;`, ">")
@@ -1017,3 +1026,12 @@ func ShortExcerpt(post ObjectBase) string {
return returnString
}
+
+func IsOnion(url string) bool {
+ re := regexp.MustCompile(`\.onion$`)
+ if(re.MatchString(url)) {
+ return true;
+ }
+
+ return false
+}
diff --git a/static/faq.html b/static/faq.html
index fd06956..f4fb237 100644
--- a/static/faq.html
+++ b/static/faq.html
@@ -56,7 +56,7 @@
<p>Soon&trade;.</p>
<h4 id="version">What version is this FChannel instance?</h4>
- <p>v0.0.13-release</p>
+ <p>v0.0.14-release</p>
</div>
<div style="width: 500px; margin:0 auto; margin-top: 50px; text-align: center;">
<a href="/">[Home]</a><a href="/static/rules.html">[Rules]</a><a href="/static/faq.html">[FAQ]</a>
diff --git a/static/js/posts.js b/static/js/posts.js
index 9b8a743..455e7ea 100644
--- a/static/js/posts.js
+++ b/static/js/posts.js
@@ -357,10 +357,3 @@ function stripTransferProtocol(value){
var re = /(https:\/\/|http:\/\/)?(www.)?/;
return value.replace(re, "");
}
-
-function isOnion(value){
- var re = /\.onion/;
- if(value.match(re) != null)
- return true;
- return false;
-}
diff --git a/static/ncatalog.html b/static/ncatalog.html
index 8ce418a..65a7d84 100644
--- a/static/ncatalog.html
+++ b/static/ncatalog.html
@@ -44,7 +44,8 @@
<script>
media = document.getElementById("media-{{ .Id }}")
- if(({{ .Sensitive }} && {{ $board.Actor.Restricted }}) || (isOnion("{{ .Id }}") && !isOnion("{{ $board.Domain }}"))){ sensitive = document.getElementById("sensitive-{{ .Id }}")
+ if(({{ .Sensitive }} && {{ $board.Actor.Restricted }}) || ({{ isOnion .Id }} && !{{ isOnion $board.Domain }}){
+ sensitive = document.getElementById("sensitive-{{ .Id }}")
hide = document.getElementById("hide-{{ .Id }}")
sensitive.onclick = function(){document.getElementById("media-{{ .Id }}").style="display: block;"; document.getElementById("sensitive-{{ .Id }}").style="display: none;"; document.getElementById("hide-{{ .Id }}").style="display: block; cursor: pointer;"}
hide.onclick = function(){document.getElementById("media-{{ .Id }}").style="display: none;"; document.getElementById("sensitive-{{ .Id }}").style="display: block;"; document.getElementById("hide-{{ .Id }}").style="display: none;"}
@@ -52,7 +53,7 @@
media.style = "display: none;"
}
- if(isOnion("{{ .Id }}") && !isOnion("{{ $board.Domain }}")) {
+ if({{ isOnion .Id }} && !{{ isOnion $board.Domain }}) {
sensitive = document.getElementById("sensitive-{{ .Id }}")
document.getElementById("sensitive-img-{{ .Id }}").src = "/static/onion.png"
document.getElementById("sensitive-text-{{ .Id }}").innerText = "Tor Instance"
diff --git a/static/npost.html b/static/npost.html
index 2f0778f..b0f89e6 100644
--- a/static/npost.html
+++ b/static/npost.html
@@ -50,7 +50,6 @@
{{ end }}
{{ define "script" }}
-<script src="/static/js/posts.js"></script>
<script src="/static/js/footerscript.js"></script>
<script src="/static/js/timer.js"></script>
{{ end }}
diff --git a/static/posts.html b/static/posts.html
index 0349ebb..c4f19d8 100644
--- a/static/posts.html
+++ b/static/posts.html
@@ -24,7 +24,7 @@
<div id="media-{{ .Id }}">{{ parseAttachment . false }}</div>
<script>
media = document.getElementById("media-{{ .Id }}")
- if(({{ .Sensitive }} && {{ $board.Actor.Restricted }}) || (isOnion("{{ .Id }}") && !isOnion("{{ $board.Domain }}"))){
+ if(({{ .Sensitive }} && {{ $board.Actor.Restricted }}) || {{ isOnion .Id }} && !{{ isOnion $board.Domain }}){
sensitive = document.getElementById("sensitive-{{ .Id }}")
hide = document.getElementById("hide-{{ .Id }}")
sensitive.onclick = function(){document.getElementById("media-{{ .Id }}").style="display: block;"; document.getElementById("sensitive-{{ .Id }}").style="display: none;"; document.getElementById("hide-{{ .Id }}").style="display: block; cursor: pointer;"}
@@ -33,7 +33,7 @@
media.style = "display: none;"
}
- if(isOnion("{{ .Id }}") && !isOnion("{{ $board.Domain }}")) {
+ if({{ isOnion .Id }} && !{{ isOnion $board.Domain }}) {
sensitive = document.getElementById("sensitive-{{ .Id }}")
document.getElementById("sensitive-img-{{ .Id }}").src = "/static/onion.png"
document.getElementById("sensitive-text-{{ .Id }}").innerText = "Tor Instance"
@@ -76,7 +76,7 @@
<script>
media = document.getElementById("media-{{ .Id }}")
- if(({{ .Sensitive }} && {{ $board.Actor.Restricted }}) || (isOnion("{{ .Id }}") && !isOnion("{{ $board.Domain }}"))){
+ if(({{ .Sensitive }} && {{ $board.Actor.Restricted }}) || {{ isOnion .Id }} && !{{ isOnion $board.Domain }}){
sensitive = document.getElementById("sensitive-{{ .Id }}")
hide = document.getElementById("hide-{{ .Id }}")
sensitive.onclick = function(){document.getElementById("media-{{ .Id }}").style="display: block;"; document.getElementById("sensitive-{{ .Id }}").style="display: none;"; document.getElementById("hide-{{ .Id }}").style="display: block; cursor: pointer;"}
@@ -85,7 +85,7 @@
media.style = "display: none;"
}
- if(isOnion("{{ .Id }}") && !isOnion("{{ $board.Domain }}")) {
+ if({{ isOnion .Id }} && !{{ isOnion $board.Domain }}) {
sensitive = document.getElementById("sensitive-{{ .Id }}")
document.getElementById("sensitive-img-{{ .Id }}").src = "/static/onion.png"
document.getElementById("sensitive-text-{{ .Id }}").innerText = "Tor Instance"