Skip to content

Proposal: Deliver IPFS URL as fallback URL #36

@twenty-eighty

Description

@twenty-eighty

In order to reduce the dependency on the DNS it would be great if an IPFS URL like ipfs://<CID> could be returned as a fallback URL for files by Route96 so that it can be written as part of a media attachment (see NIP-92. The CID format is described here - here are also different tools mentioned that can create CIDs, including one for Rust)

This would allow to pin the files at some point in the future to IPFS and make them available via any IPFS gateway even if the original domains don't exist anymore and all regular URLs don't work anymore.

Maybe an even more generic approach could allow to run arbitrary external commands in Route96 after upload?

This should work for IPFS:

Installation
IPFS installation

Command to be run after a file is uploaded:

#!/bin/bash

# Usage: ./get-ipfs-url.sh yourfile.txt

if [ -z "$1" ]; then
  echo "Usage: $0 <file>"
  exit 1
fi

CID=$(ipfs add --only-hash -Q "$1")
echo "ipfs://$CID"

Run it on an uploaded file:
./get-ipfs-url.sh uploaded.webp

Generated fallback URL:
ipfs://QmAbC123xyz...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions