mirror of
https://github.com/status-im/liquid-funding.git
synced 2025-01-12 12:34:39 +00:00
reformat file sanitizers to use update ipfs api
This commit is contained in:
parent
ea7c90efe9
commit
461604bd66
@ -34,7 +34,7 @@ async function getProjectAssets(projectId, setState, debug=false){
|
||||
const projectInfo = await LiquidPledging.methods.getPledgeAdmin(projectId).call()
|
||||
const CID = projectInfo.url.split('/').slice(-1)[0]
|
||||
if (debug) console.log({CID, projectInfo, ipfs})
|
||||
getFiles(CID)
|
||||
getFilesWeb(CID)
|
||||
.then((files) => {
|
||||
setState(files)
|
||||
const manifest = files[2]
|
||||
@ -45,7 +45,7 @@ async function getProjectAssets(projectId, setState, debug=false){
|
||||
databaseExists('ipfs')
|
||||
.catch(() => window.location.reload())
|
||||
|
||||
getFilesWeb(CID)
|
||||
getFiles(CID)
|
||||
.then((files) => {
|
||||
setState(files)
|
||||
const manifest = files[2]
|
||||
@ -93,11 +93,15 @@ export function useProfileData(profiles) {
|
||||
return delegatePledges
|
||||
}
|
||||
|
||||
const isManifest = asset => {
|
||||
const name = asset.path.split('/').slice(-1)[0]
|
||||
return name.toLowerCase() === 'manifest.json'
|
||||
}
|
||||
const getProjectManifest = assets => {
|
||||
if (!assets) {
|
||||
return null;
|
||||
}
|
||||
const manifest = assets.find(a => a.name.toLowerCase() === 'manifest.json');
|
||||
const manifest = assets.find(isManifest);
|
||||
if (!manifest) {
|
||||
return null;
|
||||
}
|
||||
|
@ -8,8 +8,14 @@ const formatMedia = content => {
|
||||
return src
|
||||
}
|
||||
|
||||
|
||||
const getName = asset => asset.path.split('/').slice(-1)[0]
|
||||
const isManifest = asset => {
|
||||
const name = getName(asset)
|
||||
return name.toLowerCase() === 'manifest.json'
|
||||
}
|
||||
const getProjectManifest = assets => {
|
||||
return assets ? JSON.parse(assets.find(a => a.name.toLowerCase() === 'manifest.json').content) : null
|
||||
return assets ? JSON.parse(assets.find(isManifest).content) : null
|
||||
}
|
||||
|
||||
export function getNumberOfBackers(pledges){
|
||||
@ -35,7 +41,7 @@ export const getMediaSrc = assets => {
|
||||
if (media.url) return media.url
|
||||
if (media.file && media.file !== '/root/') {
|
||||
return formatMedia(
|
||||
assets.find(a => a.name === getFile(media.file)).content
|
||||
assets.find(a => getName(a) === getFile(media.file)).content
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user