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:
parent
1f0713bb27
commit
de2221f243
|
@ -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"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue