1
0
mirror of https://github.com/mattermost/focalboard.git synced 2024-12-24 13:43:12 +02:00

Remove old windows app

This commit is contained in:
Chen-I Lim 2021-03-04 17:08:05 -08:00
parent d302e55fe9
commit 910ac3353e
8 changed files with 20 additions and 245 deletions

View File

@ -1,40 +0,0 @@
name: Build-Windows
on: workflow_dispatch
jobs:
windows:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Replace token 1
run: sed -i -e "s,placeholder_rudder_dataplane_url,${{ secrets.RUDDER_DATAPLANE_URL }},g" ${{ github.workspace }}/server/services/telemetry/telemetry.go
- name: Replace token 2
run: sed -i -e "s,placeholder_rudder_key,${{ secrets.RUDDER_DEV_KEY }},g" ${{ github.workspace }}/server/services/telemetry/telemetry.go
- name: win-node-env
run: npm install -g win-node-env
- name: npm install
run: cd webapp; npm install --no-optional
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.15
- name: Build Windows app
run: make win-app
env:
BUILD_NUMBER: ${{ github.run_id }}
- name: Upload app package
uses: actions/upload-artifact@v1
with:
name: focalboard-win.zip
path: ${{ github.workspace }}/win/dist/focalboard-win.zip

View File

@ -101,6 +101,9 @@ jobs:
- name: Replace token 2
run: sed -i -e "s,placeholder_rudder_key,${{ secrets.RUDDER_PROD_KEY }},g" ${{ github.workspace }}/server/services/telemetry/telemetry.go
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.0.2
- name: win-node-env
run: npm install -g win-node-env
@ -112,13 +115,21 @@ jobs:
with:
go-version: 1.15
- name: Build Windows app
run: make win-app
- name: Setup NuGet
uses: nuget/setup-nuget@v1
with:
nuget-version: '5.x'
- name: NuGet Restore
run: nuget restore win-wpf\Focalboard.sln
- name: Build Windows WPF app
run: make win-wpf-app
env:
BUILD_NUMBER: ${{ github.run_id }}
- name: Upload app package
uses: actions/upload-artifact@v1
with:
name: focalboard-win.zip
path: ${{ github.workspace }}/win/dist/focalboard-win.zip
name: focalboard.msix
path: ${{ github.workspace }}/win-wpf/focalboard.msix

View File

@ -1,4 +1,4 @@
.PHONY: prebuild clean cleanall ci server server-mac server-linux server-win server-linux-package generate watch-server webapp mac-app win-app linux-app
.PHONY: prebuild clean cleanall ci server server-mac server-linux server-win server-linux-package generate watch-server webapp mac-app win-app-wpf linux-app
PACKAGE_FOLDER = focalboard
@ -106,21 +106,6 @@ mac-app: server-mac webapp
cp webapp/NOTICE.txt mac/dist/webapp-NOTICE.txt
cd mac/dist; zip -r focalboard-mac.zip Focalboard.app MIT-COMPILED-LICENSE.md NOTICE.txt webapp-NOTICE.txt
win-app: server-win webapp
rm -rf win/temp
rm -rf win/dist
cd win; make build
mkdir -p win/temp
cp bin/win/focalboard-server.exe win/temp
cp app-config.json win/temp/config.json
cp build/MIT-COMPILED-LICENSE.md win/temp
cp NOTICE.txt win/temp
cp webapp/NOTICE.txt win/temp/webapp-NOTICE.txt
cp -R webapp/pack win/temp/pack
mkdir -p win/dist
# cd win/temp; tar -acf ../dist/focalboard-win.zip .
cd win/temp; powershell "Compress-Archive * ../dist/focalboard-win.zip"
win-wpf-app: server-dll webapp
cd win-wpf && ./build.bat && ./package.bat
@ -159,7 +144,8 @@ clean:
rm -rf mac/temp
rm -rf mac/dist
rm -rf linux/dist
rm -rf win/dist
rm -rf win-wpf/msix
rm win-wpf/focalboard.msix
cleanall: clean
rm -rf webapp/node_modules

View File

@ -48,8 +48,8 @@ You can build standalone apps that package the server to run locally against SQL
* Windows:
* Open a git-bash prompt
* Install win-node-env `npm install -g win-node-env`
* `make win-app`
* run `win/dist/focalboard.exe`
* `make win-wpf-app`
* run `cd win-wpf/msix && focalboard.exe`
* *Requires: Windows 10*
Cross-compilation currently isn't fully supported, so please build on the appropriate platform. Refer to the GitHub Actions workflows (build-mac.yml, build-win.yml, build-ubuntu.yml) for the detailed list of steps on each platform.

View File

@ -1,10 +0,0 @@
.PHONY: run build
run:
go run ./main.go
build:
mkdir -p dist
# env GOOS=windows GOARCH=amd64 go build -ldflags="-H windowsgui" -o dist/focalboard.exe
# env GOOS=windows GOARCH=amd64 go build -ldflags -H=windowsgui -o dist/focalboard.exe
env GOOS=windows GOARCH=amd64 go build -o temp/focalboard.exe

View File

@ -1,9 +0,0 @@
module github.com/mattermost/focalboard/win
go 1.15
require (
github.com/gonutz/w32 v1.0.0
github.com/google/uuid v1.2.0
github.com/zserge/lorca v0.1.10-0.20200301195127-a3e43396a47e
)

View File

@ -1,19 +0,0 @@
github.com/gonutz/w32 v1.0.0 h1:3t1z6ZfkFvirjFYBx9pHeHBuKoN/VBVk9yHb/m2Ll/k=
github.com/gonutz/w32 v1.0.0/go.mod h1:Rc/YP5K9gv0FW4p6X9qL3E7Y56lfMflEol1fLElfMW4=
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/zserge/lorca v0.1.9 h1:vbDdkqdp2/rmeg8GlyCewY2X8Z+b0s7BqWyIQL/gakc=
github.com/zserge/lorca v0.1.9/go.mod h1:bVmnIbIRlOcoV285KIRSe4bUABKi7R7384Ycuum6e4A=
github.com/zserge/lorca v0.1.10-0.20200301195127-a3e43396a47e h1:RqKGfaG8v1WBC6JX5vhG7GocwY1lENlMiraQibyGRsY=
github.com/zserge/lorca v0.1.10-0.20200301195127-a3e43396a47e/go.mod h1:bVmnIbIRlOcoV285KIRSe4bUABKi7R7384Ycuum6e4A=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20200222125558-5a598a2470a0 h1:MsuvTghUPjX762sGLnGsxC3HM0B5r83wEtYcYR8/vRs=
golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210119194325-5f4716e94777 h1:003p0dJM77cxMSyCPFphvZf/Y5/NXf5fzg6ufd1/Oew=
golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=

View File

@ -1,144 +0,0 @@
package main
import (
"context"
"fmt"
"log"
"os"
"os/exec"
"runtime"
"github.com/gonutz/w32"
"github.com/google/uuid"
"github.com/zserge/lorca"
)
var sessionToken string = "su-" + uuid.New().String()
func runServer(ctx context.Context) *exec.Cmd {
// cmd := exec.CommandContext(ctx, "focalboard-server.exe", "--monitorpid", strconv.FormatInt(int64(os.Getpid()), 10), "-single-user")
cmd := exec.CommandContext(ctx, "focalboard-server.exe", "-single-user")
// cmd := exec.CommandContext(ctx, "cmd.exe", "/C", "start", "./bin/focalboard-server.exe", "--monitorpid", strconv.FormatInt(int64(os.Getpid()), 10))
// cmd := exec.CommandContext(ctx, "cmd.exe", "/C", "start", "./bin/focalboard-server.exe")
// cmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true}
cmd.Env = []string{fmt.Sprintf("FOCALBOARD_SINGLE_USER_TOKEN=%s", sessionToken)}
cmd.Stdout = os.Stdout
go func() {
err := cmd.Run()
if err != nil {
log.Println("Failed to start server")
log.Fatal(err)
}
log.Printf("Just ran subprocess %d, exiting\n", cmd.Process.Pid)
}()
return cmd
}
func main() {
// log.Printf("PID: %s", strconv.FormatInt(int64(os.Getpid()), 10))
hideConsole()
// Try to find Chrome if Lorca can't find it
if len(lorca.ChromeExecutable()) == 0 {
chromePath := locateChrome()
log.Printf("chromePath: %s", chromePath)
if len(chromePath) > 0 {
os.Setenv("LORCACHROME", chromePath)
} else {
lorca.PromptDownload()
log.Fatal("Chrome not installed")
}
}
ctx, cancel := context.WithCancel(context.Background())
cmd := runServer(ctx)
defer func() {
log.Println("Cleanup")
cancel()
if err := cmd.Process.Kill(); err != nil {
log.Fatal("failed to kill server process: ", err)
}
if r := recover(); r != nil {
log.Fatal("ERROR: ", r)
}
}()
ui, err := lorca.New("", "", 1024, 768)
if err != nil {
log.Panic(err)
}
defer ui.Close()
if err := ui.Load("http://localhost:8088"); err != nil {
log.Panic(err)
}
script := fmt.Sprintf("localStorage.setItem('sessionId', '%s');", sessionToken)
value := ui.Eval(script)
if err := value.Err(); err != nil {
log.Panic(err)
}
log.Printf("Started")
<-ui.Done()
log.Println("App Closed")
}
func hideConsole() {
console := w32.GetConsoleWindow()
if console != 0 {
_, consoleProcID := w32.GetWindowThreadProcessId(console)
if w32.GetCurrentProcessId() == consoleProcID {
w32.ShowWindowAsync(console, w32.SW_HIDE)
}
}
}
// This duplicates the logic in Lorca, but adds Edge as an option for Windows, fallback to standard logic for other OSes
func locateChrome() string {
var paths []string
switch runtime.GOOS {
// case "darwin":
// paths = []string{
// "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
// "/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary",
// "/Applications/Chromium.app/Contents/MacOS/Chromium",
// "/usr/bin/google-chrome-stable",
// "/usr/bin/google-chrome",
// "/usr/bin/chromium",
// "/usr/bin/chromium-browser",
// }
case "windows":
paths = []string{
os.Getenv("LocalAppData") + "/Google/Chrome/Application/chrome.exe",
os.Getenv("ProgramFiles") + "/Google/Chrome/Application/chrome.exe",
os.Getenv("ProgramFiles(x86)") + "/Google/Chrome/Application/chrome.exe",
os.Getenv("LocalAppData") + "/Chromium/Application/chrome.exe",
os.Getenv("ProgramFiles") + "/Chromium/Application/chrome.exe",
os.Getenv("ProgramFiles(x86)") + "/Chromium/Application/chrome.exe",
os.Getenv("ProgramFiles(x86)") + "/Microsoft/Edge/Application/msedge.exe",
}
// default:
// paths = []string{
// "/usr/bin/google-chrome-stable",
// "/usr/bin/google-chrome",
// "/usr/bin/chromium",
// "/usr/bin/chromium-browser",
// "/snap/bin/chromium",
// }
}
for _, path := range paths {
if _, err := os.Stat(path); os.IsNotExist(err) {
continue
}
return path
}
return ""
}