nextcloud-swarm-plugin/README.md
Mahyar Iranibazaz a3a0b0582e
pay-wall (#60)
* add env for swarm access

* check access

* use storage config from external storage to set access key

* Update README.md (#50)

updated settings menu in readme

* feat(intellisense): (#51)

- update: remap the docker volume for main nextcloud to local project directory to access the nc code

* add env for swarm access

* feat(hooks):
- add: entrypoint hooks volume
- add: change-owner.sh script

* feat(apache):
- update: Dockerfile apache user and id
- delete: hooks setup
- add: .env setup
- add: theme volume
- update: turn off debugger at start

* feat(.env):
- add: .env example file

* fix(docker):
- add: theme volume

* fix(docker):
- revert: xdebug start config

* backend options not persistant

* access key works

* feat(docker):
- update: reduce the volumes to lib and apps

* chore(env):
- add: swarm api key in example

* chore(env):
- add: env file instructions
- fix: typos

* docs(readme):
- fix: image path typo

* merge(docker):
- fix: revert the dev-env folder volumes

* chore(main):
- add: curl ext to project requirements

* feat(util): curl
- add: curl helper

* feat(swarm): curl
- update: request to use new Curl helper
- update: check connection using new endpoint of gateway
- update: type safety
- refactor: remove unused methods

* refactor(swarm):
- refactor: upload and download methods
- update: code style

* feat(pay-wall): licence
- add: License auth implementation
- update: external storage definition
- remove: nocodb access token setup
- remove: basic auth setup

* feat(swarm):
- update: disable custom settings page

* feat(gitignore):
- update: categorize gitignore
- add: DS_Store entry =)

* refactor(gitignore):
- update: url check using regex

* fix(swarm): upload
- update: remove extra param

* fix(swarm): file preview
- update: write file to memory to stream

* feat(settings): add link
- add: script to display link on settings page
- update: load script on plugin boot

---------

Co-authored-by: Henry Bergstrom <henrybergstrom@protonmail.com>
Co-authored-by: rampall <rameshpallikara@gmail.com>
2024-08-12 16:50:32 +02:00

6.4 KiB
Executable file

Nextcloud Swarm Plugin

Decentralized Sovereign cloud-storage comes to Nextcloud!

This plugin brings Swarm to Nextcloud - decentralized file-storage, connected to the blockchain.

View file and action menu

File view when using the plugin in Nextcloud

Table of Contents

Dependencies

To use the plugin you need the following

  • A Nextcloud instance
  • A Bee node

Setup and Installation

For setting up a Bee node please have a look at the official documentation

The following steps explain how to configure a Bee node in Nextcloud.

  • Create a .env file in the project root by copying the .env.example file and adjusting its values accordingly.
  • Run this command to start the development environment docker compose up, wait 10 seconds and navigate to localhost
  • Navigate to Profile menu -> Apps and make sure the "External Storage support" and "External Storage: Swarm" plugins are enabled
  • Navigate to External Storage Administration (Profile menu -> Administration Settings -> External Storage)
  • Add the connection settings for a new Bee node, make sure Authentication: none, Configuration is pointing to an active Bee node, and Available for: All users
  • Navigate to Ethswarm Storage Administration (Profile menu -> Administration Settings -> Ethswarm Storage)
  • Configure the Bee node - by default, encryption is active, make sure stamp batch is activated by using the toggle
  • To use a Bee node, it is necessary to Purchase a Batch of new stamps from the funds in the node's wallet account
  • Once the new batch is purchased, a unique batchId is generated. Once your batch has been purchased, it will take a few minutes for other Bee nodes in the Swarm to catch up and register your batch. Allow some time for your batch to propagate in the network before proceeding to the next step. This is indicated by the checkbox "Usable".
  • Uploading files to the swarm costs Bzz, so it is necessary to select a Batch as "Active". Only 1 batch is allowed to be Active for a given Bee node. Then click "Save Settings".

Usage

File handling operations involving the Bee node are integrated in the External Storage ("Files") section of Nextcloud.

View file and action menu

View, download, and file view actions in Nextcloud

Using the plugin, the main file operations that are available in Nextcloud are:

  • Upload file(s) to a Bee node
  • Download and view files
  • Copy/Move files from any External Storage to a Bee node
  • Copy files from a Bee node to any External Storage
  • View and copy the unique swarm reference to the clipboard for any file stored on a Bee node

Settings

Available to users with administrative credentials, the external storage accepts configuration options from two places, the normal External Storage settings, which allows a user to configure the basic connection properties of a Bee node:

Setup Swarm External Storage

Basic Swarm setup in External Storage in Nextcloud administration

Since every operation in Swarm costs money, it is important to view how much money is available to the Bee node directly and also provide a convenient way of handling the payment system in Swarm - all managed directly in Nextcloud. This is in a specific section with more advanced configuration for the Bee node, where the following settings can be viewed and edited:

  • Configure which Bee node to manage
  • View current status of the Bee node
  • Option to toggle encryption on and off
  • How much BZZ is available to the node
  • Any purchased stamp batches and the remaining balances
  • Have the option to purchase a new batch of stamps
  • Toggle the batch used for uploading files active/inactive

Using Bee node hosted on same server

If you are running the Bee node and Nextcloud using Docker containers on the same host, you cannot access the Bee node using localhost or 127.0.0.1 from within the Nextcloud container. Instead, you need to use the special DNS name host.docker.internal to access the host machine from within the container.

This is because localhost and 127.0.0.1 within the container refer to the container itself, not the host machine. The host.docker.internal DNS name is a special entry that resolves to the IP address of the host machine, allowing you to access services running on the host from within the container.

So, when configuring the Bee node connection in Nextcloud, use host.docker.internal instead of localhost or 127.0.0.1 for the IP address if your Bee node is running on the same host as the Nextcloud container.

Setup Swarm External Storage

Advanced configuration of Swarm in Nextcloud administration

Using Swarm

Once setup and configured, the Bee node is ready to use.

  • Navigate to "Files" option on the menu -> "External Storage" and then the name of the Bee node.
  • Click to Upload file(s):

Upload file

Upload file to swarm in Nextcloud

  • Once uploaded, it can be viewed internally or downloaded. It can also be copied to another storage.

View file and action menu

View, download, and file view actions in Nextcloud

  • Files from another Nextcloud storage can also be copied/moved to the Bee node. Choose the Bee node as the target Folder

Copy file

  • Right-click on a swarm file to copy the swarm reference (or hash) to the clipboard. Alternatively click the 3 dots of the Actions menu and select the menu option "Copy swarm reference". The swarm reference is the unique address of the file on the swarm.

Copy swarm reference to clipboard

Copy swarm reference to clipboard

License

This program is licensed under the AGPLv3 or later.