From 4a9452985a127a53572358c3b86a425a5df616e1 Mon Sep 17 00:00:00 2001 From: FChannel <> Date: Sat, 31 Jul 2021 12:10:31 -0700 Subject: removed javascript causing errors and updated readme with xmpp room --- README.md | 37 ++++++++++++++++++------------------- client.go | 18 ++++++++++++++++++ static/faq.html | 2 +- static/js/posts.js | 7 ------- static/ncatalog.html | 5 +++-- static/npost.html | 1 - static/posts.html | 8 ++++---- 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), `/\<`, ">") @@ -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), `/\<`, ">") @@ -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 @@

Soon™.

What version is this FChannel instance?

-

v0.0.13-release

+

v0.0.14-release

[Home][Rules][FAQ] 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 @@ {{ 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 @@
{{ parseAttachment . false }}