'webserver' subcommand now respects the '--session' flag

This commit is contained in:
Alessio 2024-08-19 17:46:04 -07:00
parent 4990e7913d
commit 9c8c7cdf65
2 changed files with 12 additions and 1 deletions

View File

@ -35,6 +35,7 @@ func main() {
flag.BoolVar(show_version_flag, "v", false, "")
session_name := flag.String("session", "", "Name of session file to use")
flag.StringVar(session_name, "s", "", "")
how_many := flag.Int("n", 50, "")
flag.IntVar(how_many, "number", 50, "")
@ -521,6 +522,12 @@ func list_followed() {
func start_webserver(addr string, should_auto_open bool) {
app := webserver.NewApp(profile)
if api.UserHandle != "" {
err := app.SetActiveUser(api.UserHandle)
if err != nil {
die(err.Error(), false, -1)
}
}
app.Run(addr, should_auto_open)
}

View File

@ -157,7 +157,11 @@ func (app *Application) Run(address string, should_auto_open bool) {
app.start_background()
if should_auto_open {
go openWebPage("http://" + address + "/login")
page := "/login"
if app.ActiveUser != get_default_user() {
page = "" // Load the timeline
}
go openWebPage("http://" + address + page)
}
err := srv.ListenAndServe()
app.ErrorLog.Fatal(err)