This repository has been archived by the owner on Oct 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v0.4.4: LatestRelease <- Development
- Loading branch information
Showing
13 changed files
with
145 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ example/generate | |
*.android | ||
*.linux | ||
example/resource.syso | ||
go.work.sum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,120 @@ | ||
# go-local-web-example | ||
(This readme is a duplicate of go-local-web-gui) | ||
|
||
go-local-web (GOLW) is a simple framework made for developing localhosted software that can reuse chrome/chromium or embed chromium (in future releases). Both available in deployment for the applications. | ||
|
||
This framework uses Chrome (Windows) or Chromium (Linux) as frontend by opening them with cmd/terminal and hosting a localhost webserver, while opening chrome/chromium with --app and --user-directory arguments. The frontend can be changed by the user in runtime, while the backend needs to be compiled/build. The API can be decoupled in future versions, so every part of the application is changeable - Sustainable development. Frontends is easy to change. Alternatives to this is embedding a chromium or webview framework into the project, which will require more space. I chose to depend on Chrome/Chromium, as they are market leaders and html/css/javascript technology frontrunners. | ||
|
||
Feel free to use this piece of software, I will be happy to assist you | ||
|
||
I am currently working on this project, it will be updated and maintained. I consider it production ready. | ||
|
||
This project is used by Beksoft ApS for projects such as: | ||
* BekCMS | ||
* (name not announced yet) Password Manager | ||
* PingPong Game made in Three.js | ||
* Several local webbased software projects | ||
|
||
Write to me at [email protected] if you want to have your project listed | ||
|
||
## Requirements to developers | ||
Go 1.19+ | ||
Chrome (Windows) or Chromium (Linux) | ||
|
||
## Requirements for users | ||
Chrome (Windows) or Chromium (Linux) | ||
|
||
## How to use (download example project) | ||
The best way to start using the project is to download the example project at: | ||
https://github.com/NineNineFive/go-local-web-example | ||
|
||
This example project uses this package and combines it with a local api | ||
Then the Go api is being developed and customized by you together with the frontend (JavaScript, HTML, CSS) | ||
|
||
## How to use (with go get) | ||
first run the following in CMD (with go installed) | ||
<code>go get github.com/NineNineFive/go-local-web-gui</code> | ||
Example: how to add framework to main.go | ||
<pre> | ||
package main | ||
|
||
import ( | ||
"github.com/NineNineFive/go-local-web-gui/fileserver" | ||
"github.com/NineNineFive/go-local-web-gui/launcher" | ||
"net/http" | ||
"os" | ||
"runtime" | ||
) | ||
|
||
// For windows we need a organisation name and project name | ||
var organisationName = "NewOrganisationName" // put in organisation name | ||
var projectName = "NewProjectName" // put in project name | ||
|
||
var frontendPath = "./frontend" // this should be set to where frontend files is (frontend folder: html, css, javascript...) | ||
|
||
// remember to change the ports to something unique | ||
var chromeLauncher = launcher.ChromeLauncher{ | ||
Location: "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe", | ||
LocationCMD: "C:\\\"Program Files\"\\Google\\Chrome\\Application\\chrome.exe", | ||
FrontendInstallLocation: os.Getenv("localappdata") + "\\Google\\Chrome\\InstalledApps\\" + organisationName + "\\" + projectName, | ||
Domain: "localhost", | ||
PortMin: 11430, | ||
PreferredPort: 11451, | ||
PortMax: 11500, | ||
} | ||
|
||
var chromiumLauncher = launcher.DefaultChromiumLauncher // default chrome or chromium launcher settings can be used like this | ||
/* // Otherwise they can also be customized like this | ||
var chromiumLauncher = launcher.ChromiumLauncher{ | ||
Location: "/var/lib/snapd/desktop/applications/chromium_chromium.desktop", // TODO: check if better location or can be customised | ||
Domain: "localhost", | ||
PortMin: 11430, | ||
PreferredPort: 11451, | ||
PortMax: 11500, | ||
} | ||
*/ | ||
|
||
func main() { | ||
launchApp() | ||
} | ||
|
||
func initHTTPHandlers() { | ||
// static fileserver | ||
http.HandleFunc("/", fileserver.ServeFileServer) | ||
|
||
// api (local api can be added) | ||
//http.HandleFunc("/api/", api.ServeAPIUseGZip) | ||
} | ||
|
||
func launchApp() { | ||
switch runtime.GOOS { | ||
case "windows": | ||
initHTTPHandlers() | ||
launcher.StartFrontendAndBackendWindows(frontendPath, chromeLauncher) | ||
return | ||
case "darwin": // "mac" | ||
panic("Darwin Not Supported Yet") | ||
return | ||
case "linux": // "linux" | ||
initHTTPHandlers() | ||
launcher.StartFrontendAndBackendLinux(frontendPath, chromiumLauncher) | ||
return | ||
default: // "freebsd", "openbsd", "netbsd" | ||
initHTTPHandlers() | ||
launcher.StartFrontendAndBackendLinux(frontendPath, chromiumLauncher) | ||
return | ||
} | ||
} | ||
</pre> | ||
|
||
## How to run | ||
<code>go run main.go</code> | ||
|
||
## How to apply manifest and logo to executible | ||
Use something like goversioninfo: https://github.com/josephspurrier/goversioninfo | ||
|
||
## How to build | ||
<code>go build -ldflags -H=windowsgui -o NewProjectName.exe</code> | ||
|
||
## How to make setup file and update functionality | ||
Coming later |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module api | ||
go 1.19 // go version should be minimum 1.18 |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
module go-local-web-gui | ||
module GoLWExample | ||
|
||
go 1.19 | ||
|
||
require github.com/NineNineFive/go-local-web-gui v0.4.3 // indirect | ||
require github.com/NineNineFive/go-local-web-gui v0.4.9 // indirect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
use . | ||
use ./backend/go-local-web-api/ | ||
use ./backend/go-local-web-api/example | ||
use ./backend/api | ||
use ./backend/api/example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters