Skip to content

Commit

Permalink
Add workaround for #26
Browse files Browse the repository at this point in the history
  • Loading branch information
mrusme committed Feb 13, 2025
1 parent 1650f01 commit 68c781d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ var (
verbose bool
noPretty bool
noReadability bool
noCycleTLS bool
imageMode string
terminalWidth int
validImageModes = []string{"none", "ansi", "ansi-dither", "kitty", "sixel"}
Expand All @@ -49,7 +50,7 @@ type InlineImage struct {
var mdImgRegex = regexp.MustCompile(`(?m)\[{0,1}!\[(:?\]\(.*\)){0,1}(.*)\]\((.+)\)`)
var mdImgPlaceholderRegex = regexp.MustCompile(`(?m)\$\$\$([0-9]*)\$`)

func MakeReadable(rawUrl *string, logger *zap.Logger) (string, string, error) {
func MakeReadable(rawUrl *string, logger *zap.Logger, cycleTLS bool) (string, string, error) {
var crwlr *crawler.Crawler = crawler.New(logger)

crwlr.SetLocation(*rawUrl)
Expand All @@ -64,7 +65,7 @@ func MakeReadable(rawUrl *string, logger *zap.Logger) (string, string, error) {
return "", string(buf.String()), nil
}

article, err := crwlr.GetReadable(true)
article, err := crwlr.GetReadable(cycleTLS)
if err != nil {
return "", "", err
}
Expand Down Expand Up @@ -249,7 +250,7 @@ var rootCmd = &cobra.Command{
}
}

title, content, err := MakeReadable(&rawUrl, logger)
title, content, err := MakeReadable(&rawUrl, logger, !noCycleTLS)
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
Expand Down Expand Up @@ -294,6 +295,12 @@ func Execute() {
false,
"disable making the HTML content readable",
)
rootCmd.Flags().BoolVar(
&noCycleTLS,
"no-cycletls",
false,
"disable use of CycleTLS",
)
rootCmd.Flags().BoolVarP(
&verbose,
"verbose",
Expand Down

0 comments on commit 68c781d

Please sign in to comment.