Repository navigation
gui, lib/api: Add possibility to feed through extra version information - #8980
Conversation
This adds an environment variable STVERSIONEXTRA that, when set, gets
added to the version information in the API and GUI. In the CLI we see the following:
% STVERSIONEXTRA=foo ./bin/syncthing --version
syncthing v1.23.7-rc.1 (foo) "Fermium Flea" (go1.20.5 darwin...etc
In the GUI it's shown similarly in the About screen and in the local
device box.
The purpose of all this is to be able to communicate something about the
bundling or packaging, through the log & GUI and the end user, to the
potential person supporting it -- i.e., us. :) A wrapper can set this
variable to indicate that Syncthing is being run via `SyncTrayzor`,
`Syncthing-macOS`, etc., and thus indicate to the end user that the GUI
they are looking at is perhaps not the only source of truth and
management for this instance.
acolomb
left a comment
There was a problem hiding this comment.
Should we sanitize the value somehow, e.g. removing punctuation like parentheses that will make the elaborate version string even more confusing? Allow only alphanumeric, comma, dash and dot for example?
I don't think sanitizing is an issue in the HTML context. If someone wants to inject code via this environment variable, they might just as well use STGUIASSETS.
|
Indeed, that might be an idea. It should be safe in html regardless, but no reason to let the version string become extremely odd. |
|
So, slight change. In the GUI we can do what we want, and I kept the thing there. The version string is however parsed in places, maybe not only by us, and we can't/shouldn't add random stuff to the middle. We have the tags field at the end that's sort of free-form, so I'm adding it there instead. The effect is the same in logs and CLI (it's visible) while not breaking tooling... Also added a filter to avoid things that might break the version string. |
| } | ||
| ) | ||
|
|
||
| const versionExtraAllowedChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-. " |
There was a problem hiding this comment.
I'm aware this is not particularly inclusive or culturally sensitive, however I think for the version string it's fine to limit ourselves to basic ASCII.
|
Should we really differentiate between GUI and logs with two different variants of the version string? Are there good reasons or previous examples for that? Sorry couldn't check the actual difference, just commenting from mobile. |
|
Yeah I think it's fine. I'll screen shot later when I'm back at a computer, but the formats are already quite different and for different purposes. The text version in logs and --version is kind of all the technical details and in a (by now) locked in format. The one one the gui just shows the version tag and platform, in a different format than the raw version, e.g. "macOS 64-bit ARM" instead of "darwin-arm64" and also already shows things like "Container" when running in a container. The main purpose (to me) is to show the version running to the user and communicate some basics about the platform to a supporter looking at the screenshot. |
| "version": build.Version, | ||
| "codename": build.Codename, | ||
| "longVersion": build.LongVersion, | ||
| "extra": build.Extra, |
There was a problem hiding this comment.
Isn't this all be versionExtra instead of just an ambiguous extra?
There was a problem hiding this comment.
The whole thing is the response to /system/version so it should be unambiguous.
The whole thing is unpretty right now because the long version with branch name etc but that's not going to be a thing in releases. |
* main: (27 commits) gui, man, authors: Update docs, translations, and contributors cmd/syncthing: Mention STVERSIONEXTRA in --help output (ref syncthing#8980) gui, lib/api: Add possibility to feed through extra version information (syncthing#8980) cmd/ursrv: Update map tile URL cmd/strelaypoolsrv: Update map tile URL (syncthing#8985) cmd/stcrashreceiver: Correct parsing of current version string build: Update dependencies cmd/ursrv: Remove old, unused user movement code cmd/ursrv: Merge ursrv and uraggregate as subcommands cmd/ursrv: Remove useless static TLS cert handling cmd/ursrv: Embed static assets cmd/ursrv: Refactor to use CLI options, fewer global vars gui: Show xattr filter editor when send xattrs checked (fixes syncthing#8958) (syncthing#8959) gui, man, authors: Update docs, translations, and contributors build: Build Docker image for plain 32 bit arm (fixes syncthing#8973) lib/fs: Clarify errors for Windows filenames (fixes syncthing#8968) (syncthing#8969) gui: Avoid spurious comma in shared-with device list (fixes syncthing#8967) (syncthing#8970) cmd/ursrv: Summarize tiny fraction items into Other cmd/ursrv: Update distributions list build: Only push releases to cloud storage, and also use `latest` ...
* main: (42 commits) gui, man, authors: Update docs, translations, and contributors cmd/syncthing: Mention STVERSIONEXTRA in --help output (ref #8980) gui, lib/api: Add possibility to feed through extra version information (#8980) cmd/ursrv: Update map tile URL cmd/strelaypoolsrv: Update map tile URL (#8985) cmd/stcrashreceiver: Correct parsing of current version string build: Update dependencies cmd/ursrv: Remove old, unused user movement code cmd/ursrv: Merge ursrv and uraggregate as subcommands cmd/ursrv: Remove useless static TLS cert handling cmd/ursrv: Embed static assets cmd/ursrv: Refactor to use CLI options, fewer global vars gui: Show xattr filter editor when send xattrs checked (fixes #8958) (#8959) gui, man, authors: Update docs, translations, and contributors build: Build Docker image for plain 32 bit arm (fixes #8973) lib/fs: Clarify errors for Windows filenames (fixes #8968) (#8969) gui: Avoid spurious comma in shared-with device list (fixes #8967) (#8970) cmd/ursrv: Summarize tiny fraction items into Other cmd/ursrv: Update distributions list build: Only push releases to cloud storage, and also use `latest` ...
* main: gui: Remove Twitter link from footer (syncthing#9000) gui, man, authors: Update docs, translations, and contributors lib/ur: Don't report uptime if start time is in the past (fixes syncthing#7698) (syncthing#8996) lib/model: use WARN for "Unexpected folder" messages (syncthing#8998) lib/osutil: Skip setLowPriority in Windows if already lower (fixes syncthing#6597) (syncthing#8993) all: replace empty slice literal with `var` (syncthing#8990) all: fix unused method receiver (syncthing#8988) all: unused parameter should be replaced by underscore (syncthing#8989) gui, man, authors: Update docs, translations, and contributors cmd/syncthing: Mention STVERSIONEXTRA in --help output (ref syncthing#8980) gui, lib/api: Add possibility to feed through extra version information (syncthing#8980) cmd/ursrv: Update map tile URL cmd/strelaypoolsrv: Update map tile URL (syncthing#8985) cmd/stcrashreceiver: Correct parsing of current version string

This adds an environment variable STVERSIONEXTRA that, when set, gets added to the version information in the API and GUI. In the CLI we see the following:
In the GUI it's shown similarly in the About screen and in the local device box.
The purpose of all this is to be able to communicate something about the bundling or packaging, through the log & GUI and the end user, to the potential person supporting it -- i.e., us. :) A wrapper can set this variable to indicate that Syncthing is being run via
SyncTrayzor,Syncthing-macOS, etc., and thus indicate to the end user that the GUI they are looking at is perhaps not the only source of truth and management for this instance.