diff --git a/reduxer/example.go b/reduxer/example.go index 86a91625..23ee2951 100644 --- a/reduxer/example.go +++ b/reduxer/example.go @@ -16,57 +16,49 @@ func BundleExample() Reduxer { Img: Asset{ Local: "/path/to/image", Remote: Remote{ - Anonfile: "https://anonfiles.com/FbZfSa9eu4", - Catbox: "https://files.catbox.moe/9u6yvu.png", + Catbox: "https://files.catbox.moe/9u6yvu.png", }, }, PDF: Asset{ Local: "/path/to/pdf", Remote: Remote{ - Anonfile: "https://anonfiles.com/r4G8Sb90ud", - Catbox: "https://files.catbox.moe/q73uqh.pdf", + Catbox: "https://files.catbox.moe/q73uqh.pdf", }, }, Raw: Asset{ Local: "/path/to/htm", Remote: Remote{ - Anonfile: "https://anonfiles.com/pbG4Se94ua", - Catbox: "https://files.catbox.moe/bph1g6.htm", + Catbox: "https://files.catbox.moe/bph1g6.htm", }, }, Txt: Asset{ Local: "/path/to/txt", Remote: Remote{ - Anonfile: "https://anonfiles.com/naG6S09bu1", - Catbox: "https://files.catbox.moe/wwrby6.txt", + Catbox: "https://files.catbox.moe/wwrby6.txt", }, }, HAR: Asset{ Local: "/path/to/har", Remote: Remote{ - Anonfile: "https://anonfiles.com/n1paZfB3ub", - Catbox: "https://files.catbox.moe/3agtva.har", + Catbox: "https://files.catbox.moe/3agtva.har", }, }, HTM: Asset{ Local: "/path/to/single-htm", Remote: Remote{ - Anonfile: "https://anonfiles.com/v4G4S09abc", - Catbox: "", + Catbox: "", }, }, WARC: Asset{ Local: "/path/to/warc", Remote: Remote{ - Anonfile: "https://anonfiles.com/v4G4S09auc", - Catbox: "invalid-url-moe/kkai0w.warc", + Catbox: "invalid-url-moe/kkai0w.warc", }, }, Media: Asset{ Local: "", Remote: Remote{ - Anonfile: "", - Catbox: "", + Catbox: "", }, }, }, diff --git a/reduxer/reduxer.go b/reduxer/reduxer.go index 06244af6..f768d774 100644 --- a/reduxer/reduxer.go +++ b/reduxer/reduxer.go @@ -19,7 +19,6 @@ import ( "github.com/go-shiori/go-readability" "github.com/go-shiori/obelisk" - "github.com/wabarc/go-anonfile" "github.com/wabarc/go-catbox" "github.com/wabarc/helper" "github.com/wabarc/logger" @@ -73,8 +72,7 @@ type Asset struct { // Remote represents the file on the remote server. type Remote struct { - Anonfile string - Catbox string + Catbox string } // Src represents the requested url. @@ -317,7 +315,6 @@ func remotely(ctx context.Context, artifact *Artifact) (err error) { } cat := catbox.New(ingress.Client()) - anon := anonfile.NewAnonfile(ingress.Client()) g, _ := errgroup.WithContext(ctx) var mu sync.RWMutex @@ -333,22 +330,12 @@ func remotely(ctx context.Context, artifact *Artifact) (err error) { g.Go(func() error { var remote Remote mu.Lock() - func() { - r, e := anon.Upload(asset.Local) - if e != nil { - err = errors.Wrap(err, fmt.Sprintf("upload %s to anonfiles failed: %v", asset.Local, e)) - } else { - remote.Anonfile = r.Short() - } - }() - func() { - c, e := cat.Upload(asset.Local) - if e != nil { - err = errors.Wrap(err, fmt.Sprintf("upload %s to catbox failed: %v", asset.Local, e)) - } else { - remote.Catbox = c - } - }() + c, e := cat.Upload(asset.Local) + if e != nil { + err = errors.Wrap(err, fmt.Sprintf("upload %s to catbox failed: %v", asset.Local, e)) + } else { + remote.Catbox = c + } asset.Remote = remote mu.Unlock() return nil diff --git a/template/render/github.go b/template/render/github.go index e9677230..17d35cc4 100644 --- a/template/render/github.go +++ b/template/render/github.go @@ -66,12 +66,7 @@ func (gh *GitHub) ForPublish() *Render { } func (gh *GitHub) parseArtifact(assets reduxer.Artifact, tmplBytes *bytes.Buffer) { - tmpl := `**[AnonFiles](https://anonfiles.com/)** - [ [IMG]({{ .Img.Remote.Anonfile | url -}} -) ¦ [PDF]({{ .PDF.Remote.Anonfile | url }}) ¦ [RAW]({{ .Raw.Remote.Anonfile | url -}} -) ¦ [TXT]({{ .Txt.Remote.Anonfile | url }}) ¦ [HAR]({{ .HAR.Remote.Anonfile | url -}} -) ¦ [HTM]({{ .HTM.Remote.Anonfile | url }}) ¦ [WARC]({{ .WARC.Remote.Anonfile | url -}} -) ¦ [MEDIA]({{ .Media.Remote.Anonfile | url }}) ] -**[Catbox](https://catbox.moe/)** - [ [IMG]({{ .Img.Remote.Catbox | url -}} + tmpl := `**[Catbox](https://catbox.moe/)** - [ [IMG]({{ .Img.Remote.Catbox | url -}} ) ¦ [PDF]({{ .PDF.Remote.Catbox | url }}) ¦ [RAW]({{ .Raw.Remote.Catbox | url -}} ) ¦ [TXT]({{ .Txt.Remote.Catbox | url }}) ¦ [HAR]({{ .HAR.Remote.Catbox | url -}} ) ¦ [HTM]({{ .HTM.Remote.Catbox | url }}) ¦ [WARC]({{ .WARC.Remote.Catbox | url -}} diff --git a/template/render/github_test.go b/template/render/github_test.go index 159c2aad..8b6b8bf8 100644 --- a/template/render/github_test.go +++ b/template/render/github_test.go @@ -105,7 +105,6 @@ More information... > source: [https://example.com/](https://example.com/) > archived: [http://telegra.ph/title-01-01](http://telegra.ph/title-01-01) -**[AnonFiles](https://anonfiles.com/)** - [ [IMG](https://anonfiles.com/FbZfSa9eu4) ¦ [PDF](https://anonfiles.com/r4G8Sb90ud) ¦ [RAW](https://anonfiles.com/pbG4Se94ua) ¦ [TXT](https://anonfiles.com/naG6S09bu1) ¦ [HAR](https://anonfiles.com/n1paZfB3ub) ¦ [HTM](https://anonfiles.com/v4G4S09abc) ¦ [WARC](https://anonfiles.com/v4G4S09auc) ¦ [MEDIA]() ] **[Catbox](https://catbox.moe/)** - [ [IMG](https://files.catbox.moe/9u6yvu.png) ¦ [PDF](https://files.catbox.moe/q73uqh.pdf) ¦ [RAW](https://files.catbox.moe/bph1g6.htm) ¦ [TXT](https://files.catbox.moe/wwrby6.txt) ¦ [HAR](https://files.catbox.moe/3agtva.har) ¦ [HTM]() ¦ [WARC]() ¦ [MEDIA]() ]` got := ForPublish(&GitHub{Cols: collects, Data: bundleExample}).String() diff --git a/template/render/matrix.go b/template/render/matrix.go index 464ebc6b..7e5c1e3b 100644 --- a/template/render/matrix.go +++ b/template/render/matrix.go @@ -100,12 +100,7 @@ func (m *Matrix) ForPublish() *Render { } func (m *Matrix) parseArtifact(assets reduxer.Artifact, tmplBytes *bytes.Buffer) { - tmpl := `AnonFiles - [ IMG ¦ PDF ¦ RAW ¦ TXT ¦ HAR ¦ HTM ¦ WARC ¦ MEDIA ]
-Catbox - [ Catbox - [ IMG ¦ PDF ¦ RAW ¦ TXT ¦ HAR ¦ HTM ¦ source - http://telegra.ph/title-01-01

-AnonFiles - [ IMG ¦ PDF ¦ RAW ¦ TXT ¦ HAR ¦ HTM ¦ WARC ¦ MEDIA ]
Catbox - [ IMG ¦ PDF ¦ RAW ¦ TXT ¦ HAR ¦ HTM ¦ WARC ¦ MEDIA ]` got := ForPublish(&Matrix{Cols: collects, Data: bundleExample}).String() @@ -47,7 +46,6 @@ More information...

Internet Archiv Telegraph:
source - http://telegra.ph/title-01-01

-AnonFiles - [ IMG ¦ PDF ¦ RAW ¦ TXT ¦ HAR ¦ HTM ¦ WARC ¦ MEDIA ]
Catbox - [ IMG ¦ PDF ¦ RAW ¦ TXT ¦ HAR ¦ HTM ¦ WARC ¦ MEDIA ]` got := ForPublish(&Matrix{Cols: collects, Data: bundleExample}).String() @@ -69,7 +67,6 @@ func TestRenderMatrixForReply(t *testing.T) { Telegraph:
source - http://telegra.ph/title-01-01

-AnonFiles - [ IMG ¦ PDF ¦ RAW ¦ TXT ¦ HAR ¦ HTM ¦ WARC ¦ MEDIA ]
Catbox - [ IMG ¦ PDF ¦ RAW ¦ TXT ¦ HAR ¦ HTM ¦ WARC ¦ MEDIA ]` got := ForReply(&Matrix{Cols: collects, Data: bundleExample}).String() diff --git a/template/render/slack.go b/template/render/slack.go index b38451b9..ffc27ac4 100644 --- a/template/render/slack.go +++ b/template/render/slack.go @@ -90,12 +90,7 @@ func (s *Slack) ForPublish() (r *Render) { } func (s *Slack) parseArtifact(assets reduxer.Artifact, tmplBytes *bytes.Buffer) { - tmpl := ` - [ <{{ .Img.Remote.Anonfile | url -}} -|IMG> ¦ <{{ .PDF.Remote.Anonfile | url }}|PDF> ¦ <{{ .Raw.Remote.Anonfile | url -}} -|RAW> ¦ <{{ .Txt.Remote.Anonfile | url }}|TXT> ¦ <{{ .HAR.Remote.Anonfile | url -}} -|HAR> ¦ <{{ .HTM.Remote.Anonfile | url }}|HTM> ¦ <{{ .WARC.Remote.Anonfile | url -}} -|WARC> ¦ <{{ .Media.Remote.Anonfile | url }}|MEDIA> ] - - [ <{{ .Img.Remote.Catbox | url -}} + tmpl := ` - [ <{{ .Img.Remote.Catbox | url -}} |IMG> ¦ <{{ .PDF.Remote.Catbox | url }}|PDF> ¦ <{{ .Raw.Remote.Catbox | url -}} |RAW> ¦ <{{ .Txt.Remote.Catbox | url }}|TXT> ¦ <{{ .HAR.Remote.Catbox | url -}} |HAR> ¦ <{{ .HTM.Remote.Catbox | url }}|HTM> ¦ <{{ .WARC.Remote.Catbox | url -}} diff --git a/template/render/slack_test.go b/template/render/slack_test.go index 3446a0c9..7d7468db 100644 --- a/template/render/slack_test.go +++ b/template/render/slack_test.go @@ -28,7 +28,6 @@ Telegraph: • http://telegra.ph/title-01-01 - - [ ¦ ¦ ¦ ¦ ¦ ¦ ¦ <|MEDIA> ] - [ ¦ ¦ ¦ ¦ ¦ <|HTM> ¦ <|WARC> ¦ <|MEDIA> ]` got := ForPublish(&Slack{Cols: collects, Data: bundleExample}).String() @@ -70,7 +69,6 @@ archive.today: • http://archive.today/abc - - [ ¦ ¦ ¦ ¦ ¦ ¦ ¦ <|MEDIA> ] - [ ¦ ¦ ¦ ¦ ¦ <|HTM> ¦ <|WARC> ¦ <|MEDIA> ]` got := ForReply(&Slack{Cols: multi, Data: bundleExample}).String() diff --git a/template/render/telegram.go b/template/render/telegram.go index 335c1d89..054d89b5 100644 --- a/template/render/telegram.go +++ b/template/render/telegram.go @@ -100,12 +100,7 @@ func (t *Telegram) ForPublish() (r *Render) { } func (t *Telegram) parseArtifact(assets reduxer.Artifact, tmplBytes *bytes.Buffer) { - tmpl := `AnonFiles - [ IMG ¦ PDF ¦ RAW ¦ TXT ¦ HAR ¦ HTM ¦ WARC ¦ MEDIA ] -Catbox - [ Catbox
- [ IMG ¦ PDF ¦ RAW ¦ TXT ¦ HAR ¦ HTM ¦ AnonFiles - [ IMG ¦ PDF ¦ RAW ¦ TXT ¦ HAR ¦ HTM ¦ WARC ¦ MEDIA ] Catbox - [ IMG ¦ PDF ¦ RAW ¦ TXT ¦ HAR ¦ HTM ¦ WARC ¦ MEDIA ] #wayback #存档` @@ -43,7 +42,6 @@ func TestRenderTelegram(t *testing.T) { func TestRenderTelegramForPublishWithArtifact(t *testing.T) { message := message + ` -AnonFiles - [ IMG ¦ PDF ¦ RAW ¦ TXT ¦ HAR ¦ HTM ¦ WARC ¦ MEDIA ] Catbox - [ IMG ¦ PDF ¦ RAW ¦ TXT ¦ HAR ¦ HTM ¦ WARC ¦ MEDIA ] #wayback #存档` @@ -84,7 +82,6 @@ func TestRenderTelegramForReply(t *testing.T) { • source - http://archive.today/abcdEsource - http://archive.today/abc -AnonFiles - [ IMG ¦ PDF ¦ RAW ¦ TXT ¦ HAR ¦ HTM ¦ WARC ¦ MEDIA ] Catbox - [ IMG ¦ PDF ¦ RAW ¦ TXT ¦ HAR ¦ HTM ¦ WARC ¦ MEDIA ] #wayback #存档`