Tidied up the UX a bit more
This commit is contained in:
@@ -61,9 +61,6 @@ type Context struct {
|
||||
Results Results
|
||||
Pager *paginator.Paginator
|
||||
|
||||
// Report abuse
|
||||
ReportURL string
|
||||
|
||||
// Reset Password Token
|
||||
PasswordResetToken string
|
||||
|
||||
|
||||
@@ -39,24 +39,6 @@ Kind regards,
|
||||
|
||||
Kind regards,
|
||||
|
||||
{{ .Pod}} Support
|
||||
`))
|
||||
|
||||
reportAbuseEmailTemplate = template.Must(template.New("email").Parse(`Hello {{ .AdminUser }},
|
||||
|
||||
{{ .Name }} <{{ .Email }} from {{ .Pod }} has sent the following abuse report:
|
||||
|
||||
> Category: {{ .Category }}
|
||||
>
|
||||
{{ .Message }}
|
||||
|
||||
The offending user/feed in question is:
|
||||
|
||||
- Nick: {{ .Nick }}
|
||||
- URL: {{ .URL }}
|
||||
|
||||
Kind regards,
|
||||
|
||||
{{ .Pod}} Support
|
||||
`))
|
||||
)
|
||||
@@ -79,19 +61,6 @@ type SupportRequestEmailContext struct {
|
||||
Message string
|
||||
}
|
||||
|
||||
type ReportAbuseEmailContext struct {
|
||||
Pod string
|
||||
AdminUser string
|
||||
|
||||
Nick string
|
||||
URL string
|
||||
|
||||
Name string
|
||||
Email string
|
||||
Category string
|
||||
Message string
|
||||
}
|
||||
|
||||
// indents a block of text with an indent string
|
||||
func Indent(text, indent string) string {
|
||||
if text[len(text)-1:] == "\n" {
|
||||
@@ -184,36 +153,3 @@ func SendSupportRequestEmail(conf *Config, name, email, subject, message string)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func SendReportAbuseEmail(conf *Config, nick, url, name, email, category, message string) error {
|
||||
recipients := []string{conf.AdminEmail, email}
|
||||
emailSubject := fmt.Sprintf(
|
||||
"[%s Report Abuse]: %s",
|
||||
conf.Name, category,
|
||||
)
|
||||
ctx := ReportAbuseEmailContext{
|
||||
Pod: conf.Name,
|
||||
AdminUser: conf.AdminUser,
|
||||
|
||||
Nick: nick,
|
||||
URL: url,
|
||||
|
||||
Name: name,
|
||||
Email: email,
|
||||
Category: category,
|
||||
Message: Indent(message, "> "),
|
||||
}
|
||||
|
||||
buf := &bytes.Buffer{}
|
||||
if err := reportAbuseEmailTemplate.Execute(buf, ctx); err != nil {
|
||||
log.WithError(err).Error("error rendering email template")
|
||||
return err
|
||||
}
|
||||
|
||||
if err := SendEmail(conf, recipients, email, emailSubject, buf.String()); err != nil {
|
||||
log.WithError(err).Errorf("error sending report abuse to %s", recipients[0])
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
---
|
||||
title: Spyda Abuse Policy
|
||||
---
|
||||
|
||||
# Abuse Policy
|
||||
|
||||
> Help us build and maintain a quality search experience.
|
||||
|
||||
At Spyda.search, we believe that the Web should be freely searchable without
|
||||
having to track you or collect data about your searches or behavior. Everyone
|
||||
should be able to benefit from an open search experience without worrying about
|
||||
privacy.
|
||||
|
||||
That being said there are a basic set of guidelines that help ensure that
|
||||
search is of the highest quality and safe to use and considered acceptable
|
||||
by everyone from all backgrounds and walks of live.
|
||||
|
||||
Therefore the following outlines the types of content that Spyda will not
|
||||
permit and if found will be immediately deleted and potenaitlly blacklisted
|
||||
from future indexing.
|
||||
|
||||
**If you have a website or know of a website that has been crawled and indexed
|
||||
that violates these guidelines, please contact us immediately at /support so
|
||||
we can remove the offending data.**
|
||||
|
||||
- **Hate speech:** Any website found to be hosting content that attacks other people on the basis of race, ethnicity, national origin, sexual orientation, gender, gender identity, religious affiliation, age, disability, or disease. We will not index websites whose primary purpose is inciting harm towards others on the basis of these categories.
|
||||
- **Threats of violence:** Any websites found to be treating, planning or otherwise of a treating nature towards others to organize, promote, or incite acts of real-world violence or terrorism.
|
||||
- **Illegal activities**: Any websites found to be hosting content for unlawful purposes or in furtherance of illegal activities. International webmasters agree to comply with all local laws regarding online conduct and acceptable content.
|
||||
|
||||
## What Happens If a Website Violates These Guidelines
|
||||
|
||||
- It will be immediately removed from our indexes.
|
||||
- We _may_ attempt to reach the webmaster to correct the situation.
|
||||
- We _may_ blacklist the website from future indexing.
|
||||
|
||||
Thanks for helping us build and maintain a safe and quality search experience for all!
|
||||
|
||||
We reserve the right to update these guidelines as needed.
|
||||
@@ -12,7 +12,6 @@ const robotsTpl = `User-Agent: *
|
||||
Disallow: /
|
||||
Allow: /
|
||||
Allow: /about
|
||||
Allow: /abuse
|
||||
Allow: /help
|
||||
Allow: /privacy
|
||||
Allow: /support
|
||||
|
||||
@@ -288,7 +288,6 @@ func (s *Server) initRoutes() {
|
||||
s.router.GET("/about", s.PageHandler("about"))
|
||||
s.router.GET("/help", s.PageHandler("help"))
|
||||
s.router.GET("/privacy", s.PageHandler("privacy"))
|
||||
s.router.GET("/abuse", s.PageHandler("abuse"))
|
||||
|
||||
s.router.GET("/", s.IndexHandler())
|
||||
s.router.HEAD("/", s.IndexHandler())
|
||||
@@ -329,14 +328,10 @@ func (s *Server) initRoutes() {
|
||||
s.router.POST("/manage/adduser", s.AddUserHandler())
|
||||
s.router.POST("/manage/deluser", s.DelUserHandler())
|
||||
|
||||
// Support / Report Abuse handlers
|
||||
|
||||
// Support
|
||||
s.router.GET("/support", s.SupportHandler())
|
||||
s.router.POST("/support", s.SupportHandler())
|
||||
s.router.GET("/_captcha", s.CaptchaHandler())
|
||||
|
||||
s.router.GET("/report", s.ReportHandler())
|
||||
s.router.POST("/report", s.ReportHandler())
|
||||
}
|
||||
|
||||
// NewServer ...
|
||||
|
||||
@@ -1,55 +1,3 @@
|
||||
// Creare's 'Implied Consent' EU Cookie Law Banner v:2.4
|
||||
// Conceived by Robert Kent, James Bavington & Tom Foyster
|
||||
|
||||
var dropCookie = true; // false disables the Cookie, allowing you to style the banner
|
||||
var cookieDuration = 14; // Number of days before the cookie expires, and the banner reappears
|
||||
var cookieName = "complianceCookie"; // Name of our cookie
|
||||
var cookieValue = "on"; // Value of cookie
|
||||
|
||||
function createDiv() {
|
||||
u("body").prepend(
|
||||
'<div id="cookie-law" class="container-fluid"><p>This website uses cookies. By continuing we assume your permission to deploy cookies, as detailed in our <a href="/privacy" rel="nofollow" title="Privacy Policy">privacy policy</a>. <a role="button" href="javascript:void(0);" onclick="removeMe();">Close</a></p></div>'
|
||||
);
|
||||
createCookie(window.cookieName, window.cookieValue, window.cookieDuration); // Create the cookie
|
||||
}
|
||||
|
||||
function createCookie(name, value, days) {
|
||||
if (days) {
|
||||
var date = new Date();
|
||||
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
|
||||
var expires = "; expires=" + date.toGMTString();
|
||||
} else var expires = "";
|
||||
if (window.dropCookie) {
|
||||
document.cookie = name + "=" + value + expires + "; path=/";
|
||||
}
|
||||
}
|
||||
|
||||
function checkCookie(name) {
|
||||
var nameEQ = name + "=";
|
||||
var ca = document.cookie.split(";");
|
||||
for (var i = 0; i < ca.length; i++) {
|
||||
var c = ca[i];
|
||||
while (c.charAt(0) == " ") c = c.substring(1, c.length);
|
||||
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function eraseCookie(name) {
|
||||
createCookie(name, "", -1);
|
||||
}
|
||||
|
||||
window.onload = function() {
|
||||
if (checkCookie(window.cookieName) != window.cookieValue) {
|
||||
createDiv();
|
||||
}
|
||||
};
|
||||
|
||||
function removeMe() {
|
||||
var element = document.getElementById("cookie-law");
|
||||
element.parentNode.removeChild(element);
|
||||
}
|
||||
|
||||
u("#burgerMenu").on("click", function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
|
||||
@@ -104,77 +104,3 @@ func (s *Server) SupportHandler() httprouter.Handle {
|
||||
s.render("error", w, ctx)
|
||||
}
|
||||
}
|
||||
|
||||
// ReportHandler ...
|
||||
func (s *Server) ReportHandler() httprouter.Handle {
|
||||
return func(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
|
||||
ctx := NewContext(s.config, s.db, r)
|
||||
|
||||
nick := strings.TrimSpace(r.FormValue("nick"))
|
||||
url := NormalizeURL(r.FormValue("url"))
|
||||
|
||||
if nick == "" || url == "" {
|
||||
ctx.Error = true
|
||||
ctx.Message = "Both nick and url must be specified"
|
||||
s.render("error", w, ctx)
|
||||
return
|
||||
}
|
||||
|
||||
if r.Method == "GET" {
|
||||
ctx.Title = "Report abuse"
|
||||
ctx.ReportURL = url
|
||||
s.render("report", w, ctx)
|
||||
return
|
||||
}
|
||||
|
||||
name := strings.TrimSpace(r.FormValue("name"))
|
||||
email := strings.TrimSpace(r.FormValue("email"))
|
||||
category := strings.TrimSpace(r.FormValue("category"))
|
||||
message := strings.TrimSpace(r.FormValue("message"))
|
||||
|
||||
captchaInput := strings.TrimSpace(r.FormValue("captchaInput"))
|
||||
|
||||
// Get session
|
||||
sess := r.Context().Value(session.SessionKey)
|
||||
if sess == nil {
|
||||
log.Warn("no session found")
|
||||
ctx.Error = true
|
||||
ctx.Message = "no session found, do you have cookies disabled?"
|
||||
s.render("error", w, ctx)
|
||||
return
|
||||
}
|
||||
|
||||
// Get captcha text from session
|
||||
captchaText, isCaptchaTextAvailable := sess.(*session.Session).Get("captchaText")
|
||||
if !isCaptchaTextAvailable {
|
||||
log.Warn("no captcha provided")
|
||||
ctx.Error = true
|
||||
ctx.Message = "no captcha text found"
|
||||
s.render("error", w, ctx)
|
||||
return
|
||||
}
|
||||
|
||||
if captchaInput != captchaText {
|
||||
log.Warn("incorrect captcha")
|
||||
ctx.Error = true
|
||||
ctx.Message = "Unable to match captcha text. Please try again."
|
||||
s.render("error", w, ctx)
|
||||
return
|
||||
}
|
||||
|
||||
if err := SendReportAbuseEmail(s.config, nick, url, name, email, category, message); err != nil {
|
||||
log.WithError(err).Errorf("unable to send report email for %s", email)
|
||||
ctx.Error = true
|
||||
ctx.Message = "Error sending report! Please try again."
|
||||
s.render("error", w, ctx)
|
||||
return
|
||||
}
|
||||
|
||||
ctx.Error = false
|
||||
ctx.Message = fmt.Sprintf(
|
||||
"Thank you for your report! Pod operator %s will get back to you soon!",
|
||||
s.config.AdminName,
|
||||
)
|
||||
s.render("error", w, ctx)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
</li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li><small>Viewing page {{ $.Pager.Page }}/{{ $.Pager.PageNums }} of {{ $.Pager.Nums }} results (Search took: {{ $.SearchTook }})</small></li>
|
||||
<li><small>Page {{ $.Pager.Page }} of {{ $.Pager.PageNums }} matching {{ $.Pager.Nums }} results in {{ $.SearchTook }}</small></li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -102,10 +102,9 @@
|
||||
<div class="footer-menu">
|
||||
<a href="/about" target="_blank" class="menu-item">About</a>
|
||||
<a href="/privacy" target="_blank" class="menu-item">Privacy</a>
|
||||
<a href="/abuse" target="_blank" class="menu-item">Abuse</a>
|
||||
<a href="/help" target="_blank" class="menu-item">Help</a>
|
||||
<a href="/support" target="_blank" class="menu-item">Support</a>
|
||||
<a href="/partner/login" target="_blank">Partner Login</a>
|
||||
<a href="/partner/login" target="_blank">Login</a>
|
||||
</div>
|
||||
</footer>
|
||||
{{ if $.Debug }}
|
||||
|
||||
@@ -22,5 +22,5 @@
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ template "pager" (dict "Pager" $.Pager "SearchQuery" $.SearchQuery) }}
|
||||
{{ template "pager" (dict "Pager" $.Pager "SearchQuery" $.SearchQuery "SearchTook" $.SearchTook) }}
|
||||
{{end}}
|
||||
|
||||
Reference in New Issue
Block a user