From c2de9971e9d5f1408083f0d131818e16430238d2 Mon Sep 17 00:00:00 2001 From: FChannel <> Date: Sat, 25 Jun 2022 11:33:24 -0700 Subject: removed public indexing being dependent on fchan being available --- README.md | 8 +++++--- config-init | 3 --- config/config.go | 1 - db/database.go | 5 ----- route/routes/main.go | 10 ---------- route/structs.go | 1 - util/proxy.go | 2 ++ views/index.html | 14 +------------- 8 files changed, 8 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index cf93b27..09444d6 100644 --- a/README.md +++ b/README.md @@ -70,13 +70,13 @@ and to fix errors reported by `go vet` and make your code better with `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 - `publicindex:true` Add instance to the public instance index at https://fchan.xyz, if you do not want to be added set this value to `false` If you are on the public index and want to be removed get in contact with the FChan dev to be removed. + `instancesalt:put your salt string here` Used for secure tripcodes currently. - `instancesalt:put your salt string here` Used for secure tripcodes currently. + `modkey:3358bed397c1f32cf7532fa37a8778` Set a static modkey instead of one randomly generated on restart. - Currently e-mail is not implemented to do anything special, but the code is in place `emailserver:mail.fchan.xyz` @@ -86,6 +86,8 @@ and to fix errors reported by `go vet` and make your code better with `emailpass:password` + `emailnotify:email1@so.co, email2@bo.uo` Comma seperated emails To. + ### Local testing When testing on a local env when setting the `instance` value in the config file you have to append the port number to the local address eg. `instance:localhost:3000` with `instanceport` also being set to the same port. diff --git a/config-init b/config-init index feaaf5e..f51bbb0 100644 --- a/config-init +++ b/config-init @@ -31,9 +31,6 @@ emailnotify: ## 127.0.0.1:9050 default torproxy: -## Change to true if you want your instance to be added to the public instance index -publicindex:false - ## add your instance salt here for secure tripcodes instancesalt: diff --git a/config/config.go b/config/config.go index 3a2e2f3..8b448e7 100644 --- a/config/config.go +++ b/config/config.go @@ -20,7 +20,6 @@ var SiteEmailServer = GetConfigValue("emailserver", "") //mail.fchan.xyz var SiteEmailPort = GetConfigValue("emailport", "") //587 var SiteEmailNotifyTo = GetConfigValue("emailnotify", "") var TorProxy = GetConfigValue("torproxy", "") //127.0.0.1:9050 -var PublicIndexing = strings.ToLower(GetConfigValue("publicindex", "false")) var Salt = GetConfigValue("instancesalt", "") var DBHost = GetConfigValue("dbhost", "localhost") var DBPort, _ = strconv.Atoi(GetConfigValue("dbport", "5432")) diff --git a/db/database.go b/db/database.go index 7f1149a..efb71ea 100644 --- a/db/database.go +++ b/db/database.go @@ -408,11 +408,6 @@ func InitInstance() error { if _, err := CreateNewBoard(*activitypub.CreateNewActor("", config.InstanceName, config.InstanceSummary, config.AuthReq, false)); err != nil { return util.MakeError(err, "InitInstance") } - - if config.PublicIndexing == "true" { - // TODO: comment out later - //AddInstanceToIndex(config.Domain) - } } return nil diff --git a/route/routes/main.go b/route/routes/main.go index 99dad31..a792cd2 100644 --- a/route/routes/main.go +++ b/route/routes/main.go @@ -24,16 +24,6 @@ func Index(ctx *fiber.Ctx) error { var data route.PageData - reqActivity := activitypub.Activity{Id: "https://fchan.xyz/followers"} - col, err := reqActivity.GetCollection() - if err != nil { - return util.MakeError(err, "Index") - } - - if len(col.Items) > 0 { - data.InstanceIndex = col.Items - } - data.NewsItems, err = db.GetNews(3) if err != nil { return util.MakeError(err, "Index") diff --git a/route/structs.go b/route/structs.go index 17deb25..87ffce3 100644 --- a/route/structs.go +++ b/route/structs.go @@ -19,7 +19,6 @@ type PageData struct { Key string PostId string Instance activitypub.Actor - InstanceIndex []activitypub.ObjectBase ReturnTo string NewsItems []db.NewsItem BoardRemainer []int diff --git a/util/proxy.go b/util/proxy.go index daa90b5..ed34a02 100644 --- a/util/proxy.go +++ b/util/proxy.go @@ -41,6 +41,8 @@ func MediaProxy(url string) string { func RouteProxy(req *http.Request) (*http.Response, error) { var proxyType = GetPathProxyType(req.URL.Host) + req.Header.Set("User-Agent", "FChannel/"+config.InstanceName) + if proxyType == "tor" { proxyUrl, err := url.Parse("socks5://" + config.TorProxy) diff --git a/views/index.html b/views/index.html index 00ebfb9..0a1ba18 100644 --- a/views/index.html +++ b/views/index.html @@ -1,6 +1,6 @@

{{ .page.Title }}

-

{{ .page.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.

+

{{ .page.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. Current known instances can be found here.

{{ if .page.Boards }} {{ $l := len .page.Boards }} @@ -39,18 +39,6 @@ {{ end }}
{{ end }} - -
-

Current known instances

- (always use a proxy) - - {{ range .page.InstanceIndex }} - - - - {{ end }} -
{{ .Id }}
-
{{ template "partials/footer" .page }} -- cgit v1.2.3