Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
willie68 committed Aug 10, 2021
2 parents 322d74a + daa0ed0 commit b560986
Show file tree
Hide file tree
Showing 42 changed files with 8,928 additions and 7,643 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ service/cmd/__debug_bin
3rd party/open-cue-service/
webclient/RecosUI/public/assets/
webclient/recosadmin/public/assets/
webclient/recoscli2/**

*.syso
*.bak
Expand All @@ -32,6 +33,7 @@ service/devdata/sessions/sessions/

service/web/webadmin/
service/web/webclient/
service/web/webclient2/

service/recos-service.zip

Expand All @@ -51,3 +53,4 @@ integrations/streamdeck/StreamDeckService.zip
3rd party/PSTools.zip

integrations/streamdeck/StreamDeckService/StreamDeckService.csproj.user

8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,19 @@ http://localhost:9280/webclient on the same computer.

<img src="documentation/assets/webclient.png" alt="webclient" style="zoom:50%;" />

The client has a small toolbar and a big button area, presenting the different actions. But let us start at the very beginning. First, everything is organized in a **profile**. You can have different profiles for different clients, or different scenarios. One client can only present one profile at a time, but you can have different profiles in different browser open. As an example, you can have a special profile for your Phone and another for the Pad and a really big one for the PC. And all can be active at the same time. But to emphasize again, you can of course also operate the same profile on 2 different devices at the same time. When starting the client, the first profile is selected. You can select profiles using the Profile Combobox.
The client has a a big button area, presenting the different actions. But let us start at the very beginning. First, everything is organized in a **profile**. You can have different profiles for different clients, or different scenarios. One client can only present one profile at a time, but you can have different profiles in different browser open. As an example, you can have a special profile for your Phone and another for the Pad and a really big one for the PC. And all can be active at the same time. But to emphasize again, you can of course also operate the same profile on 2 different devices at the same time. When starting the client, the first profile is selected. You can select profiles using the Profile Combobox in the settings page. To open it simply press the button in the upper right corner.

Each profile has different **pages** for further structuring. When the client starts, the first page is automatically selected. A page then consists of rows and columns. You can set the size in the Admin Client. The more rows and columns you have, the smaller the individual actions become. The page adapts its actions to the possible space. Pages can be changed directly via the toolbar (shown as buttons) or via special actions. Whether a page appears at the top of the bar can be set in the page configuration. If the page has no icon, only the name is displayed.
<img src="documentation/assets/client_settings.png" alt="webclient" style="zoom:50%;" />

Each profile has different **pages** for further structuring. When the client starts, the first page is automatically selected. A page then consists of rows and columns. You can set the size in the Admin Client. The more rows and columns you have, the smaller the individual actions become. The page adapts its actions to the possible space. Pages can be changed directly via the settings (shown as buttons) or via special actions. Whether a page appears in the settings dialog it can be set in the page configuration. If the page has no icon, only the name is displayed.

In the client area you will see 2 types of buttons and maybe some empty space. First, all buttons with the gray background are buttons that you can press. (**Single** Action)This is the default behavior. On Press the underlying commands will be executed on the computer where the service is running.

The buttons with the black background are for display purposes only. (**Display** Action) System states or other parameters are displayed there.

The empty fields are waiting for you so that you can store something there.

If you see a field with the red warning Action not defined, there is a misconfiguration. You may have deleted an action, but not removed it from the button.
If you see a field with the red warning "Action not defined", there is a misconfiguration. You may have deleted an action, but not removed it from the button.

<img src="documentation/assets/action_not_found.png" alt="action_not_found" style="zoom: 50%;" />

Expand Down
2 changes: 2 additions & 0 deletions build_all.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
".\3rd party\GoVersionSetter.exe" -i
".\3rd party\GoVersionSetter.exe" -e npm -f ./webclient/recosadmin/package.json
".\3rd party\GoVersionSetter.exe" -e npm -f ./webclient/RecosUI/package.json
".\3rd party\GoVersionSetter.exe" -e npm -f ./webclient/recoscli2/package.json
".\3rd party\GoVersionSetter.exe" -e iss -f ./install/setup.iss -o MyAppVersion
".\3rd party\GoVersionSetter.exe" -e vs -f ./integrations/streamdeck/StreamDeckService/StreamDeckService.csproj
".\3rd party\GoVersionSetter.exe" -e gores -f ./service/winres/winres.json -o RT_MANIFEST/#1/0409/identity/version,RT_VERSION/#1/0000/fixed/file_version,RT_VERSION/#1/0000/fixed/product_version,RT_VERSION/#1/0000/info/0409/ProductVersion,RT_VERSION/#1/0000/info/0409/FileVersion
".\3rd party\GoVersionSetter.exe" -e go -f ./service/web/version/version.json

call sync_assets.cmd

Expand Down
Binary file modified documentation/README.pdf
Binary file not shown.
Binary file added documentation/assets/client_settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified documentation/assets/taskbar_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified documentation/assets/webclient.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion install/setup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#define MyAppName "ReCoS"
;version number set by GoVersionSetter.
#define MyAppVersion "0.3.90"
#define MyAppVersion "0.3.97"
#define MyAppPublisher "MCS Media Computer Software"
#define MyAppURL "https://www.wk-music.de"
#define MyAppExeName "recos-service.exe"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<TargetFramework>net5.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<ApplicationIcon>sd_logo.ico</ApplicationIcon>
<Version>0.3.90</Version>
<Version>0.3.97</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions release_build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
".\3rd party\GoVersionSetter.exe" -e iss -f ./install/setup.iss -o MyAppVersion
".\3rd party\GoVersionSetter.exe" -e vs -f ./integrations/streamdeck/StreamDeckService/StreamDeckService.csproj
".\3rd party\GoVersionSetter.exe" -e gores -f ./service/winres/winres.json -o RT_MANIFEST/#1/0409/identity/version,RT_VERSION/#1/0000/fixed/file_version,RT_VERSION/#1/0000/fixed/product_version,RT_VERSION/#1/0000/info/0409/ProductVersion,RT_VERSION/#1/0000/info/0409/FileVersion
".\3rd party\GoVersionSetter.exe" -e go -f ./service/web/version/version.json

call sync_assets.cmd

Expand Down
6 changes: 1 addition & 5 deletions service/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@
"version": "0.2.0",
"configurations": [





{
{
"name": "Launch",
"type": "go",
"request": "launch",
Expand Down
72 changes: 44 additions & 28 deletions service/api/routes/profilesapi.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
package routes

import (
"archive/zip"
"bytes"
"encoding/json"
"fmt"
"log"
"net/http"
"sort"
"strings"

"github.com/go-chi/chi"
"github.com/go-chi/render"
"gopkg.in/yaml.v3"
"wkla.no-ip.biz/remote-desk-service/api"
"wkla.no-ip.biz/remote-desk-service/api/handler"
"wkla.no-ip.biz/remote-desk-service/config"
Expand All @@ -31,6 +27,7 @@ func ProfilesRoutes() *chi.Mux {
router.Get("/{profileName}", GetProfile)
router.With(handler.AuthCheck()).Delete("/{profileName}", DeleteProfile)
router.Get("/{profileName}/export", GetExportProfile)
router.Get("/{profileName}/actions/{actionName}/export", GetExportAction)
return router
}

Expand Down Expand Up @@ -192,45 +189,64 @@ func GetExportProfile(response http.ResponseWriter, request *http.Request) {
return
}

// Create a buffer to write our archive to.
buf := new(bytes.Buffer)

// Create a new zip archive.
w := zip.NewWriter(buf)

filename := fmt.Sprintf("%s.yaml", profileName)
body, err := yaml.Marshal(profile)
body, err := json.Marshal(profile)
if err != nil {
clog.Logger.Debug("Error reading profile: \n" + err.Error())
api.Err(response, request, err)
return
}

f, err := w.Create(filename)
response.Header().Add("Content-Disposition", fmt.Sprintf("attachment; filename=\"%s.profile\"", profileName))
render.Data(response, request, body)
}

func getProfile(profileName string) (models.Profile, bool) {

for _, profile := range config.Profiles {
if strings.EqualFold(profile.Name, profileName) {
return profile, true
}
}
return models.Profile{}, false
}

// GetExportAction exporting a action from a profile as a file
func GetExportAction(response http.ResponseWriter, request *http.Request) {
profileName, err := api.Param(request, "profileName")
if err != nil {
log.Fatal(err)
clog.Logger.Debug("Error reading profile name: \n" + err.Error())
api.Err(response, request, err)
return
}
_, err = f.Write(body)

profile, ok := getProfile(profileName)
if !ok {
clog.Logger.Debugf("Profile %s not found", profileName)
api.NotFound(response, request, "profile", profileName)
return
}

actionName, err := api.Param(request, "actionName")
if err != nil {
log.Fatal(err)
clog.Logger.Debug("Error reading action name: \n" + err.Error())
api.Err(response, request, err)
return
}

// Make sure to check the error on Close.
err = w.Close()
action, err := profile.GetAction(actionName)
if err != nil {
clog.Logger.Debug("Error writing profile: \n" + err.Error())
clog.Logger.Debug("Error getting action: \n" + err.Error())
api.Err(response, request, err)
return
}
response.Header().Add("Content-Disposition", fmt.Sprintf("attachment; filename=\"%s.zip\"", profileName))
render.Data(response, request, buf.Bytes())
}

func getProfile(profileName string) (models.Profile, bool) {
for _, profile := range config.Profiles {
if strings.EqualFold(profile.Name, profileName) {
return profile, true
}
body, err := json.Marshal(action)
if err != nil {
clog.Logger.Debug("Error serialising action: \n" + err.Error())
api.Err(response, request, err)
return
}
return models.Profile{}, false

response.Header().Add("Content-Disposition", fmt.Sprintf("attachment; filename=\"%s.action\"", actionName))
render.Data(response, request, body)
}
66 changes: 52 additions & 14 deletions service/cmd/Service.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"context"
"crypto/md5"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
Expand Down Expand Up @@ -162,6 +163,7 @@ func main() {
}
running := true
startTime := time.Now()
count := 0
for running {
running = false
resp, _ := http.Get(fmt.Sprintf("http://127.0.0.1:%d/health/readyz", statPort))
Expand All @@ -170,13 +172,15 @@ func main() {
status = resp.Status
running = true
}
fmt.Printf("status: %s", status)
if time.Since(startTime) >= 100*time.Second {
panic("old process is not exiting")
}
if running {
time.Sleep(time.Second)
}
if count%60 == 0 {
fmt.Printf("service already running, waitung to stop, status: %s", status)
}
}
}
systray.Run(onReady, onExit)
Expand Down Expand Up @@ -635,18 +639,52 @@ func getApikey() string {
}

func checkVersion() {
name, err := os.Hostname()
if err != nil {
name = "n.n."
}
clog.Logger.Infof("Hostname: %s", name)
url := fmt.Sprintf("http://wkla.no-ip.biz/willie/downloader/version.php?ID=%d&AppUUID=\"%s\"&host=\"%s\"", serviceConfig.AppID, serviceConfig.AppUUID, name)
resp, err := http.Get(url)
if err != nil {
clog.Logger.Alertf("error connectiing to version service: %v", err)
}
if resp.StatusCode != 200 {
clog.Logger.Errorf("can'T connect to: \"%s\"\r\n%v", url, resp.Status)
}
versionStr := web.VersionJson
var thisVersion config.Version

json.Unmarshal([]byte(versionStr), &thisVersion)
go func() {
background := time.NewTicker(time.Second * time.Duration(60))
for _ = range background.C {
name, err := os.Hostname()
if err != nil {
name = "n.n."
}
clog.Logger.Infof("Hostname: %s", name)
url := fmt.Sprintf("http://wkla.no-ip.biz/willie/downloader/version.php?ID=%d&AppUUID=\"%s\"&host=\"%s\"", serviceConfig.AppID, serviceConfig.AppUUID, name)
resp, err := http.Get(url)
if err != nil {
clog.Logger.Alertf("error connecting to version service: %v", err)
continue
}
if resp.StatusCode != 200 {
clog.Logger.Errorf("can't connect to: \"%s\"\r\n%v", url, resp.Status)
continue
}
data, err := ioutil.ReadAll(resp.Body)
if err != nil {
clog.Logger.Errorf("Error loading version: %v", err)
return
}
var srvVersion map[string]interface{}
err = json.Unmarshal(data, &srvVersion)
if err != nil {
clog.Logger.Errorf("Error unmarshalling version: %v", err)
return
}
version, err := config.ParseVersion(srvVersion["version"].(string))
if err != nil {
clog.Logger.Errorf("Error parsing version: %v", err)
return
}
if version.Patch == 0 {
version.Patch = version.Minor
version.Minor = 0
}
if version.IsGreaterThan(thisVersion) {
clog.Logger.Infof("New version availble: %s", version.String())
}
background.Stop()
}
}()
}
Loading

0 comments on commit b560986

Please sign in to comment.