🦊
+This browser has no connection to the Ethereum network.
Please make sure that:
@@ -36,7 +37,7 @@ class LoadingContainer extends Component {
We can't find any Ethereum accounts!. Initializing contracts... If this takes too long please make sure they are deployed to the network
and you are connected to the correct one.
diff --git a/app/src/helpers/EpochTimeConverter.js b/app/src/helpers/EpochTimeConverter.js
index 87c4508..a3a338d 100644
--- a/app/src/helpers/EpochTimeConverter.js
+++ b/app/src/helpers/EpochTimeConverter.js
@@ -1,8 +1,8 @@
const epochTimeConverter = (timestamp) => {
const timestampDate = new Date(0);
timestampDate.setUTCSeconds(timestamp);
- return (`${timestampDate.getMonth() + 1} ${
- timestampDate.getDate()}, ${
+ return (`${timestampDate.getDate()}/${
+ timestampDate.getMonth() + 1}/${
timestampDate.getFullYear()}, ${
timestampDate.getHours()}:${
timestampDate.getMinutes()}:${
diff --git a/app/src/redux/actions/orbitActions.js b/app/src/redux/actions/orbitActions.js
index 20f9a01..16ed151 100644
--- a/app/src/redux/actions/orbitActions.js
+++ b/app/src/redux/actions/orbitActions.js
@@ -3,8 +3,7 @@ const DATABASES_CREATED = 'DATABASES_CREATED';
const DATABASES_LOADED = 'DATABASES_LOADED';
const DATABASES_NOT_READY = 'DATABASES_NOT_READY';
const ADD_PEER_DATABASE = 'ADD_PEER_DATABASE';
-const OPENING_PEER_DATABASE = 'OPENING_PEER_DATABASE';
-const PEER_DATABASE_LOADED = 'PEER_DATABASE_LOADED';
+const PEER_DATABASE_ADDED = 'PEER_DATABASE_ADDED';
const UPDATE_PEERS = 'UPDATE_PEERS';
function updateDatabases(type, orbitdb, topicsDB, postsDB) {
@@ -30,8 +29,7 @@ export { DATABASES_CREATED,
IPFS_INITIALIZED,
UPDATE_PEERS,
ADD_PEER_DATABASE,
- OPENING_PEER_DATABASE,
- PEER_DATABASE_LOADED,
+ PEER_DATABASE_ADDED,
addPeerDatabase,
updateDatabases
};
diff --git a/app/src/redux/reducers/orbitReducer.js b/app/src/redux/reducers/orbitReducer.js
index 7495a99..fc82d3f 100644
--- a/app/src/redux/reducers/orbitReducer.js
+++ b/app/src/redux/reducers/orbitReducer.js
@@ -1,8 +1,8 @@
import {
DATABASES_CREATED,
DATABASES_LOADED,
- DATABASES_NOT_READY, OPENING_PEER_DATABASE,
- IPFS_INITIALIZED, UPDATE_PEERS, PEER_DATABASE_LOADED
+ DATABASES_NOT_READY,
+ IPFS_INITIALIZED, UPDATE_PEERS, PEER_DATABASE_ADDED
} from '../actions/orbitActions';
const initialState = {
@@ -13,7 +13,7 @@ const initialState = {
topicsDB: null,
postsDB: null,
pubsubPeers: {topicsDBPeers:[], postsDBPeers:[]},
- replicatedDatabases: [],
+ peerDatabases: [],
id: null
};
@@ -52,22 +52,14 @@ const orbitReducer = (state = initialState, action) => {
postsDB: null,
id: null
};
- case OPENING_PEER_DATABASE:
- if(state.replicatedDatabases.find(db => db.fullAddress === action.fullAddress))
+ case PEER_DATABASE_ADDED:
+ if(state.peerDatabases.find(db => db.fullAddress === action.fullAddress))
return state;
+ console.debug(`Added peer database ${action.fullAddress}`);
return {
...state,
- replicatedDatabases:[...state.replicatedDatabases,
- {fullAddress: action.fullAddress, ready: false, store: null}]
- };
- case PEER_DATABASE_LOADED:
- return {
- ...state,
- replicatedDatabases: [...state.replicatedDatabases.map((db) => {
- if (db.fullAddress !== action.fullAddress)
- return db; // This isn't the item we care about - keep it as-is
- return { ...db, ready: true, store: action.store} // Otherwise return an updated value
- })]
+ peerDatabases:[...state.peerDatabases,
+ {fullAddress: action.fullAddress, store: action.store}]
};
case UPDATE_PEERS:
return {
diff --git a/app/src/redux/sagas/orbitSaga.js b/app/src/redux/sagas/orbitSaga.js
index 34c8d60..80514be 100644
--- a/app/src/redux/sagas/orbitSaga.js
+++ b/app/src/redux/sagas/orbitSaga.js
@@ -4,7 +4,7 @@ import { forumContract, getCurrentAccount } from './drizzleUtilsSaga';
import { loadDatabases, orbitSagaOpen } from '../../utils/orbitUtils';
import { DRIZZLE_UTILS_SAGA_INITIALIZED } from '../actions/drizzleUtilsActions';
import {
- ADD_PEER_DATABASE, PEER_DATABASE_LOADED,
+ ADD_PEER_DATABASE, PEER_DATABASE_ADDED,
DATABASES_NOT_READY,
IPFS_INITIALIZED, OPENING_PEER_DATABASE,
UPDATE_PEERS
@@ -65,12 +65,9 @@ function* addPeerDatabase(action) {
if(peerOrbitAddresses.size>size){
const { orbitdb } = yield select(state => state.orbit);
if(orbitdb){
- yield put.resolve({
- type: OPENING_PEER_DATABASE, fullAddress
- });
const store = yield call(orbitSagaOpen, orbitdb, fullAddress);
yield put({
- type: PEER_DATABASE_LOADED, fullAddress, store: store
+ type: PEER_DATABASE_ADDED, fullAddress, store: store
});
}
}
diff --git a/app/src/utils/orbitUtils.js b/app/src/utils/orbitUtils.js
index 88ecdbd..390cbf7 100644
--- a/app/src/utils/orbitUtils.js
+++ b/app/src/utils/orbitUtils.js
@@ -16,14 +16,12 @@ function initIPFS() {
ipfs.id(function (error, identity) {
if (error)
console.error(`IPFS id() error: ${error}`);
- console.debug(`IPFS initialized with id: ${identity.id}`);
+ console.debug(`IPFS initialized with id ${identity.id}`);
})
});
}
async function createDatabases() {
- console.debug("Deleting local storage..."); // Else we are in danger of reusing an existing orbit
- localStorage.clear(); // Perhaps not needed at all when orbit ids are used in Orbit 0.20.x+
console.debug('Creating databases...');
const ipfs = getIPFS();
const orbitdb = new OrbitDB(ipfs);
🦊
+
âš™
+