shithub: hell

Download patch

ref: 40b380a7a4bb3ded2d29cf0a415b49660dc7c454
parent: 3ea29357e9eb81b737771148c22b6aff39031b7e
author: penny <penny@limitedideas.org>
date: Tue Nov 11 19:59:24 EST 2025

fix account logins

--- a/config.go
+++ b/config.go
@@ -113,8 +113,8 @@
 	// Check if the config file exists
 	if _, err = os.Stat(configpath); os.IsNotExist(err) {
 		// no config, create account
-		client := ConfigureClient()
-		first_account.URL = "https://eldritch.cafe"
+		client, url := ConfigureClient()
+		first_account.URL =url
 		first_account.MASTODON_CLIENT_ID = client.Config.ClientID
 		first_account.MASTODON_CLIENT_SECRET = client.Config.ClientSecret
 		first_account.MASTODON_ACCESS_TOKEN = client.Config.AccessToken
--- a/hellclient.go
+++ b/hellclient.go
@@ -138,11 +138,14 @@
 		}
 
 		initReferenceSystem()
-
-		lastReadID := markers["home"].LastID
-		statuses, err := hc.GetStatusesSince(lastReadID, hc.client.GetTimelineHome)
-		if err != nil {
-			return
+		marker, readOK := markers["home"]
+		var statuses []*mastodon.Status
+		if readOK {
+			lastReadID := marker.LastID
+			statuses, err = hc.GetStatusesSince(lastReadID, hc.client.GetTimelineHome)
+			if err != nil {
+				return
+			}
 		}
 		if len(statuses) > 0 {
 			hc.updateReadMarker(&statuses[len(statuses)-1].ID, "home")
--- a/mastodon.go
+++ b/mastodon.go
@@ -12,7 +12,7 @@
 	"github.com/k3a/html2text"
 )
 
-func ConfigureClient() *mastodon.Client {
+func ConfigureClient() (*mastodon.Client, string) {
 	appConfig := &mastodon.AppConfig{
 		Server:       "",
 		ClientName:   "hellclient",
@@ -39,7 +39,7 @@
 	fmt.Scanln(&userAuthorizationCode)
 
 	config := &mastodon.Config{
-		Server:       "https://eldritch.cafe",
+		Server:       appConfig.Server,
 		ClientID:     app.ClientID,
 		ClientSecret: app.ClientSecret,
 	}
@@ -53,7 +53,7 @@
 		log.Fatal(err)
 	}
 
-	return c
+	return c, appConfig.Server
 }
 
 func initClient(account *mastodon_account) *mastodon.Client {
--