Web setup is now optionally secured with JWT tokens. When the Manager is not linked to a Server, this SECURITY IS TURNED OFF. Flamenco Server is used to supply us with JWT tokens and public keys for token validation; without knowing which server to connect to, this workflow is impossible. Other changes are: - Immediately download JWT keys upon starting. This is most important for the setup mode, where we may need to download keys immediately after restarting (which happens after linking). - Web setup now uses main layout.html file and Vue.js. - Web setup now loads and saves settings via YAML. It can show a web form as well as an advanced mode that allows direct editing of YAML. Note that the YAML is never sent byte-for-byte from the config file to the web frontend. It is always parsed, modified (the `ManagerSecret` property is cleared), and then re-marshalled to YAML before sending to the frontend. The frontend does the same: it first parses the YAML from the editor (showing a clear description about any parse errors), then converts the parsed configuration back to YAML before sending it to the server.
71 lines
2.5 KiB
Go
71 lines
2.5 KiB
Go
/* (c) 2019, Blender Foundation - Sybren A. Stüvel
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining
|
|
* a copy of this software and associated documentation files (the
|
|
* "Software"), to deal in the Software without restriction, including
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
* permit persons to whom the Software is furnished to do so, subject to
|
|
* the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be
|
|
* included in all copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
*/
|
|
|
|
package websetup
|
|
|
|
import (
|
|
"github.com/armadillica/flamenco-manager/flamenco"
|
|
)
|
|
|
|
type keyExchangeRequest struct {
|
|
KeyHex string `json:"key"`
|
|
}
|
|
type keyExchangeResponse struct {
|
|
Identifier string `json:"identifier"`
|
|
}
|
|
|
|
type linkRequiredResponse struct {
|
|
Required bool `json:"link_required"`
|
|
ServerURL string `json:"server_url,omitempty"`
|
|
}
|
|
type linkStartResponse struct {
|
|
Location string `json:"location"`
|
|
}
|
|
|
|
type authTokenResetRequest struct {
|
|
ManagerID string `json:"manager_id"`
|
|
Identifier string `json:"identifier"`
|
|
Padding string `json:"padding"`
|
|
HMAC string `json:"hmac"`
|
|
}
|
|
type authTokenResetResponse struct {
|
|
Token string `json:"token"`
|
|
ExpireTime string `json:"expire_time"` // ignored for now, so left as string and not parsed.
|
|
}
|
|
|
|
type errorMessage struct {
|
|
Message string `json:"_message"`
|
|
}
|
|
|
|
// URLConfigOptions contains a URL with some metadata
|
|
type URLConfigOptions struct {
|
|
URL string `yaml:"url"`
|
|
IsUsedForSetup bool `yaml:"is_used_for_setup,omitempty"` // currently in use to access the web setup
|
|
IsCurrentInConfig bool `yaml:"is_current_in_config,omitempty"` // currently configured as "own_url"
|
|
}
|
|
|
|
// setupData is what is sent back & forth between the web interface and Flamenco Manager.
|
|
type setupData struct {
|
|
OwnURLs []URLConfigOptions `yaml:"own_urls"`
|
|
Config flamenco.Conf `yaml:"config"`
|
|
}
|