fix main.css not being served on /topics/

panic when we try to reference an agent which doesn't exist in gen router init
This commit is contained in:
Azareal 2021-02-18 09:37:20 +10:00
parent 1f0713bb27
commit de2221f243
2 changed files with 30 additions and 16 deletions

View File

@ -873,15 +873,22 @@ func init() {
co.SetReverseAgentMapEnum(reverseAgentMapEnum)
co.SetOSMapEnum(osMapEnum)
co.SetReverseOSMapEnum(reverseOSMapEnum)
c.Chrome = agentMapEnum["chrome"]
c.Firefox = agentMapEnum["firefox"]
ame := agentMapEnum
g := func(n string) int {
a, ok := agentMapEnum[n]
if !ok {
panic("name not found in agentMapEnum")
}
return a
}
c.Chrome = g("chrome")
c.Firefox = g("firefox")
c.SimpleBots = []int{
ame["semrush"],
ame["ahrefs"],
ame["python"],
ame["go"],
ame["curl"],
g("semrush"),
g("ahrefs"),
g("python"),
//g("go"),
g("curl"),
}
}

View File

@ -465,15 +465,22 @@ func init() {
co.SetReverseAgentMapEnum(reverseAgentMapEnum)
co.SetOSMapEnum(osMapEnum)
co.SetReverseOSMapEnum(reverseOSMapEnum)
c.Chrome = agentMapEnum["chrome"]
c.Firefox = agentMapEnum["firefox"]
ame := agentMapEnum
g := func(n string) int {
a, ok := agentMapEnum[n]
if !ok {
panic("name not found in agentMapEnum")
}
return a
}
c.Chrome = g("chrome")
c.Firefox = g("firefox")
c.SimpleBots = []int{
ame["semrush"],
ame["ahrefs"],
ame["python"],
ame["go"],
ame["curl"],
g("semrush"),
g("ahrefs"),
g("python"),
//g("go"),
g("curl"),
}
}