-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e826c04
commit 154358d
Showing
16 changed files
with
487 additions
and
288 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import React from 'react'; | ||
import { minidenticon } from 'minidenticons'; | ||
|
||
export function Identicon(props: { value: string; }) { | ||
return <img src={'data:image/svg+xml;utf8,' + encodeURIComponent(minidenticon(props.value))} width={25} height={25} />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
export { ImageView } from './ImageView'; | ||
export { Loader } from './Loader'; | ||
export { Identicon } from './Identicon'; | ||
export { ThemeToggle } from './ThemeToggle'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { IFileInfo, IIpfsService } from './service'; | ||
import { create } from 'kubo-rpc-client'; | ||
|
||
export async function createRemoteIpfsService(url: string): Promise<IIpfsService> { | ||
const node = create({ url: url }); | ||
const connString = (await node.config.get('Addresses.Gateway')) as string; | ||
const port = connString.substring(connString.lastIndexOf('/') + 1); | ||
const id = (await node.id()).id.toString(); | ||
return { | ||
async ls(cid: string) { | ||
const files: IFileInfo[] = []; | ||
for await (const file of node.ls(cid)) { | ||
files.push({ | ||
type: file.type, | ||
name: file.name, | ||
cid: file.cid.toString(), | ||
}); | ||
} | ||
return files; | ||
}, | ||
stop() { | ||
return Promise.resolve(); | ||
}, | ||
toUrl(cid: string) { | ||
return `http://127.0.0.1:${port}/ipfs/${cid}`; | ||
}, | ||
id() { | ||
return id; | ||
}, | ||
async peers() { | ||
return (await node.swarm.peers()).map(p => p.addr.toString()); | ||
}, | ||
async resolve(name) { | ||
let result = ''; | ||
for await (const res of node.name.resolve(name)) { | ||
result = res; | ||
} | ||
|
||
return result; | ||
}, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
import { ElectronAPI } from '@electron-toolkit/preload' | ||
import { IConfigurationService, INodeService } from 'ipm-core' | ||
import { IConfigurationService, INodeService } from 'ipm-core'; | ||
|
||
declare global { | ||
interface Window { | ||
electron: ElectronAPI | ||
nodeService: INodeService | ||
configService: IConfigurationService | ||
nodeService: INodeService; | ||
configService: IConfigurationService; | ||
} | ||
} |
Oops, something went wrong.