new tiers, cached app links
This commit is contained in:
parent
d043c6dfe3
commit
e652aa2c63
@ -13,172 +13,297 @@ type AppLink struct {
|
|||||||
Description string
|
Description string
|
||||||
SpecialNote string
|
SpecialNote string
|
||||||
LDAP bool
|
LDAP bool
|
||||||
|
Tiers map[string]bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func getAppLinks(tier, baseUri string) []AppLink {
|
func getAppLinks(tier, baseUri string) []AppLink {
|
||||||
var output []AppLink
|
var links []AppLink
|
||||||
|
|
||||||
//Get Links Based on Tier
|
//Get Links Based on Tier, and replace link {BASEURI} with baseUri
|
||||||
if tier == "enterprise" {
|
for _, link := range allAppLinks {
|
||||||
output = getEnterpriseLinks(baseUri)
|
if link.Tiers[tier] {
|
||||||
} else if tier == "creator" {
|
link.Url = strings.ReplaceAll(link.Url, "{BASEURI}", baseUri)
|
||||||
output = getCreatorLinks(baseUri)
|
links = append(links, link)
|
||||||
} else if tier == "teams" {
|
}
|
||||||
output = getTeamsLinks(baseUri)
|
|
||||||
} else {
|
|
||||||
output = getStarterLinks(baseUri)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Sort in alphabetical order
|
//Sort in alphabetical order
|
||||||
slices.SortFunc(output, func(a, b AppLink) int {
|
slices.SortFunc(links, func(a, b AppLink) int {
|
||||||
return strings.Compare(a.Title, b.Title)
|
return strings.Compare(a.Title, b.Title)
|
||||||
})
|
})
|
||||||
|
|
||||||
return output
|
return links
|
||||||
}
|
}
|
||||||
|
|
||||||
func getStarterLinks(baseUri string) []AppLink {
|
var allAppLinks = []AppLink{
|
||||||
return []AppLink {
|
{
|
||||||
{
|
Title: "Panel",
|
||||||
Title: "Panel",
|
Description: "Create & Manage Users",
|
||||||
Description: "Create & Manage Users",
|
Image: "/static/img/users.png",
|
||||||
Image: "/static/img/users.png",
|
Url: "https://panel.{BASEURI}/log_in/",
|
||||||
Url: "https://panel." + baseUri + "/log_in/",
|
LDAP: true,
|
||||||
LDAP: true,
|
DocumentationUrl: "https://documentation.federated.computer/docs/core_applications/panel/",
|
||||||
DocumentationUrl: "https://documentation.federated.computer/docs/core_applications/panel/",
|
Tiers: map[string]bool {
|
||||||
|
"starter": true,
|
||||||
|
"creator": true,
|
||||||
|
"teams": true,
|
||||||
|
"enterprise": true,
|
||||||
|
"free": true,
|
||||||
|
"good": true,
|
||||||
|
"better": true,
|
||||||
|
"best": true,
|
||||||
},
|
},
|
||||||
{
|
},
|
||||||
Title: "Nextcloud",
|
{
|
||||||
Description: "Email, Files, Documents",
|
Title: "Nextcloud",
|
||||||
Image: "/static/img/nextcloud.png",
|
Description: "Email, Files, Documents",
|
||||||
Url: "https://nextcloud." + baseUri,
|
Image: "/static/img/nextcloud.png",
|
||||||
LDAP: true,
|
Url: "https://nextcloud.{BASEURI}",
|
||||||
DocumentationUrl: "https://docs.nextcloud.com/server/latest/user_manual/en/",
|
LDAP: true,
|
||||||
|
DocumentationUrl: "https://docs.nextcloud.com/server/latest/user_manual/en/",
|
||||||
|
Tiers: map[string]bool {
|
||||||
|
"starter": true,
|
||||||
|
"creator": true,
|
||||||
|
"teams": true,
|
||||||
|
"enterprise": true,
|
||||||
|
"free": false,
|
||||||
|
"good": true,
|
||||||
|
"better": true,
|
||||||
|
"best": true,
|
||||||
},
|
},
|
||||||
{
|
},
|
||||||
Title: "Vaultwarden",
|
{
|
||||||
Description: "Passwords",
|
Title: "Vaultwarden",
|
||||||
Image: "/static/img/vaultwarden.png",
|
Description: "Passwords",
|
||||||
Url: "https://vaultwarden." + baseUri,
|
Image: "/static/img/vaultwarden.png",
|
||||||
LDAP: false,
|
Url: "https://vaultwarden.{BASEURI}",
|
||||||
SpecialNote: "Must create your own admin user at setup.",
|
LDAP: false,
|
||||||
DocumentationUrl: "https://bitwarden.com/help/onboarding-and-succession/",
|
SpecialNote: "Must create your own admin user at setup.",
|
||||||
|
DocumentationUrl: "https://bitwarden.com/help/onboarding-and-succession/",
|
||||||
|
Tiers: map[string]bool {
|
||||||
|
"starter": true,
|
||||||
|
"creator": true,
|
||||||
|
"teams": true,
|
||||||
|
"enterprise": true,
|
||||||
|
"free": true,
|
||||||
|
"good": true,
|
||||||
|
"better": true,
|
||||||
|
"best": true,
|
||||||
},
|
},
|
||||||
{
|
},
|
||||||
Title: "Power DNS",
|
{
|
||||||
Description: "DNS Management",
|
Title: "Power DNS",
|
||||||
Image: "/static/img/powerdns.png",
|
Description: "DNS Management",
|
||||||
Url: "https://powerdns." + baseUri,
|
Image: "/static/img/powerdns.png",
|
||||||
LDAP: false,
|
Url: "https://powerdns.{BASEURI}",
|
||||||
DocumentationUrl: "https://doc.powerdns.com/",
|
LDAP: false,
|
||||||
|
DocumentationUrl: "https://doc.powerdns.com/",
|
||||||
|
Tiers: map[string]bool {
|
||||||
|
"starter": true,
|
||||||
|
"creator": true,
|
||||||
|
"teams": true,
|
||||||
|
"enterprise": true,
|
||||||
|
"free": true,
|
||||||
|
"good": true,
|
||||||
|
"better": true,
|
||||||
|
"best": true,
|
||||||
},
|
},
|
||||||
{
|
},
|
||||||
Title: "Roundcube",
|
{
|
||||||
Description: "Web Mail",
|
Title: "Roundcube",
|
||||||
Image: "/static/img/roundcube.png",
|
Description: "Web Mail",
|
||||||
Url: "https://roundcube." + baseUri,
|
Image: "/static/img/roundcube.png",
|
||||||
LDAP: true,
|
Url: "https://roundcube.{BASEURI}",
|
||||||
DocumentationUrl: "https://roundcube.net/support/",
|
LDAP: true,
|
||||||
|
DocumentationUrl: "https://roundcube.net/support/",
|
||||||
|
Tiers: map[string]bool {
|
||||||
|
"starter": true,
|
||||||
|
"creator": true,
|
||||||
|
"teams": true,
|
||||||
|
"enterprise": true,
|
||||||
|
"free": false,
|
||||||
|
"good": true,
|
||||||
|
"better": true,
|
||||||
|
"best": true,
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
Title: "Element",
|
||||||
|
Description: "Team Chat",
|
||||||
|
Image: "/static/img/element.png",
|
||||||
|
Url: "https://element.{BASEURI}",
|
||||||
|
LDAP: true,
|
||||||
|
DocumentationUrl: "https://element.io/user-guide",
|
||||||
|
Tiers: map[string]bool {
|
||||||
|
"starter": false,
|
||||||
|
"creator": true,
|
||||||
|
"teams": true,
|
||||||
|
"enterprise": true,
|
||||||
|
"free": false,
|
||||||
|
"good": false,
|
||||||
|
"better": true,
|
||||||
|
"best": true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Title: "Wordpress",
|
||||||
|
Description: "Your Website",
|
||||||
|
Image: "/static/img/wordpress.png",
|
||||||
|
Url: "https://{BASEURI}/wp-admin",
|
||||||
|
LDAP: false,
|
||||||
|
DocumentationUrl: "https://wordpress.org/documentation/",
|
||||||
|
Tiers: map[string]bool {
|
||||||
|
"starter": false,
|
||||||
|
"creator": true,
|
||||||
|
"teams": true,
|
||||||
|
"enterprise": true,
|
||||||
|
"free": false,
|
||||||
|
"good": true,
|
||||||
|
"better": true,
|
||||||
|
"best": true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Title: "Espo CRM",
|
||||||
|
Description: "Customer Relationship Manager",
|
||||||
|
Image: "/static/img/espo.png",
|
||||||
|
Url: "https://espocrm.{BASEURI}",
|
||||||
|
LDAP: true,
|
||||||
|
DocumentationUrl: "https://docs.espocrm.com/user-guide/sales-management/",
|
||||||
|
Tiers: map[string]bool {
|
||||||
|
"starter": false,
|
||||||
|
"creator": false,
|
||||||
|
"teams": true,
|
||||||
|
"enterprise": true,
|
||||||
|
"free": false,
|
||||||
|
"good": false,
|
||||||
|
"better": true,
|
||||||
|
"best": true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Title: "FreeScout",
|
||||||
|
Description: "Customer Help Desk",
|
||||||
|
Image: "/static/img/freescout.png",
|
||||||
|
Url: "https://freescout.{BASEURI}",
|
||||||
|
LDAP: false,
|
||||||
|
DocumentationUrl: "https://github.com/freescout-help-desk/freescout/wiki/FAQ",
|
||||||
|
Tiers: map[string]bool {
|
||||||
|
"starter": false,
|
||||||
|
"creator": false,
|
||||||
|
"teams": true,
|
||||||
|
"enterprise": true,
|
||||||
|
"free": false,
|
||||||
|
"good": false,
|
||||||
|
"better": false,
|
||||||
|
"best": true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Title: "Jitsi",
|
||||||
|
Description: "Video Chat",
|
||||||
|
Image: "/static/img/jitsi.png",
|
||||||
|
Url: "https://jitsi.{BASEURI}",
|
||||||
|
LDAP: true,
|
||||||
|
DocumentationUrl: "https://jitsi.github.io/handbook/docs/intro/",
|
||||||
|
Tiers: map[string]bool {
|
||||||
|
"starter": false,
|
||||||
|
"creator": false,
|
||||||
|
"teams": false,
|
||||||
|
"enterprise": true,
|
||||||
|
"free": false,
|
||||||
|
"good": false,
|
||||||
|
"better": true,
|
||||||
|
"best": true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Title: "Listmonk",
|
||||||
|
Description: "Email Marketing",
|
||||||
|
Image: "/static/img/listmonk.png",
|
||||||
|
Url: "https://listmonk.{BASEURI}",
|
||||||
|
LDAP: false,
|
||||||
|
DocumentationUrl: "https://listmonk.app/docs/concepts/",
|
||||||
|
Tiers: map[string]bool {
|
||||||
|
"starter": false,
|
||||||
|
"creator": false,
|
||||||
|
"teams": false,
|
||||||
|
"enterprise": true,
|
||||||
|
"free": false,
|
||||||
|
"good": false,
|
||||||
|
"better": false,
|
||||||
|
"best": true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Title: "Baserow",
|
||||||
|
Description: "Visual Databases",
|
||||||
|
Image: "/static/img/baserow.png",
|
||||||
|
Url: "https://baserow.{BASEURI}",
|
||||||
|
LDAP: false,
|
||||||
|
DocumentationUrl: "https://baserow.io/user-docs",
|
||||||
|
Tiers: map[string]bool {
|
||||||
|
"starter": false,
|
||||||
|
"creator": false,
|
||||||
|
"teams": false,
|
||||||
|
"enterprise": true,
|
||||||
|
"free": false,
|
||||||
|
"good": false,
|
||||||
|
"better": false,
|
||||||
|
"best": true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Title: "Bookstack",
|
||||||
|
Description: "Wiki Knowledgebase",
|
||||||
|
Image: "/static/img/bookstack.png",
|
||||||
|
Url: "https://bookstack.{BASEURI}",
|
||||||
|
LDAP: false,
|
||||||
|
DocumentationUrl: "https://www.bookstackapp.com/docs/",
|
||||||
|
Tiers: map[string]bool {
|
||||||
|
"starter": false,
|
||||||
|
"creator": false,
|
||||||
|
"teams": false,
|
||||||
|
"enterprise": true,
|
||||||
|
"free": false,
|
||||||
|
"good": false,
|
||||||
|
"better": false,
|
||||||
|
"best": true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Title: "Gitea",
|
||||||
|
Description: "GIT Source Control",
|
||||||
|
Image: "/static/img/gitea.png",
|
||||||
|
Url: "https://gitea.{BASEURI}",
|
||||||
|
LDAP: false,
|
||||||
|
DocumentationUrl: "https://docs.gitea.com/category/usage",
|
||||||
|
Tiers: map[string]bool {
|
||||||
|
"starter": false,
|
||||||
|
"creator": false,
|
||||||
|
"teams": false,
|
||||||
|
"enterprise": true,
|
||||||
|
"free": false,
|
||||||
|
"good": false,
|
||||||
|
"better": false,
|
||||||
|
"best": true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Title: "Castopod",
|
||||||
|
Description: "Podcast Distribution",
|
||||||
|
Image: "/static/img/castopod.png",
|
||||||
|
Url: "https://castopod.{BASEURI}/cp-auth/login",
|
||||||
|
LDAP: false,
|
||||||
|
Tiers: map[string]bool {
|
||||||
|
"starter": false,
|
||||||
|
"creator": false,
|
||||||
|
"teams": false,
|
||||||
|
"enterprise": true,
|
||||||
|
"free": false,
|
||||||
|
"good": false,
|
||||||
|
"better": false,
|
||||||
|
"best": false,
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func getCreatorLinks(baseUri string) []AppLink {
|
|
||||||
creatorLinks := []AppLink {
|
|
||||||
{
|
|
||||||
Title: "Element",
|
|
||||||
Description: "Team Chat",
|
|
||||||
Image: "/static/img/element.png",
|
|
||||||
Url: "https://element." + baseUri,
|
|
||||||
LDAP: true,
|
|
||||||
DocumentationUrl: "https://element.io/user-guide",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Title: "Wordpress",
|
|
||||||
Description: "Your Website",
|
|
||||||
Image: "/static/img/wordpress.png",
|
|
||||||
Url: "https://" + baseUri + "/wp-admin",
|
|
||||||
LDAP: false,
|
|
||||||
DocumentationUrl: "https://wordpress.org/documentation/",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
return append(creatorLinks, getStarterLinks(baseUri)...)
|
|
||||||
}
|
|
||||||
|
|
||||||
func getTeamsLinks(baseUri string) []AppLink {
|
|
||||||
teamsLinks := []AppLink {
|
|
||||||
{
|
|
||||||
Title: "Espo CRM",
|
|
||||||
Description: "Customer Relationship Manager",
|
|
||||||
Image: "/static/img/espo.png",
|
|
||||||
Url: "https://espocrm." + baseUri,
|
|
||||||
LDAP: true,
|
|
||||||
DocumentationUrl: "https://docs.espocrm.com/user-guide/sales-management/",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Title: "FreeScout",
|
|
||||||
Description: "Customer Help Desk",
|
|
||||||
Image: "/static/img/freescout.png",
|
|
||||||
Url: "https://freescout." + baseUri,
|
|
||||||
LDAP: false,
|
|
||||||
DocumentationUrl: "https://github.com/freescout-help-desk/freescout/wiki/FAQ",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
return append(teamsLinks, getCreatorLinks(baseUri)...)
|
|
||||||
}
|
|
||||||
|
|
||||||
func getEnterpriseLinks(baseUri string) []AppLink {
|
|
||||||
enterpriseLinks := []AppLink{
|
|
||||||
{
|
|
||||||
Title: "Jitsi",
|
|
||||||
Description: "Video Chat",
|
|
||||||
Image: "/static/img/jitsi.png",
|
|
||||||
Url: "https://jitsi." + baseUri,
|
|
||||||
LDAP: true,
|
|
||||||
DocumentationUrl: "https://jitsi.github.io/handbook/docs/intro/",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Title: "Listmonk",
|
|
||||||
Description: "Email Marketing",
|
|
||||||
Image: "/static/img/listmonk.png",
|
|
||||||
Url: "https://listmonk." + baseUri,
|
|
||||||
LDAP: false,
|
|
||||||
DocumentationUrl: "https://listmonk.app/docs/concepts/",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Title: "Baserow",
|
|
||||||
Description: "Visual Databases",
|
|
||||||
Image: "/static/img/baserow.png",
|
|
||||||
Url: "https://baserow." + baseUri,
|
|
||||||
LDAP: false,
|
|
||||||
DocumentationUrl: "https://baserow.io/user-docs",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Title: "Bookstack",
|
|
||||||
Description: "Wiki Knowledgebase",
|
|
||||||
Image: "/static/img/bookstack.png",
|
|
||||||
Url: "https://bookstack." + baseUri,
|
|
||||||
LDAP: false,
|
|
||||||
DocumentationUrl: "https://www.bookstackapp.com/docs/",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Title: "Gitea",
|
|
||||||
Description: "GIT Source Control",
|
|
||||||
Image: "/static/img/gitea.png",
|
|
||||||
Url: "https://gitea." + baseUri,
|
|
||||||
LDAP: false,
|
|
||||||
DocumentationUrl: "https://docs.gitea.com/category/usage",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Title: "Castopod",
|
|
||||||
Description: "Podcast Distribution",
|
|
||||||
Image: "/static/img/castopod.png",
|
|
||||||
Url: "https://castopod." + baseUri + "/cp-auth/login",
|
|
||||||
LDAP: false,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
return append(enterpriseLinks, getTeamsLinks(baseUri)...)
|
|
||||||
}
|
|
@ -6,10 +6,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (app *application) home(writer http.ResponseWriter, request *http.Request) {
|
func (app *application) home(writer http.ResponseWriter, request *http.Request) {
|
||||||
appLinks := getAppLinks(app.tier, app.domain)
|
|
||||||
|
|
||||||
data := templateData{
|
data := templateData{
|
||||||
AppLinks: appLinks,
|
AppLinks: app.appLinks,
|
||||||
Tier: app.tier,
|
Tier: app.tier,
|
||||||
BaseUri: app.domain,
|
BaseUri: app.domain,
|
||||||
}
|
}
|
||||||
@ -26,9 +24,9 @@ func (app *application) vpn(writer http.ResponseWriter, request *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (app *application) appList(writer http.ResponseWriter, request *http.Request) {
|
func (app *application) appList(writer http.ResponseWriter, request *http.Request) {
|
||||||
appLinks := getAppLinks(app.tier, app.domain)
|
writer.Header().Set("Content-Type", "application/json")
|
||||||
writer.Header().Set("Content-Type", "application/json")
|
|
||||||
data, err := json.Marshal(appLinks)
|
data, err := json.Marshal(app.appLinks)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
app.serverError(writer, request, err)
|
app.serverError(writer, request, err)
|
||||||
|
@ -12,6 +12,7 @@ type application struct {
|
|||||||
templateCache map[string]*template.Template
|
templateCache map[string]*template.Template
|
||||||
tier string
|
tier string
|
||||||
domain string
|
domain string
|
||||||
|
appLinks []AppLink
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -22,7 +23,7 @@ func main() {
|
|||||||
//Get env variables
|
//Get env variables
|
||||||
tier := os.Getenv("TIER")
|
tier := os.Getenv("TIER")
|
||||||
if len(tier) == 0 {
|
if len(tier) == 0 {
|
||||||
tier = "starter"
|
tier = "good"
|
||||||
}
|
}
|
||||||
domain := os.Getenv("DOMAIN")
|
domain := os.Getenv("DOMAIN")
|
||||||
if len(domain) == 0 {
|
if len(domain) == 0 {
|
||||||
@ -35,14 +36,17 @@ func main() {
|
|||||||
logger.Error(err.Error())
|
logger.Error(err.Error())
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
//Set up app links cache
|
||||||
|
appLinks := getAppLinks(tier, domain)
|
||||||
//Set up application data
|
//Set up application data
|
||||||
app := application {
|
app := application {
|
||||||
logger: logger,
|
logger: logger,
|
||||||
templateCache: templateCache,
|
templateCache: templateCache,
|
||||||
tier: tier,
|
tier: tier,
|
||||||
domain: domain,
|
domain: domain,
|
||||||
|
appLinks: appLinks,
|
||||||
}
|
}
|
||||||
|
//start server
|
||||||
err = http.ListenAndServe(":8080", app.routes())
|
err = http.ListenAndServe(":8080", app.routes())
|
||||||
logger.Error(err.Error())
|
logger.Error(err.Error())
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user