diff options
author | FChannel <> | 2022-06-25 11:33:24 -0700 |
---|---|---|
committer | FChannel <> | 2022-06-25 11:38:15 -0700 |
commit | c2de9971e9d5f1408083f0d131818e16430238d2 (patch) | |
tree | 0f1892d081039145d31d4ff4169106ba988ab7a7 | |
parent | b1d65922e257d605d3d95b6e679728524ba1e609 (diff) |
removed public indexing being dependent on fchan being available
-rw-r--r-- | README.md | 8 | ||||
-rw-r--r-- | config-init | 3 | ||||
-rw-r--r-- | config/config.go | 1 | ||||
-rw-r--r-- | db/database.go | 5 | ||||
-rw-r--r-- | route/routes/main.go | 10 | ||||
-rw-r--r-- | route/structs.go | 1 | ||||
-rw-r--r-- | util/proxy.go | 2 | ||||
-rw-r--r-- | views/index.html | 14 |
8 files changed, 8 insertions, 36 deletions
@@ -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 @@ <div style="text-align: center; max-width: 800px; margin: 0 auto;"> <h1>{{ .page.Title }}</h1> - <p style="text-align: justify">{{ .page.PreferredUsername }} is a federated image board based on <a href="https://activitypub.rocks/">ActivityPub</a>. 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: <a href="https://github.com/FChannel0">https://github.com/FChannel0</a>.</p> + <p style="text-align: justify">{{ .page.PreferredUsername }} is a federated image board based on <a href="https://activitypub.rocks/">ActivityPub</a>. 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: <a href="https://github.com/FChannel0">https://github.com/FChannel0</a>. Current known instances can be found <a href="https://fchannel.org/instance-index.html">here</a>.</p> {{ if .page.Boards }} {{ $l := len .page.Boards }} @@ -39,18 +39,6 @@ {{ end }} </div> {{ end }} - - <div class="box2" style="margin-top:50px;"> - <h4 style="margin-bottom:5px;">Current known instances</h4> - <span>(always use a proxy)</span> - <table style="text-align: left; margin: 25px;"> - {{ range .page.InstanceIndex }} - <tr> - <td><a href="{{ .Id }}">{{ .Id }}</a></td> - </tr> - {{ end }} - </table> - </div> </div> {{ template "partials/footer" .page }} |