diff --git a/README.md b/README.md index 81740eb..633fc57 100644 --- a/README.md +++ b/README.md @@ -42,18 +42,6 @@ Ensure you have `task` installed. Follow the instructions [here](https://taskfil DeWeb CLI is a command-line tool designed for deploying, editing, and deleting decentralized websites on the DeWeb platform. -## Table of Contents - -- [Usage](#usage) -- [Commands](#commands) - - [upload](#upload) - - [edit](#edit) - - [view](#view) - - [delete](#delete) -- [Configuration](#configuration) -- [Logging](#logging) -- [License](#license) - ## Usage Once installed, you can use the `deweb-cli` command to interact with DeWeb. Below is the basic usage syntax: @@ -156,7 +144,3 @@ sc_config: ## Logging The CLI logs its output to `./deweb-cli.log`. Logging is initialized automatically when the application starts. - -## License - -DeWeb CLI is licensed under the MIT License. See the `LICENSE` file for more information. diff --git a/cmd/cli/main.go b/cmd/cli/main.go index a59c0ec..e9323a8 100644 --- a/cmd/cli/main.go +++ b/cmd/cli/main.go @@ -11,10 +11,8 @@ import ( "github.com/massalabs/DeWeb/int/utils" "github.com/massalabs/DeWeb/int/zipper" pkgConfig "github.com/massalabs/DeWeb/pkg/config" - "github.com/massalabs/DeWeb/pkg/webmanager" "github.com/massalabs/DeWeb/pkg/website" msConfig "github.com/massalabs/station/int/config" - "github.com/massalabs/station/pkg/cache" "github.com/massalabs/station/pkg/logger" "github.com/urfave/cli/v2" ) @@ -254,7 +252,6 @@ func viewWebsite(scAddress string, networkInfos *msConfig.NetworkInfos) error { logger.Infof("Website owner: %s", owner) // For debugging cache purposes: - // zipFile, err := webmanager.RequestWebsite(scAddress, networkInfos) zipFile, err := website.Fetch(networkInfos, scAddress) if err != nil { @@ -294,27 +291,6 @@ func deleteWebsite(siteAddress string, config *yamlConfig.Config) error { logger.Infof("Website %s deleted with operation ID: %s", siteAddress, *operationID) - err = deleteFromCache(siteAddress) - if err != nil { - return fmt.Errorf("failed to delete %s from cache: %v", siteAddress, err) - } - - logger.Infof("Website %s deleted from cache", siteAddress) - - return nil -} - -func deleteFromCache(scAddress string) error { - cache := new(cache.Cache) - fileName := fmt.Sprintf("website_%s.zip", scAddress) - - if cache.IsPresent(fileName) { - err := os.Remove(webmanager.CacheDir + fileName) - if err != nil { - return fmt.Errorf("failed to delete from cache: %v", err) - } - } - return nil } diff --git a/pkg/config/network.go b/pkg/config/network.go index 4ca6161..60e856a 100644 --- a/pkg/config/network.go +++ b/pkg/config/network.go @@ -12,6 +12,8 @@ const ( MainnetChainID = 77658377 BuildnetChainID = 77658366 + + DefaultNodeURL = "https://buildnet.massa.net/api/v2" ) func NewNetworkConfig(NodeURL string) msConfig.NetworkInfos { diff --git a/pkg/config/wallet.go b/pkg/config/wallet.go index f0f0adc..9a4eab0 100644 --- a/pkg/config/wallet.go +++ b/pkg/config/wallet.go @@ -5,8 +5,6 @@ type WalletConfig struct { NodeUrl string } -const DefaultNodeURL = "https://buildnet.massa.net/api/v2" - func NewWalletConfig(walletNickname string, nodeURL string) WalletConfig { return WalletConfig{ WalletNickname: walletNickname, diff --git a/pkg/webmanager/manager.go b/pkg/webmanager/manager.go index 2a026de..82d5c9a 100644 --- a/pkg/webmanager/manager.go +++ b/pkg/webmanager/manager.go @@ -12,7 +12,7 @@ import ( "github.com/massalabs/station/pkg/logger" ) -const CacheDir = "./websitesCache/" +const cacheDir = "./websitesCache/" // getWebsiteResource fetches a resource from a website and returns its content. func GetWebsiteResource(network *msConfig.NetworkInfos, websiteAddress, resourceName string) ([]byte, bool, error) { @@ -100,7 +100,7 @@ func fetchAndCache(networkInfo *msConfig.NetworkInfos, scAddress string, cache * // Compares the last updated timestamp to the file's last modified timestamp. func isFileOutdated(fileName string, lastUpdated time.Time) (bool, error) { - fi, err := os.Stat(CacheDir + fileName) + fi, err := os.Stat(cacheDir + fileName) if err != nil { return false, fmt.Errorf("failed to get file info: %w", err) }