Merge remote-tracking branch 'origin/master' into feat-settings-ui

feat-otp-verification
James Elliott 2023-03-12 11:41:31 +11:00
commit e584e0c4a3
No known key found for this signature in database
GPG Key ID: 0F1C4A096E857E49
5 changed files with 50 additions and 12 deletions

View File

@ -118,14 +118,14 @@ func codeScriptsRunE(cmd *cobra.Command, args []string) (err error) {
return err return err
} }
if resp, err = http.Get("https://api.github.com/repos/swagger-api/swagger-ui/tags"); err != nil { if resp, err = http.Get("https://api.github.com/repos/swagger-api/swagger-ui/releases/latest"); err != nil {
return fmt.Errorf("failed to get latest version of the Swagger UI: %w", err) return fmt.Errorf("failed to get latest version of the Swagger UI: %w", err)
} }
defer resp.Body.Close() defer resp.Body.Close()
var ( var (
respJSON []GitHubTagsJSON respJSON GitHubReleasesJSON
respRaw []byte respRaw []byte
) )
@ -137,14 +137,10 @@ func codeScriptsRunE(cmd *cobra.Command, args []string) (err error) {
return fmt.Errorf("failed to get latest version of the Swagger UI: %w", err) return fmt.Errorf("failed to get latest version of the Swagger UI: %w", err)
} }
if len(respJSON) < 1 { if strings.HasPrefix(respJSON.TagName, "v") {
return fmt.Errorf("failed to get latest version of the Swagger UI: the api returned zero results") data.VersionSwaggerUI = respJSON.TagName[1:]
}
if strings.HasPrefix(respJSON[0].Name, "v") {
data.VersionSwaggerUI = respJSON[0].Name[1:]
} else { } else {
data.VersionSwaggerUI = respJSON[0].Name data.VersionSwaggerUI = respJSON.TagName
} }
fullPathScriptsGen := filepath.Join(root, pathScriptsGen) fullPathScriptsGen := filepath.Join(root, pathScriptsGen)

View File

@ -30,6 +30,48 @@ type GitHubTagsJSON struct {
Name string `json:"name"` Name string `json:"name"`
} }
type GitHubReleasesJSON struct {
ID int `json:"id"`
Name string `json:"name"`
TagName string `json:"tag_name"`
TargetCommitISH string `json:"target_commitish"`
NodeID string `json:"node_id"`
Draft bool `json:"draft"`
Prerelease bool `json:"prerelease"`
URL string `json:"url"`
AssetsURL string `json:"assets_url"`
UploadURL string `json:"upload_url"`
HTMLURL string `json:"html_url"`
TarballURL string `json:"tarball_url"`
ZipballURL string `json:"zipball_url"`
Assets []any `json:"assets"`
CreatedAt time.Time `json:"created_at"`
PublishedAt time.Time `json:"published_at"`
Author GitHubAuthorJSON `json:"author"`
Body string `json:"body"`
}
type GitHubAuthorJSON struct {
ID int `json:"id"`
Login string `json:"login"`
NodeID string `json:"node_id"`
AvatarURL string `json:"avatar_url"`
GravatarID string `json:"gravatar_id"`
URL string `json:"url"`
HTMLURL string `json:"html_url"`
FollowersURL string `json:"followers_url"`
FollowingURL string `json:"following_url"`
GistsURL string `json:"gists_url"`
StarredURL string `json:"starred_url"`
SubscriptionsURL string `json:"subscriptions_url"`
OrganizationsURL string `json:"organizations_url"`
ReposURL string `json:"repos_url"`
EventsURL string `json:"events_url"`
ReceivedEventsURL string `json:"received_events_url"`
Type string `json:"type"`
SiteAdmin bool `json:"site_admin"`
}
// DocsDataMisc represents the docs misc data schema. // DocsDataMisc represents the docs misc data schema.
type DocsDataMisc struct { type DocsDataMisc struct {
CSP TemplateCSP `json:"csp"` CSP TemplateCSP `json:"csp"`

View File

@ -7,5 +7,5 @@
package cmd package cmd
const ( const (
versionSwaggerUI = "4.17.0" versionSwaggerUI = "4.18.1"
) )

View File

@ -2,7 +2,7 @@
title: "Accessibility" title: "Accessibility"
description: "Authelia Development Accessibility Guidelines" description: "Authelia Development Accessibility Guidelines"
lead: "This section covers the accessibility guidelines we aim to respect during development." lead: "This section covers the accessibility guidelines we aim to respect during development."
date: 2023-03-06T11:42:13+11:00 date: 2023-03-06T20:17:57+11:00
draft: false draft: false
images: [] images: []
menu: menu:

View File

@ -2,7 +2,7 @@
title: "Frequently Asked Questions" title: "Frequently Asked Questions"
description: "This guide shows a list of other frequently asked question documents as well as some general ones" description: "This guide shows a list of other frequently asked question documents as well as some general ones"
lead: "This guide shows a list of other frequently asked question documents as well as some general ones." lead: "This guide shows a list of other frequently asked question documents as well as some general ones."
date: 2023-03-06T11:04:10+11:00 date: 2023-03-06T11:32:06+11:00
draft: false draft: false
images: [] images: []
menu: menu: