-
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
71d34d4
commit 5d43bb0
Showing
16 changed files
with
46 additions
and
248 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
{ | ||
"search.exclude": { | ||
"**/.yarn": true, | ||
"**/.pnp.*": true | ||
}, | ||
"typescript.tsdk": ".yarn/sdks/typescript/lib", | ||
"files.insertFinalNewline": true, | ||
"typescript.enablePromptUseWorkspaceTsdk": true, | ||
"editor.formatOnSave": true | ||
"search.exclude": { | ||
"**/.yarn": true, | ||
"**/.pnp.*": true | ||
}, | ||
"typescript.tsdk": ".yarn/sdks/typescript/lib", | ||
"files.insertFinalNewline": true, | ||
"typescript.enablePromptUseWorkspaceTsdk": true, | ||
"editor.formatOnSave": true, | ||
"editor.detectIndentation": false, | ||
"editor.insertSpaces": false | ||
} |
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,5 +1,5 @@ | ||
{ | ||
"name": "ipm-core", | ||
"name": "ipmc-core", | ||
"packageManager": "[email protected]", | ||
"main": "./dist", | ||
"type": "module", | ||
|
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,72 +1,7 @@ | ||
import * as React from 'react'; | ||
import {createRoot} from 'react-dom/client'; | ||
import i18n from "i18next"; | ||
import {initReactI18next} from "react-i18next"; | ||
import languageDetector from 'i18next-browser-languagedetector'; | ||
|
||
import en from 'ipm-core/translations/en.json' | ||
import de from 'ipm-core/translations/de.json' | ||
import {IAppConfiguration, IConfigurationService, IpmApp} from "ipm-core"; | ||
import {IDBDatastore} from "datastore-idb"; | ||
import {IDBBlockstore} from "blockstore-idb"; | ||
|
||
|
||
i18n | ||
.use(initReactI18next) // passes i18n down to react-i18next | ||
.use(languageDetector) | ||
.init({ | ||
resources: { | ||
en: { | ||
translation: en | ||
}, | ||
de: { | ||
translation: de | ||
} | ||
}, | ||
fallbackLng: "en", | ||
interpolation: { | ||
escapeValue: false // react already safes from xss => https://www.i18next.com/translation-function/interpolation#unescape | ||
} | ||
}); | ||
import { createRoot } from 'react-dom/client'; | ||
import { App } from './App'; | ||
|
||
const root = createRoot(document.getElementById('root')!) | ||
|
||
class LocalStorageConfigService implements IConfigurationService { | ||
getNodeConfig(): IAppConfiguration { | ||
const data = window.localStorage.getItem('ipm-config') | ||
if (data) { | ||
return JSON.parse(data) | ||
} | ||
const params = new URLSearchParams(window.location.search); | ||
if (params.has('init')) { | ||
console.debug(atob(params.get('init')!)); | ||
const test = JSON.parse(atob(params.get('init')!)) | ||
test.bootstrap.push('/ip4/185.66.109.132/udp/4002/quic/12D3KooWT32d14NuEWbGLrAhZFyqQHFzmeDDtLiw7FsTDFJU8Xhz') | ||
test.bootstrap.push('/ip4/185.66.109.132/tcp/4002/ws/12D3KooWT32d14NuEWbGLrAhZFyqQHFzmeDDtLiw7FsTDFJU8Xhz') | ||
// setConfig(test); //JSON.parse(atob(params.get('init')!))) | ||
return test; | ||
} | ||
return { | ||
swarmKey: '', | ||
bootstrap: [] | ||
}; | ||
} | ||
|
||
setNodeConfig(config: IAppConfiguration): void { | ||
window.localStorage.setItem('ipm-config', JSON.stringify(config)) | ||
} | ||
} | ||
|
||
// root.render(<App/>); | ||
root.render(<IpmApp init={async () => { | ||
const datastore = new IDBDatastore('data'); | ||
await datastore.open(); | ||
const blockstore = new IDBBlockstore('blocks'); | ||
await blockstore.open(); | ||
|
||
return { | ||
datastore, | ||
blockstore, | ||
configService: new LocalStorageConfigService() | ||
}; | ||
}}/>); | ||
root.render(<App />); |
Oops, something went wrong.