diff --git a/cmd/hotdog-cms/main.go b/cmd/hotdog-cms/main.go index e356b30..6d94a51 100644 --- a/cmd/hotdog-cms/main.go +++ b/cmd/hotdog-cms/main.go @@ -46,7 +46,7 @@ Usage: hotdog-cms ci write the CI file for github, gitea, forgejo, gitlab, bitbucket, woodpecker, or a git hook hotdog-cms endpoint -config FILE the small server for form submissions and search, behind your web server hotdog-cms pack add|remove|list|check extensions as files: sections, layouts, styles (docs/packs.md) - hotdog-cms import ... bring a site in: wordpress, wxr, ghost, hugo or jekyll (docs/importing.md) + hotdog-cms import ... move your own site in: wordpress, wxr, ghost, hugo or jekyll (docs/importing.md) hotdog-cms editor -config FILE the editor: sign in with your git platform and work on sites (never on a site's host) Platforms: GitHub, GitLab, Gitea, Forgejo/Codeberg, Gogs, Bitbucket, or any git server. @@ -492,7 +492,7 @@ func report(r *build.Result) { func cmdImport(args []string) error { if len(args) == 0 { - return errors.New("usage: hotdog-cms import [flags] (hotdog-cms import -h for each)") + return errors.New("usage: hotdog-cms import [flags] (hotdog-cms import -h for each)\n" + importer.Ownership) } from, args := args[0], args[1:] fl := flag.NewFlagSet("import "+from, flag.ExitOnError) @@ -519,6 +519,7 @@ func cmdImport(args []string) error { return fmt.Errorf("can't import from %q: wordpress, wxr, ghost, hugo or jekyll", from) } _ = fl.Parse(args) + fmt.Printf("%s\n\n", importer.Ownership) var items []importer.Item var err error opt := importer.Options{SiteDir: *siteDir, Overwrite: *overwrite, Log: os.Stdout} diff --git a/docs/importing.md b/docs/importing.md index e3c994e..4456310 100644 --- a/docs/importing.md +++ b/docs/importing.md @@ -1,5 +1,10 @@ # Importing a site +> **Only import content you own or have the rights to use.** The importers +> are migration tools: they're for moving *your own* site to HotDog CMS from +> the tool it's on now. They're not for copying sites, posts or pictures that +> belong to someone else, and they say so every time they run. + `hotdog-cms import` brings a site in from WordPress, Hugo, Jekyll or Ghost, into a HotDog CMS site made with `hotdog-cms new`: diff --git a/internal/importer/importer_test.go b/internal/importer/importer_test.go index 380077e..8126aef 100644 --- a/internal/importer/importer_test.go +++ b/internal/importer/importer_test.go @@ -153,6 +153,9 @@ func TestWordPressImport(t *testing.T) { if ck.Errors() > 0 { t.Errorf("check errors: %v", ck.Problems) } + if md := rep.Markdown(srv.URL); !strings.Contains(md, "> "+Ownership) { + t.Errorf("the report doesn't open with the ownership note:\n%s", md) + } if md := rep.Markdown(srv.URL); !strings.Contains(md, "with-video.md`: ") || !strings.Contains(md, "an embed") { t.Errorf("report:\n%s", md) } diff --git a/internal/importer/write.go b/internal/importer/write.go index 55df4b8..3f21f32 100644 --- a/internal/importer/write.go +++ b/internal/importer/write.go @@ -475,9 +475,16 @@ func fetch(u, localRoot string) ([]byte, error) { } // WriteReport writes what happened as Markdown, for the person who ran it. +// Ownership is said before every import and at the top of every report: +// the importers are for moving your own site, not for copying anyone else's. +const Ownership = "Import only content you own or have the rights to use. " + + "hotdog-cms import is a migration tool, for moving your own site to HotDog CMS, " + + "not for copying sites, posts or pictures that belong to someone else." + func (r *Report) Markdown(source string) string { var b strings.Builder fmt.Fprintf(&b, "# Import from %s\n\n", source) + fmt.Fprintf(&b, "> %s\n\n", Ownership) fmt.Fprintf(&b, "%d page(s) written, %d skipped (already there), %d picture(s) brought in, %d redirect(s) added.\n\n", len(r.Written), len(r.Skipped), r.Pictures, len(r.Redirects)) if len(r.KeptHTML) > 0 { b.WriteString("## Kept as HTML\n\nMarkdown would have lost something in these, so their HTML was kept (`format: html`). It's sanitized when the site is built, so embeds and scripts are dropped; check how they look.\n\n")