Giter Site home page Giter Site logo

energye / energy Goto Github PK

View Code? Open in Web Editor NEW
305.0 8.0 19.0 28.78 MB

Energy is a framework developed by Go language based on CEF (Chromium Embedded Framework) for developing cross-platform desktop applications for Windows, Mac OS X, and Linux

Home Page: https://energy.yanghy.cn

License: Apache License 2.0

Go 99.49% Batchfile 0.05% Makefile 0.02% Roff 0.13% Raku 0.01% NSIS 0.22% Shell 0.07%
go golang linux macos windows browser v8 cef chromium macosx

energy's Introduction

Energy is a GUI framework developed by Go, based on LCL and CEF

中文 | English


go-version github release Build Status repo Go Report Go Reference codecov contributors license

  • Energy is a GUI framework developed in Go, based on LCL and CEF(Chromium Embedded Framework), which is used to develop cross-platform desktop applications for Windows, MacOS, and Linux.
  • LCL alone can create lightweight native applications, or can be combined with CEF to create more feature-complete applications.
  • Construct cross-platform desktop applications that support Windows, Linux, and MacOS using Go and web technologies (HTML + CSS + JavaScript).

Characteristic

  • Rich CEF API and LCL system native widgets
  • Development environment is simple and the compilation speed is fast. Only need Go and Energy.
  • Cross-Platform: You can package your code as Windows, domestic UOS, Deepin, Kylin, MacOS and Linux
  • Responsibilities
    • Go: Go is responsible for creating Windows, configuring CEF and implementing functions, creating various UI components, calling the low level of the system and some functions that JS cannot handle, such as: file flow, security encryption, high-performance processing, etc.
    • Web: HTML + CSS + JavaScript is responsible for the function of the client interface, you can make any interface you want.
  • Front-end technology: Support mainstream frameworks, such as Vue, React, Angular or pure HTML+CSS+JS.
  • Event driven: High performance event driven communication based on IPC allowing intercommunication between Go and Web.
  • Resource loading: You can either read local resources or resources built into execution files either with or without HTTP services.

Built-in dependency&integration

  • LCL
  • CEF-CEF4Delphi

Basic needs

  • Golang >= 1.18
  • Energy (CEF, liblcl)

Environmental installation

Automatic installation development environment using the energy command-line tool

Guide to Start - Link

Quick Start

  • Using energy command line tools to install the complete development environment automatically.

Run a simple application by three steps

  1. Install development environment: energy install .
  2. Initiate an Application: energy init .
  3. Run the Application: go run main.go

sample code

main.go

package main

import (
	"github.com/energye/energy/v2/cef"
)

func main() {
	//Global initialization
	cef.GlobalInit(nil, nil)
	//Create an application
	app := cef.NewApplication()
	//Specify a URL address or local HTML file directory
	cef.BrowserWindow.Config.Url = "https://energy.yanghy.cn"
	//Run Application
	cef.Run(app)
}

Build

  1. Build:energy build .
  2. Package:energy package .
  3. Package Type:
    • windows: Using nsis create exe installation package
    • linux: Using dpkg create deb installation package
    • macos: Generate xxx.app

System support

Windows MacOS Linux

32 Bit 64 Bit Test System Version
Windows Windows Windows Windows XP SP3、 7、10、11
MacOSX MacOSX MacOSX MacOSX 10.15
MacOS M1 M2 MacOS MacOS MacOS M2
Linux Linux Linux Deepin20.8、Ubuntu18.04、LinuxMint21
Linux ARM Linux ARM Linux ARM Kylin-V10-SP1-2107

Related Projects


Welcome to join

join energy throwing in the process of construction, there are many things that cannot be completed alone, if there are interested students who want to participate in the realization or learning of energy, you can contact me through WeChat or QQ.

If this project is helpful to you, please give me a star


ENERGY QQ Group & WeChat

QQ Group: 541258627 WeChat: sniawmdf


Thanks Jetbrains

JetBrains Logo (Main) logo.


Project screenshot

Windows-10

Windows-7 32 & 64

Windows-XP-SP3

Linux - Deepin

Linux - Kylin ARM

Linux - Ubuntu

MacOSX


Public License

license

Contributors

energy's People

Contributors

barremian avatar sxmxta avatar zhangli10 avatar zhaojunliing avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

energy's Issues

v1.107.1.11 later, Linux Bug, GTK2 and GTK3 coexist

v1.107.1.11, failed to start properly under linux due to the co-existence of GTK2 and GTK3, which required an upstream fix to resolve.

You can install the previous version of the environment by command

energy install -v=v1.106.1.1 .

[bug] a fatal error when create a new browser window

CEF 118
Windows 11

go.mod:

module main

go 1.22.0

require (
	github.com/dustin/go-humanize v1.0.1
	github.com/energye/energy/v2 v2.3.6
)

require (
	github.com/energye/golcl v1.0.10 // indirect
	github.com/godbus/dbus/v5 v5.1.0 // indirect
	github.com/tevino/abool v0.0.0-20220530134649-2bfc934cb23c // indirect
	golang.org/x/sys v0.17.0 // indirect
)
package main

import (
	"fmt"
	"runtime"

	"github.com/dustin/go-humanize"
	"github.com/energye/energy/v2/cef"
	"github.com/energye/energy/v2/logger"
	"github.com/energye/energy/v2/consts"

)

const BrowserVersion = "118"

func main() {
	logger.SetEnable(true)
	logger.SetLevel(logger.CefLog_Debug) 
	fmt.Printf("\nVersion:%s", runtime.Version())
	fmt.Printf("\nCompiler:%s", runtime.Compiler)
	fmt.Printf("\nNo. of CPU:%v\n", runtime.NumCPU())
	fmt.Printf("\nGOOS:%s", runtime.GOOS)
	fmt.Printf("\nGOARCH:%s", runtime.GOARCH)
	fmt.Printf("\nGOROOT:%s\n", runtime.GOROOT())
	fmt.Printf("\nBrowserVersion:%s\n", BrowserVersion)

	//global initialization must be called by every application, then create application
	cef.GlobalInit(nil, nil)
	cefApp := cef.NewApplication()
	cefApp.SetEnableGPU(true)
	cefApp.SetAllowInsecureLocalhost(true)
	cefApp.SetLocale(consts.LANGUAGE_en_US)


	cef.BrowserWindow.Config.EnableCenterWindow= false
	cef.BrowserWindow.Config.X=1
	cef.BrowserWindow.Config.Y=1
	cef.BrowserWindow.Config.Height= 900
	cef.BrowserWindow.Config.Width= 1800
	cef.BrowserWindow.Config.ChromiumConfig().SetEnableMenu(true) //Enable right-click menu
	cef.BrowserWindow.Config.ChromiumConfig().SetEnableDevTools(true) //Enabling Developer Tools

	fmt.Printf("ChromeBuild:%s\n", cefApp.ChromeVersion())
	fmt.Printf("LibVersion:%s\n", cefApp.LibVersion())
	fmt.Printf("LibCefVersion:%s\n", cefApp.LibCefVersion())
	fmt.Printf("TotalSystemMemory:%s\n", humanize.Bytes(cefApp.TotalSystemMemory()))
	fmt.Printf("UsedMemory::%s\n", humanize.Bytes(cefApp.UsedMemory()))

	// Set the i18n resource loading method here, use the built-in to exe method here.
	//i18n.SetLocalFS(&resources, "resources")
	//i18n.Switch(consts.LANGUAGE_en_US)

	//specify a URL address, or a local html file directory
	cef.BrowserWindow.Config.Url = "https://html.com/attributes/a-target/"
	cef.BrowserWindow.Config.Title = "ENERGY 2.3.6 Test"

	//run application
	cef.Run(cefApp)
}

click at the link at the page
Code Example
The home page will open in another tab.

And you get some error:

PS C:\Users\JS\Desktop\VSCode\chromium\chromium-118 2-3-6\examples> ./main.exe

Version:go1.22.0
Compiler:gc
No. of CPU:12

GOOS:windows
GOARCH:amd64
GOROOT:C:\Program Files\Go

BrowserVersion:118
The specified procedure could not be found. CEFAppConfig_SpecificVersion
ChromeBuild:118.0.5993.119
LibVersion:
LibCefVersion:118.7.1.0
TotalSystemMemory:34 GB
UsedMemory::14 MB
[ENERGY-Debug] 2024/02/27 13:41:36 new browser channel for IPC Sock C:\Users\JS\AppData\Local\Temp\energy.sock
[ENERGY-Debug] 2024/02/27 13:41:36 application single exe, process start

Version:go1.22.0
Compiler:gc
No. of CPU:12

GOOS:windows
GOARCH:amd64
GOROOT:C:\Program Files\Go

BrowserVersion:118
The specified procedure could not be found. CEFAppConfig_SpecificVersion
ChromeBuild:118.0.5993.119
LibVersion:
LibCefVersion:118.7.1.0
TotalSystemMemory:34 GB
UsedMemory::14 MB

Version:go1.22.0
Compiler:gc
No. of CPU:12

GOOS:windows
GOARCH:amd64
GOROOT:C:\Program Files\Go

BrowserVersion:118

Version:go1.22.0
Compiler:gc
No. of CPU:12

GOOS:windows
GOARCH:amd64
GOROOT:C:\Program Files\Go

BrowserVersion:118
The specified procedure could not be found. CEFAppConfig_SpecificVersion
ChromeBuild:118.0.5993.119
LibVersion:
LibCefVersion:118.7.1.0
TotalSystemMemory:34 GB
[ENERGY-Debug] 2024/02/27 13:41:36 application single exe, gpu-process process start
The specified procedure could not be found. CEFAppConfig_SpecificVersion
ChromeBuild:118.0.5993.119
LibVersion:
LibCefVersion:118.7.1.0
TotalSystemMemory:34 GB
UsedMemory::15 MB

Version:go1.22.0
Compiler:gc
No. of CPU:12

GOOS:windows
GOARCH:amd64
GOROOT:C:\Program Files\Go

BrowserVersion:118
UsedMemory::15 MB

Version:go1.22.0
Compiler:gc
No. of CPU:12

GOOS:windows
GOARCH:amd64
GOROOT:C:\Program Files\Go

BrowserVersion:118
The specified procedure could not be found. CEFAppConfig_SpecificVersion
ChromeBuild:118.0.5993.119
LibVersion:
LibCefVersion:118.7.1.0
TotalSystemMemory:34 GB
The specified procedure could not be found. CEFAppConfig_SpecificVersion
ChromeBuild:118.0.5993.119
LibVersion:
LibCefVersion:118.7.1.0
TotalSystemMemory:34 GB
UsedMemory::15 MB
UsedMemory::15 MB
[ENERGY-Debug] 2024/02/27 13:41:36 application single exe, utility process start
[ENERGY-Debug] 2024/02/27 13:41:36 application single exe, utility process start
[ENERGY-Debug] 2024/02/27 13:41:36 new render channel for IPC Sock C:\Users\JS\AppData\Local\Temp\energy.sock
[ENERGY-Debug] 2024/02/27 13:41:36 new render channel for IPC Sock C:\Users\JS\AppData\Local\Temp\energy.sock
[ENERGY-Debug] 2024/02/27 13:41:36 application single exe, renderer process start
[ENERGY-Info] 2024/02/27 13:41:36 IPC browser on channel channelId: 1709037696428
[ENERGY-Info] 2024/02/27 13:41:36 IPC browser on channel channelId: 1709037696428
[ENERGY-Debug] 2024/02/27 13:41:36 application single exe, renderer process start
[ENERGY-Info] 2024/02/27 13:41:36 IPC browser on channel channelId: 21474836481
[ENERGY-Debug] 2024/02/27 13:41:36 IPC browser channel remove channelId: 1709037696428
[ENERGY-Info] 2024/02/27 13:41:37 IPC browser on channel channelId: 21474836484
[ENERGY-Debug] 2024/02/27 13:41:37 IPC browser channel remove channelId: 21474836481
[ENERGY-Info] 2024/02/27 13:41:37 IPC browser on channel channelId: 21474836485
[ENERGY-Debug] 2024/02/27 13:41:37 IPC browser channel remove channelId: 21474836484
[ENERGY-Info] 2024/02/27 13:41:37 IPC browser on channel channelId: 21474836486
[ENERGY-Debug] 2024/02/27 13:41:37 IPC browser channel remove channelId: 21474836485
unexpected fault address 0xffffffffffffffff
fatal error: fault
[signal 0xc0000005 code=0x0 addr=0xffffffffffffffff pc=0x59a9ba]

goroutine 17 gp=0xc000050380 m=1 mp=0xc00005c008 [running, locked to thread]:
runtime.throw({0x797fc3?, 0x30?})
C:/Program Files/Go/src/runtime/panic.go:1023 +0x65 fp=0xc00002c100 sp=0xc00002c0d0 pc=0x1cd2a5
runtime.sigpanic()
C:/Program Files/Go/src/runtime/signal_windows.go:414 +0xd0 fp=0xc00002c148 sp=0xc00002c100 pc=0x1e2d50
github.com/energye/energy/v2/cef.(*tCefPopupFeaturesPtr).convert.func2(...)
C:/Users/JS/go/pkg/mod/github.com/energye/energy/[email protected]/cef/types_cef_ptr.go:317
github.com/energye/energy/v2/cef.(*tCefPopupFeaturesPtr).convert(0x22d6a9484e0?)
C:/Users/JS/go/pkg/mod/github.com/energye/energy/[email protected]/cef/types_cef_ptr.go:330 +0x5a fp=0xc00002c1b8 sp=0xc00002c148 pc=0x59a9ba
github.com/energye/energy/v2/cef.init.4.func2({0x723440?, 0xc00024e018}, 0xc000296be0)
C:/Users/JS/go/pkg/mod/github.com/energye/energy/[email protected]/cef/chromium_event.go:893 +0x40ba fp=0xc00002d1c8 sp=0xc00002c1b8 pc=0x567ffa
github.com/energye/golcl/lcl.eventCallbackProc(0xc000212cf0?, 0x6c6fbfd638, 0x2?)
C:/Users/JS/go/pkg/mod/github.com/energye/[email protected]/lcl/callbackevent.go:94 +0xe2 fp=0xc00002da50 sp=0xc00002d1c8 pc=0x3b2082
runtime.call32(0x0, 0x838378, 0xc00002dab0, 0x0, 0x0, 0x18, 0xc00002dce0)
C:/Program Files/Go/src/runtime/asm_amd64.s:771 +0x48 fp=0xc00002da80 sp=0xc00002da50 pc=0x1feb08
runtime.callbackWrap(0x6c6fbfd4d0)
C:/Program Files/Go/src/runtime/syscall_windows.go:396 +0x205 fp=0xc00002de58 sp=0xc00002da80 pc=0x1eb745
runtime.cgocallbackg1(0x1eb540, 0x6c6fbfd4d0, 0x0)
C:/Program Files/Go/src/runtime/cgocall.go:403 +0x2b1 fp=0xc00002df18 sp=0xc00002de58 pc=0x1994b1
runtime.cgocallbackg(0x1eb540, 0x6c6fbfd4d0, 0x0)
C:/Program Files/Go/src/runtime/cgocall.go:322 +0x133 fp=0xc00002df90 sp=0xc00002df18 pc=0x199153
runtime.cgocallbackg(0x1eb540, 0x6c6fbfd4d0, 0x0)
:1 +0x2e fp=0xc00002dfb8 sp=0xc00002df90 pc=0x2050ee
runtime.cgocallback(0x0, 0x0, 0x0)
C:/Program Files/Go/src/runtime/asm_amd64.s:1079 +0xec fp=0xc00002dfe0 sp=0xc00002dfb8 pc=0x20030c
runtime.goexit({})
C:/Program Files/Go/src/runtime/asm_amd64.s:1695 +0x1 fp=0xc00002dfe8 sp=0xc00002dfe0 pc=0x200561

goroutine 1 gp=0xc000050000 m=0 mp=0xeccba0 [syscall, locked to thread]:
runtime.cgocall(0x201d20, 0xeccfa0)
C:/Program Files/Go/src/runtime/cgocall.go:157 +0x3e fp=0xc00007db08 sp=0xc00007dad0 pc=0x198d5e
syscall.SyscallN(0x110003810?, {0xc00007dba0?, 0x3?, 0xf?})
C:/Program Files/Go/src/runtime/syscall_windows.go:544 +0x107 fp=0xc00007db80 sp=0xc00007db08 pc=0x1fd427
syscall.Syscall(0x110000000?, 0x110003810?, 0xc00007dc38?, 0x2d2f49?, 0x110000000?)
C:/Program Files/Go/src/runtime/syscall_windows.go:482 +0x35 fp=0xc00007dbc8 sp=0xc00007db80 pc=0x1fd175
github.com/energye/golcl/lcl/api/dllimports.SyscallN(0xc000210000?, {0xc00007dca8?, 0x8383a0?, 0x838200?})
C:/Users/JS/go/pkg/mod/github.com/energye/[email protected]/lcl/api/dllimports/dll_windows.go:45 +0x65 fp=0xc00007dc48 sp=0xc00007dbc8 pc=0x2d2ba5
github.com/energye/golcl/lcl/api/dllimports.ProcAddr.Call(...)
C:/Users/JS/go/pkg/mod/github.com/energye/[email protected]/lcl/api/dllimports/dll_windows.go:33
github.com/energye/golcl/lcl/api.defSyscallN(0x0?, {0xc00007dca8, 0x1, 0x1})
C:/Users/JS/go/pkg/mod/github.com/energye/[email protected]/lcl/api/dylib.go:75 +0x65 fp=0xc00007dc80 sp=0xc00007dc48 pc=0x32b0c5
github.com/energye/golcl/lcl/api.Application_Run(0xc000121188?)
C:/Users/JS/go/pkg/mod/github.com/energye/[email protected]/lcl/api/importdef.go:39 +0x50 fp=0xc00007dcc8 sp=0xc00007dc80 pc=0x3375f0
github.com/energye/golcl/lcl.(*TApplication).Run(...)
C:/Users/JS/go/pkg/mod/github.com/energye/[email protected]/lcl/applicationdef.go:95
github.com/energye/energy/v2/cef.(*browserWindow).createFormAndRun(0xea2420)
C:/Users/JS/go/pkg/mod/github.com/energye/energy/[email protected]/cef/browser_main_window.go:84 +0x19d fp=0xc00007dd28 sp=0xc00007dcc8 pc=0x552c1d
github.com/energye/energy/v2/cef.Run(0xc00006a380)
C:/Users/JS/go/pkg/mod/github.com/energye/energy/[email protected]/cef/application_run.go:106 +0x133 fp=0xc00007dd50 sp=0xc00007dd28 pc=0x551673
main.main()
C:/Users/JS/Desktop/VSCode/chromium/chromium-118 2-3-6/examples/main.go:63 +0x897 fp=0xc00007df50 sp=0xc00007dd50 pc=0x6740b7
runtime.main()
C:/Program Files/Go/src/runtime/proc.go:271 +0x28b fp=0xc00007dfe0 sp=0xc00007df50 pc=0x1cfbcb
runtime.goexit({})
C:/Program Files/Go/src/runtime/asm_amd64.s:1695 +0x1 fp=0xc00007dfe8 sp=0xc00007dfe0 pc=0x200561

goroutine 2 gp=0xc000050700 m=nil [force gc (idle)]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
C:/Program Files/Go/src/runtime/proc.go:402 +0xce fp=0xc000053fa8 sp=0xc000053f88 pc=0x1cffce
runtime.goparkunlock(...)
C:/Program Files/Go/src/runtime/proc.go:408
runtime.forcegchelper()
C:/Program Files/Go/src/runtime/proc.go:326 +0xb8 fp=0xc000053fe0 sp=0xc000053fa8 pc=0x1cfe58
runtime.goexit({})
C:/Program Files/Go/src/runtime/asm_amd64.s:1695 +0x1 fp=0xc000053fe8 sp=0xc000053fe0 pc=0x200561
created by runtime.init.6 in goroutine 1
C:/Program Files/Go/src/runtime/proc.go:314 +0x1a

goroutine 3 gp=0xc000050a80 m=nil [GC sweep wait]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
C:/Program Files/Go/src/runtime/proc.go:402 +0xce fp=0xc000055f80 sp=0xc000055f60 pc=0x1cffce
runtime.goparkunlock(...)
C:/Program Files/Go/src/runtime/proc.go:408
runtime.bgsweep(0xc000060000)
C:/Program Files/Go/src/runtime/mgcsweep.go:278 +0x94 fp=0xc000055fc8 sp=0xc000055f80 pc=0x1ba214
runtime.gcenable.gowrap1()
C:/Program Files/Go/src/runtime/mgc.go:203 +0x25 fp=0xc000055fe0 sp=0xc000055fc8 pc=0x1aeb25
runtime.goexit({})
C:/Program Files/Go/src/runtime/asm_amd64.s:1695 +0x1 fp=0xc000055fe8 sp=0xc000055fe0 pc=0x200561
created by runtime.gcenable in goroutine 1
C:/Program Files/Go/src/runtime/mgc.go:203 +0x66

goroutine 4 gp=0xc000050c40 m=nil [GC scavenge wait]:
runtime.gopark(0xc000060000?, 0x9b69d0?, 0x1?, 0x0?, 0xc000050c40?)
C:/Program Files/Go/src/runtime/proc.go:402 +0xce fp=0xc000067f78 sp=0xc000067f58 pc=0x1cffce
runtime.goparkunlock(...)
C:/Program Files/Go/src/runtime/proc.go:408
runtime.(*scavengerState).park(0xecbe80)
C:/Program Files/Go/src/runtime/mgcscavenge.go:425 +0x49 fp=0xc000067fa8 sp=0xc000067f78 pc=0x1b7c09
runtime.bgscavenge(0xc000060000)
C:/Program Files/Go/src/runtime/mgcscavenge.go:653 +0x3c fp=0xc000067fc8 sp=0xc000067fa8 pc=0x1b819c
runtime.gcenable.gowrap2()
C:/Program Files/Go/src/runtime/mgc.go:204 +0x25 fp=0xc000067fe0 sp=0xc000067fc8 pc=0x1aeac5
runtime.goexit({})
C:/Program Files/Go/src/runtime/asm_amd64.s:1695 +0x1 fp=0xc000067fe8 sp=0xc000067fe0 pc=0x200561
created by runtime.gcenable in goroutine 1
C:/Program Files/Go/src/runtime/mgc.go:204 +0xa5

goroutine 5 gp=0xc000050fc0 m=nil [finalizer wait]:
runtime.gopark(0x22d4227ae28?, 0xc000028030?, 0x0?, 0x0?, 0x0?)
C:/Program Files/Go/src/runtime/proc.go:402 +0xce fp=0xc000057e20 sp=0xc000057e00 pc=0x1cffce
runtime.runfinq()
C:/Program Files/Go/src/runtime/mfinal.go:194 +0x107 fp=0xc000057fe0 sp=0xc000057e20 pc=0x1adba7
runtime.goexit({})
C:/Program Files/Go/src/runtime/asm_amd64.s:1695 +0x1 fp=0xc000057fe8 sp=0xc000057fe0 pc=0x200561
created by runtime.createfing in goroutine 1
C:/Program Files/Go/src/runtime/mfinal.go:164 +0x3d

goroutine 6 gp=0xc000051340 m=nil [IO wait]:
runtime.gopark(0xc00005d008?, 0xe9d420?, 0xa0?, 0x4c?, 0xc000074cd0?)
C:/Program Files/Go/src/runtime/proc.go:402 +0xce fp=0xc000069bf8 sp=0xc000069bd8 pc=0x1cffce
runtime.netpollblock(0x2f4?, 0x1988a6?, 0x0?)
C:/Program Files/Go/src/runtime/netpoll.go:573 +0xf7 fp=0xc000069c30 sp=0xc000069bf8 pc=0x1c79b7
internal/poll.runtime_pollWait(0x22d6753af80, 0x72)
C:/Program Files/Go/src/runtime/netpoll.go:345 +0x85 fp=0xc000069c50 sp=0xc000069c30 pc=0x1fa5c5
internal/poll.(*pollDesc).wait(0x1aeed6?, 0xf53220?, 0x0)
C:/Program Files/Go/src/internal/poll/fd_poll_runtime.go:84 +0x27 fp=0xc000069c78 sp=0xc000069c50 pc=0x2710a7
internal/poll.execIO(0xc000074ca0, 0xc000069d18)
C:/Program Files/Go/src/internal/poll/fd_windows.go:175 +0xe6 fp=0xc000069ce8 sp=0xc000069c78 pc=0x272586
internal/poll.(*FD).acceptOne(0xc000074c88, 0xb3c, {0xc0000b6000?, 0x22d674f17c8?, 0x20?}, 0x22d42270598?)
C:/Program Files/Go/src/internal/poll/fd_windows.go:944 +0x67 fp=0xc000069d48 sp=0xc000069ce8 pc=0x276c47
internal/poll.(*FD).Accept(0xc000074c88, 0xc000069ef8)
C:/Program Files/Go/src/internal/poll/fd_windows.go:978 +0x1bc fp=0xc000069e00 sp=0xc000069d48 pc=0x276f7c
net.(*netFD).accept(0xc000074c88)
C:/Program Files/Go/src/net/fd_windows.go:178 +0x54 fp=0xc000069f18 sp=0xc000069e00 pc=0x37fc34
net.(*UnixListener).accept(0x1d9520?)
C:/Program Files/Go/src/net/unixsock_posix.go:172 +0x16 fp=0xc000069f40 sp=0xc000069f18 pc=0x39b2f6
net.(*UnixListener).AcceptUnix(0xc0000232c0)
C:/Program Files/Go/src/net/unixsock.go:247 +0x30 fp=0xc000069f70 sp=0xc000069f40 pc=0x399970
github.com/energye/energy/v2/pkgs/channel.(*browserChannel).accept(0xc00006c0f0)
C:/Users/JS/go/pkg/mod/github.com/energye/energy/[email protected]/pkgs/channel/channel_browser.go:141 +0x2f fp=0xc000069fc8 sp=0xc000069f70 pc=0x3a3eef
github.com/energye/energy/v2/pkgs/channel.NewBrowser.gowrap1()
C:/Users/JS/go/pkg/mod/github.com/energye/energy/[email protected]/pkgs/channel/channel_browser.go:67 +0x25 fp=0xc000069fe0 sp=0xc000069fc8 pc=0x3a3885
runtime.goexit({})
C:/Program Files/Go/src/runtime/asm_amd64.s:1695 +0x1 fp=0xc000069fe8 sp=0xc000069fe0 pc=0x200561
created by github.com/energye/energy/v2/pkgs/channel.NewBrowser in goroutine 1
C:/Users/JS/go/pkg/mod/github.com/energye/energy/[email protected]/pkgs/channel/channel_browser.go:67 +0x2d6

goroutine 7 gp=0xc000051a40 m=nil [IO wait]:
runtime.gopark(0xc000074fd0?, 0xc000074f50?, 0x60?, 0x4f?, 0xc0000afa90?)
C:/Program Files/Go/src/runtime/proc.go:402 +0xce fp=0xc0000afa20 sp=0xc0000afa00 pc=0x1cffce
runtime.netpollblock(0x1?, 0x1988a6?, 0x0?)
C:/Program Files/Go/src/runtime/netpoll.go:573 +0xf7 fp=0xc0000afa58 sp=0xc0000afa20 pc=0x1c79b7
internal/poll.runtime_pollWait(0x22d6753ae88, 0x72)
C:/Program Files/Go/src/runtime/netpoll.go:345 +0x85 fp=0xc0000afa78 sp=0xc0000afa58 pc=0x1fa5c5
internal/poll.(*pollDesc).wait(0x0?, 0x22d674f33e8?, 0x0)
C:/Program Files/Go/src/internal/poll/fd_poll_runtime.go:84 +0x27 fp=0xc0000afaa0 sp=0xc0000afa78 pc=0x2710a7
internal/poll.execIO(0xc000074f20, 0x838778)
C:/Program Files/Go/src/internal/poll/fd_windows.go:175 +0xe6 fp=0xc0000afb10 sp=0xc0000afaa0 pc=0x272586
internal/poll.(*FD).ReadFrom(0xc000074f08, {0xc0002228e0, 0xc00000c0000afb18?, 0x1?})
C:/Program Files/Go/src/internal/poll/fd_windows.go:579 +0x14f fp=0xc0000afb88 sp=0xc0000afb10 pc=0x27404f
net.(*netFD).readFrom(0xc000074f08, {0xc0002228e0?, 0xc0000afc40?, 0x3a3c91?})
C:/Program Files/Go/src/net/fd_posix.go:61 +0x25 fp=0xc0000afbe0 sp=0xc0000afb88 pc=0x37de45
net.(*UnixConn).readFrom(0xc00005a078, {0xc0002228e0?, 0x22d42270a28?, 0x20?})
C:/Program Files/Go/src/net/unixsock_posix.go:103 +0x27 fp=0xc0000afc40 sp=0xc0000afbe0 pc=0x39a967
net.(*UnixConn).ReadFromUnix(0xc00005a078, {0xc0002228e0?, 0x6bf2c0?, 0xc00009e001?})
C:/Program Files/Go/src/net/unixsock.go:110 +0x30 fp=0xc0000afc90 sp=0xc0000afc40 pc=0x398a30
github.com/energye/energy/v2/pkgs/channel.(*channel).read(0x9c1ee0?, {0xc0002228e0?, 0x9c1d90?, 0xf52020?})
C:/Users/JS/go/pkg/mod/github.com/energye/energy/[email protected]/pkgs/channel/channel.go:304 +0x32 fp=0xc0000afcc0 sp=0xc0000afc90 pc=0x3a1e72
github.com/energye/energy/v2/pkgs/channel.(*channel).ipcRead(0xc00009c030)
C:/Users/JS/go/pkg/mod/github.com/energye/energy/[email protected]/pkgs/channel/channel.go:362 +0x145 fp=0xc0000aff60 sp=0xc0000afcc0 pc=0x3a2525
github.com/energye/energy/v2/pkgs/channel.(*browserChannel).newConnection(0xc00006c0f0, {0x9c2310, 0xc00005a078})
C:/Users/JS/go/pkg/mod/github.com/energye/energy/[email protected]/pkgs/channel/channel_browser.go:202 +0x15c fp=0xc0000affb8 sp=0xc0000aff60 pc=0x3a41bc
github.com/energye/energy/v2/pkgs/channel.(*browserChannel).accept.gowrap1()
C:/Users/JS/go/pkg/mod/github.com/energye/energy/[email protected]/pkgs/channel/channel_browser.go:149 +0x28 fp=0xc0000affe0 sp=0xc0000affb8 pc=0x3a4028
runtime.goexit({})
C:/Program Files/Go/src/runtime/asm_amd64.s:1695 +0x1 fp=0xc0000affe8 sp=0xc0000affe0 pc=0x200561
created by github.com/energye/energy/v2/pkgs/channel.(*browserChannel).accept in goroutine 6
C:/Users/JS/go/pkg/mod/github.com/energye/energy/[email protected]/pkgs/channel/channel_browser.go:149 +0x115

goroutine 19 gp=0xc0000841c0 m=nil [IO wait]:
runtime.gopark(0xc0000b20d0?, 0xc0000b2050?, 0x60?, 0x20?, 0xc0000aba90?)
C:/Program Files/Go/src/runtime/proc.go:402 +0xce fp=0xc0000aba20 sp=0xc0000aba00 pc=0x1cffce
runtime.netpollblock(0x1?, 0x1988a6?, 0x0?)
C:/Program Files/Go/src/runtime/netpoll.go:573 +0xf7 fp=0xc0000aba58 sp=0xc0000aba20 pc=0x1c79b7
internal/poll.runtime_pollWait(0x22d6753ad90, 0x72)
C:/Program Files/Go/src/runtime/netpoll.go:345 +0x85 fp=0xc0000aba78 sp=0xc0000aba58 pc=0x1fa5c5
internal/poll.(*pollDesc).wait(0xc00009a0b0?, 0xc0000abaf0?, 0x0)
C:/Program Files/Go/src/internal/poll/fd_poll_runtime.go:84 +0x27 fp=0xc0000abaa0 sp=0xc0000aba78 pc=0x2710a7
internal/poll.execIO(0xc0000b2020, 0x838778)
C:/Program Files/Go/src/internal/poll/fd_windows.go:175 +0xe6 fp=0xc0000abb10 sp=0xc0000abaa0 pc=0x272586
internal/poll.(*FD).ReadFrom(0xc0000b2008, {0xc00008e8a0, 0xc00009c2a0?, 0xdf7448?})
C:/Program Files/Go/src/internal/poll/fd_windows.go:579 +0x14f fp=0xc0000abb88 sp=0xc0000abb10 pc=0x27404f
net.(*netFD).readFrom(0xc0000b2008, {0xc00008e8a0?, 0xc0000abc40?, 0x3a3dda?})
C:/Program Files/Go/src/net/fd_posix.go:61 +0x25 fp=0xc0000abbe0 sp=0xc0000abb88 pc=0x37de45
net.(*UnixConn).readFrom(0xc00009e018, {0xc00008e8a0?, 0x22d42270598?, 0x20?})
C:/Program Files/Go/src/net/unixsock_posix.go:103 +0x27 fp=0xc0000abc40 sp=0xc0000abbe0 pc=0x39a967
net.(*UnixConn).ReadFromUnix(0xc00009e018, {0xc00008e8a0?, 0x6bf2c0?, 0xc00005a001?})
C:/Program Files/Go/src/net/unixsock.go:110 +0x30 fp=0xc0000abc90 sp=0xc0000abc40 pc=0x398a30
github.com/energye/energy/v2/pkgs/channel.(*channel).read(0x9c1ee0?, {0xc00008e8a0?, 0x9c1d90?, 0xf52020?})
C:/Users/JS/go/pkg/mod/github.com/energye/energy/[email protected]/pkgs/channel/channel.go:304 +0x32 fp=0xc0000abcc0 sp=0xc0000abc90 pc=0x3a1e72
github.com/energye/energy/v2/pkgs/channel.(*channel).ipcRead(0xc0000232f0)
C:/Users/JS/go/pkg/mod/github.com/energye/energy/[email protected]/pkgs/channel/channel.go:362 +0x145 fp=0xc0000abf60 sp=0xc0000abcc0 pc=0x3a2525
github.com/energye/energy/v2/pkgs/channel.(*browserChannel).newConnection(0xc00006c0f0, {0x9c2310, 0xc00009e018})
C:/Users/JS/go/pkg/mod/github.com/energye/energy/[email protected]/pkgs/channel/channel_browser.go:202 +0x15c fp=0xc0000abfb8 sp=0xc0000abf60 pc=0x3a41bc
github.com/energye/energy/v2/pkgs/channel.(*browserChannel).accept.gowrap1()
C:/Users/JS/go/pkg/mod/github.com/energye/energy/[email protected]/pkgs/channel/channel_browser.go:149 +0x28 fp=0xc0000abfe0 sp=0xc0000abfb8 pc=0x3a4028
runtime.goexit({})
C:/Program Files/Go/src/runtime/asm_amd64.s:1695 +0x1 fp=0xc0000abfe8 sp=0xc0000abfe0 pc=0x200561
created by github.com/energye/energy/v2/pkgs/channel.(*browserChannel).accept in goroutine 6
C:/Users/JS/go/pkg/mod/github.com/energye/energy/[email protected]/pkgs/channel/channel_browser.go:149 +0x115
[ENERGY-Debug] 2024/02/27 13:41:41 IPC Read [Error] type: [unix] ChannelType: [client] Error: read unix @->C:\Users\JS\AppData\Local\Temp\energy.sock: wsarecvfrom: An existing connection was forcibly closed by the remote host.
[ENERGY-Debug] 2024/02/27 13:41:41 IPC Read Disconnect type: [unix] ChannelType: [client] processType: renderer
PS C:\Users\JS\Desktop\VSCode\chromium\chromium-118 2-3-6\examples>

plus some other problems:

  1. The specified procedure could not be found. CEFAppConfig_SpecificVersion
  2. LibVersion: is empty

Linux ARM “static TLS block”

Linux ARM import libcef.so failed

cannot allocate memory in static TLS block

  • The reason may be that the upstream compilation is for optimizing performance.
  • The current solution is to add preloaded environment variables before running the program

export LD_PRELOAD=/path/to/libcef.so:$LD_PRELOAD

  • This problem may not be solved in energy

Then run the GTK3 demos.export LD_PRELOAD=<FULL-PATH-TO-libcef.so>
CEF4Delphi
salvadordf/CEF4Delphi#457

Open source is not easy, strive to persist! Order a Star, it's very important to me!

Speak up


I started occasionally searching for Go's desktop GUI framework a few years ago, when I was purely interested.

I have found and tried some, but I personally feel that each has its own advantages and disadvantages, which is only at the level of trial. Not very well understood.


From 2021 to 2022, a friend introduced an outsourcing project, the APP+PC Paperless office intelligent conference software, which needs to be cross platform and support windows, domestic systems (linux, linux arm), Android, IOS, and PC customers need to use java as the client, and a layer of shell is packaged based on CEF


It's really uncomfortable to write a Java client and never want to write again after this experience. In short, there are various issues.


Ever since this project, I've been thinking of using Go to write one myself, give it a try?

I don't know how to start. I accidentally found the govcl open source project, the system native UI encapsulated by the lcl component library based on Lazarus, and then learned how to do it. At first, I saw that the Free Pascal language was unused, and then I began to experience the installation environment. Later, I became more and more fond of govcl, which is compact and a Dynamic-link library.


Later on, while researching and learning free pascal, I looked at whether this thing could be used as a browser based cross platform desktop framework

The client interface of the Govcl component library is not very attractive. Not as flexible and ever-changing as HTML+CSS, but there are really many components. If you have the ability, you can also extend liblcl yourself

The advantage of the Govcl component library is that the compiled volume is very small and the compilation speed is also fast You only need liblcl Dynamic-link library (lcl component library)+go environment

The most important aspect of Lazarus is cross platform Windows, Linux (ARM), Mac (ARM), and many other architectures that I have never heard of, and the APP also supports Android that I have never used before


Furthermore, I discovered CEF4Delphi during a study of Lazarus extension components. Upon seeing that it is open-source and entirely written based on CEF, I was wondering if it could be integrated into the liblcl dynamic library and started researching


After a period of testing, it is feasible. Then start writing the Energy Journey.

At the beginning, I didn't know how to use free pascal very well. While learning and writing, I changed the clone govcl to golcl (retaining the original author's authorization and information) and added extensions to enrgy while retaining the native components of the lcl system


Time: October 2022~June 2023, from the initial v1.0 to v2.0, lasting for over 8 months


V1.0 has not fully implemented the CEF interface yet, and there are many logical functions written in liblcl, and not many CEF functions are implemented

V2.0 transfers all logical functions from the liblcl library to go for implementation, while adding 90% of CEF's export APIs to Energy


The framework code may not be perfect or there may be many issues, welcome to raise them.


Welcome to Sanlian: watch、star、fork

Golcl undefined initOSVersion

$ go run example/simple/simple.go 
#github.com/energye/golcl/lcl/rtl/version
../../go/pkg/mod/github.com/energye/[email protected]/lcl/rtl/version/init.go:25:2: undefined: initOSVersion
#github.com/energye/golcl/lcl/api/dllimports
../../go/pkg/mod/github.com/energye/[email protected]/lcl/api/dllimports/importfuncs.go:26:26: uiLib.GetProcAddr undefined (type DLL has no field or method GetProcAddr)

After having followed the documentation instructions this error pops up when running simple.go

I am using 64bit MxLinux as the distro.

The specified module could not be found.

hello, I need help

  • energy install .
  • create main.go
package main

import (
	"github.com/energye/energy/cef"
)

func main() {
	//全局初始化 每个应用都必须调用的
	cef.GlobalCEFInit(nil, nil)
	//创建应用
	cefApp := cef.NewApplication(nil)
	//指定一个URL地址,或本地html文件目录
	cef.BrowserWindow.Config.DefaultUrl = "http://192.168.10.100"
	//运行应用
	cef.Run(cefApp)
}
  • go mod init demo
  • go run main.go

an error has been generated

API server listening at: 127.0.0.1:65203
panic: Failed to load C:\Users\user\golcl\liblcl.dll: The specified module could not be found.                                   
                                                                                                                                
goroutine 1 [running]:                                                                                                          
github.com/energye/golcl/lcl/api.loadUILib()       

maybe a bug?

  1. first create a clean energy by downloaded energy_cmd_windows64
  2. windows -> cmd/energy.exe install . finally: Automatically configure the CEF and Energy framework SUCCESS Version: latest
  3. go mod init simple
  4. go mod tidy
  5. create the simple.go from examples/simple
  6. go run simple.go
  7. i get some error
PS C:\Users\js\Desktop\AntD\a_broiler\project\energy2> go run simple.go  
The specified procedure could not be found.
The specified procedure could not be found.
The specified procedure could not be found.
The specified procedure could not be found.
The specified procedure could not be found.
The specified procedure could not be found.
The specified procedure could not be found.
The specified procedure could not be found.
The specified procedure could not be found.
The specified procedure could not be found.
The specified procedure could not be found.
PS C:\Users\js\Desktop\AntD\a_broiler\project\energy2> 

Cheers

package main

import (
	"github.com/energye/energy/v2/cef"
)

func main() {
	//Global initialization must be called by every application
	cef.GlobalInit(nil, nil)
	//Create application
	cefApp := cef.NewApplication()
	//Set URL
	cef.BrowserWindow.Config.Url = "https://energy.yanghy.cn"
	//Run App
	cef.Run(cefApp)
}
module simple

go 1.20

require github.com/energye/energy/v2 v2.0.2

require (
	github.com/energye/golcl v0.0.0-20230607072628-c317d3f83490 // indirect
	github.com/godbus/dbus/v5 v5.1.0 // indirect
	github.com/json-iterator/go v1.1.12 // indirect
	github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect
	github.com/modern-go/reflect2 v1.0.2 // indirect
	github.com/tevino/abool v0.0.0-20220530134649-2bfc934cb23c // indirect
	golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
)

怎么用CEF的窗口发送一个POST请求

类似如下代码:
`#include "include/cef_app.h"
#include "include/cef_browser.h"
#include "include/cef_frame.h"
#include "include/cef_request.h"

void SendPostRequest(CefRefPtr browser) {
CefRefPtr frame = browser->GetMainFrame();

// 创建一个请求对象
CefRefPtr<CefRequest> request = CefRequest::Create();
request->SetURL("https://example.com/post_endpoint"); // 设置请求的URL
request->SetMethod("POST"); // 设置请求方法为POST

// 设置请求头
CefRequest::HeaderMap headerMap;
headerMap.insert(std::make_pair("Content-Type", "application/x-www-form-urlencoded"));
request->SetHeaderMap(headerMap);

// 设置请求体(示例数据)
std::string postData = "param1=value1&param2=value2";
CefRefPtr<CefPostData> postDataPtr = CefPostData::Create();
CefRefPtr<CefPostDataElement> element = CefPostDataElement::Create();
element->SetToBytes(postData.size(), postData.c_str());
postDataPtr->AddElement(element);
request->SetPostData(postDataPtr);

// 加载请求
frame->LoadRequest(request);

}
`

在 energy 中怎么发送呢,可以给个示例吗?

点击按钮后弹窗迟钝

作者您好:
今天在实现的过程中发现了一个问题,我要用到的功能是:在点击浏览器上的按钮后会生成一个pdf文件,然后随之会调用打印机进行打印机。
我在用浏览器进行操作时点击后会迅速的唤醒,而用golang内嵌的网页时速度就会比较慢了,要等待一会才出来,有时候点击了按钮后就干脆不唤醒打印机界面了。
想了解一下我遇到了这个问题该怎么去处理优化。
非常感谢您的开源让我的工作得到了帮助,期待您的回复!

非常感谢作者提供,刚接触遇到一些疑问,方便大家讨论,我希望在这里提出疑问,问题偏向于爬虫

有的需求可能在手册中也可能在示例中,我会去慢慢学习了解,以下可能是我站在爬虫角度比较在意的地方。同时也希望对作者撰写手册提供一些需求描述方向。
1.返回上一页
2.针对每一个不同的窗口设置代理
3.监听地址栏URL以及窗口页面所有请求甚至是对地址栏和页面请求进行请求内容串改和响应内容串改拦截等等
4.是否显示网页图片
5.是否加载js
6.是否无头模式
7.如何用GO直接操作页面元素还是说只能和js交互方式控制?
8.是否允许跨域?或者说是关闭浏览器相关安全策略等等
9.具体的浏览器层面配置字段?
10.对于浏览器用户操作模拟?比如点击、滚动、悬浮、焦点、移动鼠标、双击等等
针对很多通过GO调用js交互实现的一些,我可能更偏向于直接用GO实现,比如返回上一页或者是点击某个元素之类的可能GO直接操作更讨人喜欢

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.