Add functions: ValidateInstitutionId, ValidateUploadDir

This commit is contained in:
2025-02-23 03:56:00 +01:00
parent 2e0f11c79a
commit 35bfb0303b
5 changed files with 223 additions and 0 deletions

View File

@@ -0,0 +1,67 @@
package configloader
type MDWebDavUploaderConfig struct {
InstanceLink string `json:"instance"`
Mail string `json:"mail"`
WebDavAuthToken string `json:"token"`
InstitutionId int `json:"institution_id"`
Parser string `json:"parser"`
MetadataFolder string `json:"metadata_folder"`
MediaFolder string `json:"media_folder"`
PublishOnImport bool `json:"visible"`
}
type ParserListItem struct {
name string
}
// Returns a uniform filepath for the configuration of this tool.
// To be compatible across operating systems, this will be a JSON
// file in the same directory as the current programm.
func getConfigFilepath() string {
}
// Returns a uniform filepath for the cache for the list of
// available parsers.
func getParserCacheFilepath() string {
}
// Loads configuration from the configuration file (located using
// getConfigFilepath()).
func LoadFromFile() MDWebDavUploaderConfig {
}
// Stores a parser list to a cache file (located via
// getParserCacheFilepath()).
func StoreParserList(parserList []ParserListItem) {
}
// Returns a list of the available parsers.
func ListParsers() []ParserListItem {
}
// Checks if inputParser is in the list of available parsers.
// Returns the parser name or an error.
func ValidateParser(inputParser string) (string, error) {
}
// Validates an input mail address.
// Returns the valid mail address or an eQueries therror.
func ValidateMail(mail string) (string, error) {
}
// Validates an entered instance URL.
// Returns the entered URL in a unified form (minus optional
// trailing slashes and the /musdb suffix) or an error.
func ValidateInstanceLink(instanceUrl string) (string, error) {
}