3

I've uploaded my homepage to swarm, using the --recursive flag, i.e.:

0 ✓ user@ursae ~/.src/github.com/5chdn $ swarm --recursive up co/
I0115 11:32:09.046878 upload.go:195] uploading file co/0x61f42a05.asc (3112 bytes) and adding path 0x61f42a05.asc
I0115 11:32:09.050241 upload.go:195] uploading file co/favicon.png (330 bytes) and adding path favicon.png
I0115 11:32:09.050961 upload.go:195] uploading file co/index.htm (3805 bytes) and adding path index.htm
f1a669a425b378bd8034fe0df7fea098c8b932a6037b688764afda1e92a8db1e

Now, going to bzz:/f1a669a425b378bd8034fe0df7fea098c8b932a6037b688764afda1e92a8db1e/ gives me the message:

manifest entry for '' not found

But navigating to ./index.htm works as desired and shows my web site. Even the favicon works.

Is it possible to create that manifest entry somehow to tell swarm to show the index.htm by default?

6

When you upload from the swarm console, you can give the default entry as the second argument like this:

bzz.upload('/path/to/dir/', ,'index.htm')

Similar functionality is being added to swarm up using

swarm --index-file index.htm up --recursive /path/to/dir

and will be extended to allow for multiple directories.

See this github issue for more: https://github.com/ethereum/go-ethereum/issues/3541

  • 1
    It seems this is a moving target. Now it works with --defaultpath. – Waqar Lim Feb 20 '17 at 10:39
3

Just adding more explanation:

Your website is sitting on a virtual host described by a manifest file. The manifest has entries associating paths to documents. Associating the empty path to a hash is totally legit manifest entry.

A manifest can also be thought of as list of paths on a filesystem, say the recursive contents of a directory. This equivalence makes it possible to have a method that uploads a directory from the disk to swarm and one that downloads it.

There is one misalignment though. The directories themselves are not files but should still be displayable via the manifest as documents (e.g., index files). So when we upload a directory to swarm, there should be some convention to allow associating assets to the directories as url paths.

The command line tool actually always supported the --defaultpath option the argument of which is a path to a file that is displayed when the urlpath is empty (ie., the swarm address is `bzz:///).

as of https://github.com/ethereum/go-ethereum/issues/3541 swarm up will support multilevel index files: the file named filename (toplevel arg) is associated with the empty path if it exists.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.