Added the AppleBot user agent.

Added the topic.topic_info_aria phrase to explain the meta block in topics correctly to screen readers.
Added a missing phrase for the FacebookBot user agent.
This commit is contained in:
Azareal 2019-06-01 12:03:04 +10:00
parent 494b4967c5
commit 3f6966d541
5 changed files with 31 additions and 23 deletions

View File

@ -509,14 +509,15 @@ var agentMapEnum = map[string]int{
"cloudflare": 21,
"uptimebot": 22,
"slackbot": 23,
"discourse": 24,
"lynx": 25,
"blank": 26,
"malformed": 27,
"suspicious": 28,
"semrush": 29,
"dotbot": 30,
"zgrab": 31,
"apple": 24,
"discourse": 25,
"lynx": 26,
"blank": 27,
"malformed": 28,
"suspicious": 29,
"semrush": 30,
"dotbot": 31,
"zgrab": 32,
}
var reverseAgentMapEnum = map[int]string{
0: "unknown",
@ -543,14 +544,15 @@ var reverseAgentMapEnum = map[int]string{
21: "cloudflare",
22: "uptimebot",
23: "slackbot",
24: "discourse",
25: "lynx",
26: "blank",
27: "malformed",
28: "suspicious",
29: "semrush",
30: "dotbot",
31: "zgrab",
24: "apple",
25: "discourse",
26: "lynx",
27: "blank",
28: "malformed",
29: "suspicious",
30: "semrush",
31: "dotbot",
32: "zgrab",
}
var markToAgent = map[string]string{
"OPR": "opera",
@ -577,6 +579,7 @@ var markToAgent = map[string]string{
"Twitterbot": "twitter",
"facebookexternalhit": "facebook",
"Facebot": "facebook",
"Applebot": "apple",
"Discourse": "discourse",
"SemrushBot": "semrush",
"DotBot": "dotbot",
@ -705,7 +708,7 @@ func (r *GenRouter) SuspiciousRequest(req *http.Request, prepend string) {
prepend += "\n"
}
r.DumpRequest(req,prepend+"Suspicious Request")
counters.AgentViewCounter.Bump(28)
counters.AgentViewCounter.Bump(29)
}
func isLocalHost(host string) bool {
@ -720,7 +723,7 @@ func (r *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
w.WriteHeader(200) // 400
w.Write([]byte(""))
r.DumpRequest(req,"Malformed Request T"+strconv.Itoa(typ))
counters.AgentViewCounter.Bump(27)
counters.AgentViewCounter.Bump(28)
}
// Split the Host and Port string
@ -844,7 +847,7 @@ func (r *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
ua := strings.TrimSpace(strings.Replace(strings.TrimPrefix(req.UserAgent(),"Mozilla/5.0 ")," Safari/537.36","",-1)) // Noise, no one's going to be running this and it would require some sort of agent ranking system to determine which identifier should be prioritised over another
var agent string
if ua == "" {
counters.AgentViewCounter.Bump(26)
counters.AgentViewCounter.Bump(27)
if c.Dev.DebugMode {
var prepend string
for _, char := range req.UserAgent() {

View File

@ -193,6 +193,8 @@
"cloudflare":"Cloudflare Alwayson",
"uptimebot":"Uptimebot",
"slackbot":"Slackbot",
"facebook":"FacebookBot",
"apple":"AppleBot",
"discourse":"Discourse Forum Onebox",
"lynx":"Lynx",
@ -588,6 +590,7 @@
"forums_none":"None",
"forums_no_forums":"You don't have access to any forums.",
"topic.topic_info_aria":"Topic information",
"topic.opening_post_aria":"The opening post for this topic",
"topic.status_closed_aria":"This topic is locked",
"topic.title_input_aria":"Topic Title Input",

View File

@ -225,6 +225,7 @@ func main() {
"cloudflare",
"uptimebot",
"slackbot",
"apple",
"discourse",
"lynx",
"blank",
@ -266,6 +267,7 @@ func main() {
"Twitterbot",
"facebookexternalhit",
"Facebot",
"Applebot",
"Discourse",
"SemrushBot",
@ -299,6 +301,7 @@ func main() {
"Twitterbot": "twitter",
"facebookexternalhit": "facebook",
"Facebot": "facebook",
"Applebot":"apple",
"Discourse": "discourse",
"SemrushBot": "semrush",

View File

@ -12,7 +12,7 @@
<link rel="canonical" href="//{{.Site.URL}}{{.Topic.Link}}{{if gt .Page 1}}?page={{.Page}}{{end}}" />
<div {{scope "topic_title_block"}} class="rowblock rowhead topic_block" aria-label="{{lang "topic.opening_post_aria"}}">
<div {{scope "topic_title_block"}} class="rowblock rowhead topic_block" aria-label="{{lang "topic.topic_info_aria"}}">
<div class="rowitem topic_item{{if .Topic.Sticky}} topic_sticky_head{{else if .Topic.IsClosed}} topic_closed_head{{end}}">
<h1 class='topic_name hide_on_edit' title='{{.Topic.Title}}'>{{.Topic.Title}}</h1>
{{if .Topic.IsClosed}}<span class='username hide_on_micro topic_status_e topic_status_closed hide_on_edit' title='{{lang "status.closed_tooltip"}}' aria-label='{{lang "topic.status_closed_aria"}}'>&#x1F512;&#xFE0E</span>{{end}}

View File

@ -7,7 +7,7 @@
<link rel="canonical" href="//{{.Site.URL}}{{.Topic.Link}}{{if gt .Page 1}}?page={{.Page}}{{end}}" />
<div {{scope "topic_title_block"}} class="rowblock rowhead topic_block" aria-label="{{lang "topic.opening_post_aria"}}">
<div {{scope "topic_title_block"}} class="rowblock rowhead topic_block" aria-label="{{lang "topic.topic_info_aria"}}">
<div class="rowitem topic_item{{if .Topic.Sticky}} topic_sticky_head{{else if .Topic.IsClosed}} topic_closed_head{{end}}">
<h1 class='topic_name hide_on_edit' title='{{.Topic.Title}}'>{{.Topic.Title}}</h1>
<span class="topic_name_forum_sep hide_on_edit"> - </span>
@ -29,8 +29,7 @@
</div>
<div class="rowblock post_container">
{{if .Poll.ID}}
<form id="poll_{{.Poll.ID}}_form" action="/poll/vote/{{.Poll.ID}}?session={{.CurrentUser.Session}}" method="post"></form>
{{if .Poll.ID}}<form id="poll_{{.Poll.ID}}_form" action="/poll/vote/{{.Poll.ID}}?session={{.CurrentUser.Session}}" method="post"></form>
<article class="rowitem passive deletable_block editable_parent post_item poll_item top_post hide_on_edit">
{{template "topic_alt_userinfo.html" .Topic }}
<div id="poll_voter_{{.Poll.ID}}" class="content_container poll_voter">