Open alexjorgef opened 1 year ago
This sounds doable.
It would likely take modifying httpLink
and the input validation.
In constants
I'd change:
export const IPFS_LINK_PATTERN =
process.env.NEXT_PUBLIC_IPFS_LINK_PATTERN ||
'https://ipfs.io/ipfs/{cid}/{path}'
To:
export const IPFS_LINK_PATTERN =
process.env.NEXT_PUBLIC_IPFS_LINK_PATTERN ||
'https://ipfs.io/{protocol}/{cid}/{path}'
Then the httpLink
function should look something like:
export const httpLink = (uri?: Maybe<string>) => {
const [, proto, origCID, path] =
uri?.match(/^(ip[nf]s):(?:\/\/)?([^/]+)(?:\/(.*))?$/) ?? [];
try {
if (origCID) {
const cid = new CID(origCID);
let v0CID = '';
try {
v0CID = cid.toV0().toString();
} catch {}
let v1CID = '';
try {
v1CID = cid.toV1().toString('base32');
} catch {}
const pattern = IPFS_LINK_PATTERN;
return pattern
.replace(/{protocol}/g, proto)
.replace(/{cid}/g, origCID)
.replace(/{v0cid}/g, v0CID)
.replace(/{v1cid}/g, v1CID)
.replace(/{path}/g, path ?? '');
}
} catch {}
return uri ?? undefined; // Image.src won't take null
};
I sent you an invite to the MetaFam organization. If you make a pull request, could you do it from a branch pushed to the MetaFam/TheGame
repo?
The test instances won't work with forks from other accounts.
I sent you an invite to the MetaFam organization. If you make a pull request, could you do it from a branch pushed to the
TheGame
repo?The test instances won't work with forks from other accounts.
Great!! I will delete my fork, thank you. Looking to test and open a pull request
Though at this point in time we don't display the website anywhere in the profile. It is stored in Ceramic, however, and accessible to any parties that might want to look it up.
We are undergoing a significant revamp of the backend of the profiling system, and homepages might may it into the new version…
I understand, tracking the progress on that and any related commits
What would you like to be added?
On the user's profile page, beside
ipfs://
,http://
,https://
, the user should be able to add a website with aipns://
URL schema.This is an interesting feature for me and loved to help with the implementation
Why is this needed?
The problem with
ipfs://<CID>
schema is when the website's files update, a new CID is generated. Adding IPNS permits websites hosted in IPFS to update dynamically by pointing a IPNS record name to a mutable/immutable path (ref).