1
0
mirror of https://github.com/mattermost/focalboard.git synced 2025-07-15 23:54:29 +02:00

Linux app: set single-user token

This commit is contained in:
Chen-I Lim
2021-02-09 15:46:49 -08:00
parent 93b9eac852
commit 89b8c0a18d
4 changed files with 43 additions and 22 deletions

View File

@ -2,16 +2,20 @@ package main
import (
"context"
"fmt"
"log"
"os"
"os/exec"
"strconv"
"github.com/google/uuid"
"github.com/webview/webview"
)
var sessionToken string = "su-" + uuid.New().String()
func runServer(ctx context.Context) {
cmd := exec.CommandContext(ctx, "./focalboard-server", "--monitorpid", strconv.FormatInt(int64(os.Getpid()), 10), "--single-user")
cmd := exec.CommandContext(ctx, "./focalboard-server", "--monitorpid", strconv.FormatInt(int64(os.Getpid()), 10), "-single-user", sessionToken)
cmd.Stdout = os.Stdout
err := cmd.Run()
if err != nil {
@ -29,6 +33,10 @@ func main() {
w.SetTitle("Focalboard")
w.SetSize(1024, 768, webview.HintNone)
script := fmt.Sprintf("localStorage.setItem('sessionId', '%s');", sessionToken)
w.Init(script)
w.Navigate("http://localhost:8088")
w.Run()
cancel()