Skip to content

Commit

Permalink
Make wayback to IPFS as default
Browse files Browse the repository at this point in the history
  • Loading branch information
waybackarchiver committed Dec 4, 2021
1 parent 061f04b commit e737095
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 32 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ brew install wayback
```sh
$ wayback -h

A CLI tool for wayback webpages.
A command-line tool and daemon service for archiving webpages.

Usage:
wayback [flags]
Expand All @@ -102,23 +102,23 @@ Examples:
WAYBACK_SECRET=YOUR-PINATA-SECRET wayback --ip https://www.fsf.org

Flags:
--chatid string Telegram channel id.
--chatid string Telegram channel id
-c, --config string Configuration file path, defaults: ./wayback.conf, ~/wayback.conf, /etc/wayback.conf
-d, --daemon strings Run as daemon service, supported services are telegram, web, mastodon, twitter, discord, slack, irc
--debug Enable debug mode. (default false)
--debug Enable debug mode (default mode is false)
-h, --help help for wayback
--ia Wayback webpages to Internet Archive.
--info Show application information.
--ip Wayback webpages to IPFS. (default false)
--ipfs-host string IPFS daemon host, do not require, unless enable ipfs. (default "127.0.0.1")
-m, --ipfs-mode string IPFS mode. (default "pinner")
-p, --ipfs-port uint IPFS daemon port. (default 5001)
--is Wayback webpages to Archive Today.
--ph Wayback webpages to Telegraph. (default false)
--print Show application configurations.
-t, --token string Telegram Bot API Token.
--tor Snapshot webpage via Tor anonymity network.
--tor-key string The private key for Tor Hidden Service.
--ia Wayback webpages to Internet Archive
--info Show application information
--ip Wayback webpages to IPFS
--ipfs-host string IPFS daemon host, do not require, unless enable ipfs (default "127.0.0.1")
-m, --ipfs-mode string IPFS mode (default "pinner")
-p, --ipfs-port uint IPFS daemon port (default 5001)
--is Wayback webpages to Archive Today
--ph Wayback webpages to Telegraph
--print Show application configurations
-t, --token string Telegram Bot API Token
--tor Snapshot webpage via Tor anonymity network
--tor-key string The private key for Tor Hidden Service
-v, --version version for wayback
```

Expand Down
35 changes: 18 additions & 17 deletions cmd/wayback/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var (

rootCmd = &cobra.Command{
Use: "wayback",
Short: "A CLI tool for wayback webpages.",
Short: "A command-line tool and daemon service for archiving webpages.",
Example: ` wayback https://www.wikipedia.org
wayback https://www.fsf.org https://www.eff.org
wayback --ia https://www.fsf.org
Expand All @@ -64,23 +64,23 @@ func main() {
}

func init() {
rootCmd.Flags().BoolVarP(&ia, "ia", "", false, "Wayback webpages to Internet Archive.")
rootCmd.Flags().BoolVarP(&is, "is", "", false, "Wayback webpages to Archive Today.")
rootCmd.Flags().BoolVarP(&ip, "ip", "", false, "Wayback webpages to IPFS. (default false)")
rootCmd.Flags().BoolVarP(&ph, "ph", "", false, "Wayback webpages to Telegraph. (default false)")
rootCmd.Flags().BoolVarP(&ia, "ia", "", false, "Wayback webpages to Internet Archive")
rootCmd.Flags().BoolVarP(&is, "is", "", false, "Wayback webpages to Archive Today")
rootCmd.Flags().BoolVarP(&ip, "ip", "", false, "Wayback webpages to IPFS")
rootCmd.Flags().BoolVarP(&ph, "ph", "", false, "Wayback webpages to Telegraph")
rootCmd.Flags().StringSliceVarP(&daemon, "daemon", "d", []string{}, "Run as daemon service, supported services are telegram, web, mastodon, twitter, discord, slack, irc")
rootCmd.Flags().StringVarP(&host, "ipfs-host", "", "127.0.0.1", "IPFS daemon host, do not require, unless enable ipfs.")
rootCmd.Flags().UintVarP(&port, "ipfs-port", "p", 5001, "IPFS daemon port.")
rootCmd.Flags().StringVarP(&mode, "ipfs-mode", "m", "pinner", "IPFS mode.")
rootCmd.Flags().BoolVarP(&tor, "tor", "", false, "Snapshot webpage via Tor anonymity network.")

rootCmd.Flags().StringVarP(&token, "token", "t", "", "Telegram Bot API Token.")
rootCmd.Flags().StringVarP(&chatid, "chatid", "", "", "Telegram channel id.")
rootCmd.Flags().StringVarP(&torKey, "tor-key", "", "", "The private key for Tor Hidden Service.")
rootCmd.Flags().StringVarP(&host, "ipfs-host", "", "127.0.0.1", "IPFS daemon host, do not require, unless enable ipfs")
rootCmd.Flags().UintVarP(&port, "ipfs-port", "p", 5001, "IPFS daemon port")
rootCmd.Flags().StringVarP(&mode, "ipfs-mode", "m", "pinner", "IPFS mode")
rootCmd.Flags().BoolVarP(&tor, "tor", "", false, "Snapshot webpage via Tor anonymity network")

rootCmd.Flags().StringVarP(&token, "token", "t", "", "Telegram Bot API Token")
rootCmd.Flags().StringVarP(&chatid, "chatid", "", "", "Telegram channel id")
rootCmd.Flags().StringVarP(&torKey, "tor-key", "", "", "The private key for Tor Hidden Service")
rootCmd.Flags().StringVarP(&configFile, "config", "c", "", "Configuration file path, defaults: ./wayback.conf, ~/wayback.conf, /etc/wayback.conf")
rootCmd.Flags().BoolVarP(&debug, "debug", "", false, "Enable debug mode. (default false)")
rootCmd.Flags().BoolVarP(&info, "info", "", false, "Show application information.")
rootCmd.Flags().BoolVarP(&print, "print", "", false, "Show application configurations.")
rootCmd.Flags().BoolVarP(&debug, "debug", "", false, "Enable debug mode (default mode is false)")
rootCmd.Flags().BoolVarP(&info, "info", "", false, "Show application information")
rootCmd.Flags().BoolVarP(&print, "print", "", false, "Show application configurations")
}

func checkRequiredFlags(cmd *cobra.Command) error {
Expand Down Expand Up @@ -149,9 +149,10 @@ func setToEnv(cmd *cobra.Command) {
// nolint:gocyclo
func handle(cmd *cobra.Command, args []string) {
if !ia && !is && !ip && !ph {
ia, is = true, true
ia, is, ip = true, true, true
os.Setenv("WAYBACK_ENABLE_IA", "true")
os.Setenv("WAYBACK_ENABLE_IS", "true")
os.Setenv("WAYBACK_ENABLE_IP", "true")
}

setToEnv(cmd)
Expand Down

0 comments on commit e737095

Please sign in to comment.