From e9af91c756eb1bd89ec4b7571d16bd4d7d8595a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D0=B0=D1=82=D0=BE=D0=BB=D0=B8=D0=B9=20=D0=A2?= =?UTF-8?q?=D1=83=D1=85=D1=82=D0=B0=D1=80=D0=BE=D0=B2?= Date: Fri, 9 Feb 2024 06:38:28 +0500 Subject: [PATCH] v1.0.1 --- css.go | 38 ++++++++++++ go.mod | 8 +++ go.sum | 4 ++ html.go | 26 +++++++++ icons8_Discord_Partner_Server_Owner_Badge.ico | Bin 0 -> 5430 bytes js.go | 18 ++++++ main.go | 54 ++++++++++++++++++ 7 files changed, 148 insertions(+) create mode 100644 css.go create mode 100644 go.mod create mode 100644 go.sum create mode 100644 html.go create mode 100644 icons8_Discord_Partner_Server_Owner_Badge.ico create mode 100644 js.go create mode 100644 main.go diff --git a/css.go b/css.go new file mode 100644 index 0000000..78ad8e3 --- /dev/null +++ b/css.go @@ -0,0 +1,38 @@ +package main + +import ( + //"os" +) + +const css = ` +body { + background-color: #222; + color: #aaa; + font-size: 1rem; + font-family: "Source Sans Pro", 'JetBrains Mono', 'Fira Code', "Segoe UI" +} + +.main-title { + color: teal; + margin-top: 0; + text-align: center; +} + +.container { + display: flex; + margin-left: 8px; + margin-right: 8px; + justify-content: space-between; +} + +.server { + color: darkcyan; + cursor: pointer; +} + +.server:hover { + text-decoration: underline; + color: cyan; +} + +` diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..7196dbc --- /dev/null +++ b/go.mod @@ -0,0 +1,8 @@ +module servers + +go 1.22.0 + +require ( + github.com/estebangarcia21/subprocess v0.0.0-20230526204252-a1a6de4773be + github.com/webview/webview_go v0.0.0-20230901181450-5a14030a9070 +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..e6edc39 --- /dev/null +++ b/go.sum @@ -0,0 +1,4 @@ +github.com/estebangarcia21/subprocess v0.0.0-20230526204252-a1a6de4773be h1:Mf6Xc0DgENbsDgKn10KNCNmW9FYSTcMr2bFsJ9uzvX0= +github.com/estebangarcia21/subprocess v0.0.0-20230526204252-a1a6de4773be/go.mod h1:PlHe6+WP6t7m4ghYrX6GBzB0KZLdOKWz2Ih3h0nusAY= +github.com/webview/webview_go v0.0.0-20230901181450-5a14030a9070 h1:imZLWyo1ondeQjqfb/eHuYgFiOAYg6ugSMCnGfPTPmg= +github.com/webview/webview_go v0.0.0-20230901181450-5a14030a9070/go.mod h1:yE65LFCeWf4kyWD5re+h4XNvOHJEXOCOuJZ4v8l5sgk= diff --git a/html.go b/html.go new file mode 100644 index 0000000..227ec43 --- /dev/null +++ b/html.go @@ -0,0 +1,26 @@ +package main + +const html = ` +

Сервера

+ +
+
books-web
+
3000
+
+ +
+
nano-tw
+
4321
+
+ +
+
trans-web
+
4322
+
+ +
+
stem
+
4323
+
+ +` \ No newline at end of file diff --git a/icons8_Discord_Partner_Server_Owner_Badge.ico b/icons8_Discord_Partner_Server_Owner_Badge.ico new file mode 100644 index 0000000000000000000000000000000000000000..5607d3271c0e691a6d8dec4e3a7ec6a643537a45 GIT binary patch literal 5430 zcmeHLTW=dh6rMDc7K%t)Ks*#^B%~G)D&-H9LILNUa!6D^(BcXl!qdr zik7y31U&GB`WhaPT8W~nDpD(GD}_3~uDy=e2||QxQj&W3X4jL%PTV#G9$ICk(b(gi zGv9pY%$)C-kT$Z4tY1&icM{J%glr*%bap!5zr^?vj6H=he8d~hI6AT&<9Eta^m;d> z{9QY)1-f6miqE%;yBPIu$cMbgva)9~Bloa$z|BUa?#Wc|!J|31yW?hd@^Sgmg6gm2 z!@VpQ^0BPqW!Yd4%gAon>1HX(RZL3<_qDQd$?aZkXo2H~Ce;dRFUyC0umc;42R3H0 z)JFW>AL8Bnxt&Tv4VDw(YB?S{Q;CJS+lZ-2y9*KNa9;Ip%ZH@ra*FS(oQ-A9PFm_p zXQZy@t%1mIm420t_JtX2{AI>M0mfb4^yEUl2eGFK8_V3D@)p&{wc7)hO;M*WuBcchAF+bd0zAP@poc7v8N%}8LbZJ<k49e(!Gh z&fpNyrZy8YffF*(PRM72gmf5$v`-L1A1B1%<7hLx=icY@c))g|?Lp)B5q~JZcvhYj z2JT=6_+6e2xc4G|Br*Z_@ezqPSNxjawTJ)qe{GH5k-4BJnGJfX8T+0_-l*rFwA77U z=3*m$mzDCn`md<_*Zr3`@|y20i|42$64`M<6K98I#QPi9h5*WrvLtywA#KBpLwj~Wr_ z#vB*^SuSqo6DK|eA9j3RO#56>Hxu~6KuEm)V4O}r*d7H2;dfaCl^P03Xt9n}c z@h6&i2{?wUba5{1TBOk@3_h`I0W-!i%;K0TMkIYHz7jYKl&%Ga_rb-DMlS005MrYt zJ{_ObF*r4ejRRbOkGF;0rS_;Oz zo0M)G8;qX + + + + + + %s + + ` + +func main() { + w := webview.New(false) + defer w.Destroy() + w.SetTitle("Сервера") + w.SetSize(280, 320, webview.HintNone) + //w.SetHtml("Thanks for using webview!") + //w.SetHtml(`test`) + + // Регистрируем функцию JavaScript для прослушивания события от веб-страницы + w.Bind("noop", func() string { + log.Println("hello") + return "hello" + }) + + w.Bind("server", func(name string) string { + log.Printf("start server: %s", name) + startServer(name) + return "start" + }) + + // Загружаем HTML-страницу с JavaScript кодом, который будет отправлять сообщения + resulthtml := fmt.Sprintf(mainhtml, css, html, js) + w.SetHtml(resulthtml) + //w.Navigate("http://localhost:9999") + + // Запускаем цикл событий окна браузера + w.Run() +}