Using custom GUI (HTML/CSS/JS) assets

The GUI files (HTML, CSS, Javascript, images, etc) are compiled into the syncthing binary at build time. This is very convenient for deployment, but not so much when developing the GUI (quick reloads) or if you want to do something custom.

Syncthing can be set to load files from a regular directory, replacing the compiled in versions. In order to do so, set the STGUIASSETS environment variable to point to a directory with the same layout as the original GUI directory.

$ STGUIASSETS=~/mygui syncthing

Files will be loaded first from ~/mygui, or if not found there served from the compiled in assets.

1 Like

edit to main.go

STGUIASSETS = ~/mygui syncthing guiAssets = os.Getenv(“STGUIASSETS”)

cpuProfile = os.Getenv(“STCPUPROFILE”) != “”

this edit file ??? how to edit and windows version compile?

how to rebuild html/css ? base64 using?

re build text …is [PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRm…]

original text …is [H4sIAAAJbogA/9RXXW/UyBJ9DhL/wde8XCS3x+3+dJS56CbcyyKx…]

You don’t need to edit anything. Just set the environment variable where your assets are. Alternatively, you can modify existing assets and run ./build.sh assets or go run build.go assets

  1. add System environment variable MyComputer… variable name STGUIASSETS variable value ~/mygui syncthing

  2. folder copy to syncthing\mygui syncthing

  3. go run build.go

  4. Bin\syncthing.exe run to.

  5. not change gui

how to edit / add to gui\assets\lang-ko.json ?

or mygui\assets\lang-ko.json file ?

how edit to build.go file with assets line?

i want add lang file…

Translations are done here: https://www.transifex.com/organization/syncthing/dashboard/syncthing

how to change assets ? mygui folder? compile with original source is binary … gui.files.go

how to rebuild gui with assets ?

i’m using go source…

package main import ( "encoding/base64" “os” )

func main() { str := encode() decode(str) }

func encode() string { file, _ := os.Open(“index.html”) defer file.Close() fi, _ := file.Stat() size := fi.Size()
data := make([]byte, size) file.Read(data) return base64.StdEncoding.EncodeToString(data) } func decode(str string) { inputd := []byte(str) file, _ := os.Create(“index.html.txt”) defer file.Close() file.Write(inputd) }

it’s ok??? or using gzip ?

You don’t need to do anything, or encode anything, it’s part of the build process. Modify the files and run go run build.go assets that’s it!

Check out https://github.com/syncthing/syncthing/wiki/Building#subcommands-and-options

thank you. Q1 : A device share [folder name aaa] set Folder master [0] B device <==> A device aaa folder Sync Folder master[x] C device <==> A device aaa folder Sync Folder master[x] D device <==> A device aaa folder Sync Folder master[x]

   data synced A => B
                       A => C
                       A => D
   data transfer flow it that true?

   how to share 
                A => B
                B => C
                C => D ?????

Master means do not accept any data from anyone, just send your data to others.

Also, please don’t spam some random thread with your questions, if you have questions create a new thread.