mirror of
https://github.com/mattermost/focalboard.git
synced 2024-11-27 08:31:20 +02:00
Linux app: set single-user token
This commit is contained in:
parent
93b9eac852
commit
89b8c0a18d
8
.vscode/launch.json
vendored
8
.vscode/launch.json
vendored
@ -20,6 +20,14 @@
|
||||
"program": "${workspaceFolder}/win",
|
||||
"cwd": "${workspaceFolder}/win/temp",
|
||||
},
|
||||
{
|
||||
"name": "Go: Launch Linux App",
|
||||
"type": "go",
|
||||
"request": "launch",
|
||||
"mode": "debug",
|
||||
"program": "${workspaceFolder}/linux",
|
||||
"cwd": "${workspaceFolder}/linux/dist/focalboard-app",
|
||||
},
|
||||
{
|
||||
"name": "Go: Test Current File",
|
||||
"type": "go",
|
||||
|
@ -2,4 +2,7 @@ module github.com/mattermost/focalboard/linux
|
||||
|
||||
go 1.15
|
||||
|
||||
require github.com/webview/webview v0.0.0-20200724072439-e0c01595b361
|
||||
require (
|
||||
github.com/google/uuid v1.2.0
|
||||
github.com/webview/webview v0.0.0-20200724072439-e0c01595b361
|
||||
)
|
||||
|
@ -1,2 +1,4 @@
|
||||
github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs=
|
||||
github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/webview/webview v0.0.0-20200724072439-e0c01595b361 h1:e0+/fQY5l9NdCwPsEg9S8AgE5lFhZ/6UX+b2KkpIBFg=
|
||||
github.com/webview/webview v0.0.0-20200724072439-e0c01595b361/go.mod h1:rpXAuuHgyEJb6kXcXldlkOjU6y4x+YcASKKXJNUhh0Y=
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user