Fixes from the first round of TEST.md
SEO: a domain property (sc-domain:) covers every subdomain, so the shop, Gitea and forum were counted as the website. What ranks, the morning check, the Monday report, keywords, change candidates and the audit's traffic now read only the website's own host (with or without www). The report keeps pages worth a proposal apart from "Waiting for your yes", explains only moves past the thresholds, and says "places up/down". Also: - Feed summaries drop the posts' scripts and styles. - Spend you log can't be negative. - Test and check buttons can't be clicked twice while they run. - Previews show the site's web fonts and icon sprites. - Backups are read without leaving -wal/-shm files; deleting one removes them, and leftovers are swept at start. - The Overview's setup flags a CRM that Hermes can't reach. - Import now says what came in; adding a prospect that exists says so; prospects can be deleted. - Signal tags and brief addresses keep accented letters (Ü → u). - Page errors start with a capital; clearer messages for bad uploads, CRM retry and cancel, keywords, and the finished audit. - The module you're in stays unfolded in the sidebar. - A picked keyword can be unpicked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+21
-3
@@ -6,6 +6,7 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -344,9 +345,11 @@ func (s *Server) sitesPreviewDelete(w http.ResponseWriter, r *http.Request) {
|
||||
// pages, scripts and all, but whatever a branch holds mustn't be able to
|
||||
// act on Supermarket: sandbox gives each page an origin of its own, so
|
||||
// its requests to the app are cross-site (and refused), and nothing is
|
||||
// sent anywhere else (no analytics from previews).
|
||||
// sent anywhere else (no analytics from previews). Stylesheets and fonts
|
||||
// may come from elsewhere, as web fonts do, so the page looks like the
|
||||
// live one; scripts may not.
|
||||
const previewCSP = "sandbox allow-scripts allow-popups allow-popups-to-escape-sandbox; default-src 'self'; " +
|
||||
"img-src 'self' data: https:; media-src 'self' https:; font-src 'self' data:; style-src 'self' 'unsafe-inline'; " +
|
||||
"img-src 'self' data: https:; media-src 'self' https:; font-src 'self' data: https:; style-src 'self' 'unsafe-inline' https:; " +
|
||||
"script-src 'self' 'unsafe-inline'; connect-src 'none'; form-action 'none'; frame-ancestors 'none'"
|
||||
|
||||
// previewServe serves a built preview.
|
||||
@@ -381,7 +384,22 @@ func (s *Server) previewServe(w http.ResponseWriter, r *http.Request) {
|
||||
h.Set("Content-Security-Policy", previewCSP)
|
||||
h.Set("Cache-Control", "no-store")
|
||||
prefix := strings.TrimSuffix(previewPrefix(site, slug), "/")
|
||||
http.StripPrefix(prefix, http.FileServer(noListing{http.Dir(s.previewDir(cur.Repo, slug))})).ServeHTTP(w, r)
|
||||
dir := s.previewDir(cur.Repo, slug)
|
||||
// A page gets the site's icon sprites inlined (see inlineSprites).
|
||||
if rest := strings.TrimPrefix(r.URL.Path, prefix); rest != r.URL.Path && !strings.Contains(rest, "..") {
|
||||
file := rest
|
||||
if strings.HasSuffix(file, "/") {
|
||||
file += "index.html"
|
||||
}
|
||||
if strings.HasSuffix(file, ".html") {
|
||||
if raw, err := os.ReadFile(filepath.Join(dir, filepath.FromSlash(path.Clean(file)))); err == nil {
|
||||
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
||||
w.Write(inlineSprites(raw, dir, rest))
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
http.StripPrefix(prefix, http.FileServer(noListing{http.Dir(dir)})).ServeHTTP(w, r)
|
||||
}
|
||||
|
||||
// noListing serves files, and folders only through their index.html.
|
||||
|
||||
Reference in New Issue
Block a user