Merge pull request #277 from orbitdb/fix/browser-examples

Fix browser examples
This commit is contained in:
Haad 2017-12-10 14:17:49 +01:00 committed by GitHub
commit 51b8e417e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 21 additions and 29 deletions

View File

@ -11,6 +11,8 @@ build: test
npm run build npm run build
cp dist/orbitdb.min.js examples/browser/lib/orbitdb.min.js cp dist/orbitdb.min.js examples/browser/lib/orbitdb.min.js
cp node_modules/ipfs/dist/index.min.js examples/browser/lib/ipfs.min.js cp node_modules/ipfs/dist/index.min.js examples/browser/lib/ipfs.min.js
cp dist/orbitdb.js examples/browser/lib/orbitdb.js
cp node_modules/ipfs/dist/index.js examples/browser/lib/ipfs.js
@echo "Build success!" @echo "Build success!"
@echo "Output: 'dist/', 'examples/browser/'" @echo "Output: 'dist/', 'examples/browser/'"

View File

@ -27,8 +27,8 @@
Addresses: { Addresses: {
Swarm: [ Swarm: [
// Use IPFS dev signal server // Use IPFS dev signal server
'/dns4/star-signal.cloud.ipfs.team/wss/p2p-webrtc-star', // '/dns4/star-signal.cloud.ipfs.team/wss/p2p-webrtc-star',
// '/ip4/0.0.0.0/tcp/9090/wss/p2p-webrtc-star', '/dns4/ws-star.discovery.libp2p.io/tcp/443/wss/p2p-websocket-star',
] ]
}, },
Bootstrap: [], Bootstrap: [],

View File

@ -34,8 +34,8 @@
Addresses: { Addresses: {
Swarm: [ Swarm: [
// Use IPFS dev signal server // Use IPFS dev signal server
'/dns4/star-signal.cloud.ipfs.team/wss/p2p-webrtc-star', // '/dns4/star-signal.cloud.ipfs.team/wss/p2p-webrtc-star',
// '/ip4/0.0.0.0/tcp/9090/wss/p2p-webrtc-star', '/dns4/ws-star.discovery.libp2p.io/tcp/443/wss/p2p-websocket-star',
] ]
}, },
Bootstrap: [], Bootstrap: [],

View File

@ -7,6 +7,7 @@ const Uglify = require('uglifyjs-webpack-plugin')
const uglifyOptions = { const uglifyOptions = {
uglifyOptions: { uglifyOptions: {
mangle: false, mangle: false,
compress: false,
}, },
} }

2
dist/es5/OrbitDB.js vendored
View File

@ -291,7 +291,7 @@ var OrbitDB = function () {
// accessController.add('admin', this.key.getPublic('hex')) // accessController.add('admin', this.key.getPublic('hex'))
// } // }
// Add keys that can write to the database // Add keys that can write to the database
if (options && options.write) { if (options && options.write && options.write.length > 0) {
options.write.forEach(function (e) { options.write.forEach(function (e) {
return accessController.add('write', e); return accessController.add('write', e);
}); });

2
dist/orbitdb.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -47,7 +47,7 @@
<div id="writerText"></div> <div id="writerText"></div>
<script type="text/javascript" src="lib/orbitdb.min.js" charset="utf-8"></script> <script type="text/javascript" src="lib/orbitdb.min.js" charset="utf-8"></script>
<script type="text/javascript" src="lib/ipfs.min.js" charset="utf-8"></script> <script type="text/javascript" src="lib/ipfs.js" charset="utf-8"></script>
<script type="text/javascript" src="example.js" charset="utf-8"></script> <script type="text/javascript" src="example.js" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8"> <script type="text/javascript" charset="utf-8">
// Start the example // Start the example

View File

@ -22,7 +22,6 @@ function handleError(e) {
} }
const main = (IPFS, ORBITDB) => { const main = (IPFS, ORBITDB) => {
let ipfsReady = false
let orbitdb, db let orbitdb, db
let count = 0 let count = 0
let interval = Math.floor((Math.random() * 300) + (Math.random() * 2000)) let interval = Math.floor((Math.random() * 300) + (Math.random() * 2000))
@ -45,9 +44,8 @@ const main = (IPFS, ORBITDB) => {
// Create IPFS instance // Create IPFS instance
const ipfs = new Ipfs({ const ipfs = new Ipfs({
// repo: '/orbitdb/examples/browser/ipfs' + new Date().getTime(), repo: '/orbitdb/examples/browser/new/ipfs/0.27.3',
repo: '/orbitdb/examples/browser/new/ipfs/0.27.0', start: true,
start: false,
EXPERIMENTAL: { EXPERIMENTAL: {
pubsub: true, pubsub: true,
}, },
@ -55,21 +53,12 @@ const main = (IPFS, ORBITDB) => {
Addresses: { Addresses: {
Swarm: [ Swarm: [
// Use IPFS dev signal server // Use IPFS dev signal server
'/dns4/star-signal.cloud.ipfs.team/wss/p2p-webrtc-star', // '/dns4/star-signal.cloud.ipfs.team/wss/p2p-webrtc-star',
'/dns4/ws-star.discovery.libp2p.io/tcp/443/wss/p2p-websocket-star',
// Use local signal server // Use local signal server
// '/ip4/0.0.0.0/tcp/9090/wss/p2p-webrtc-star', // '/ip4/0.0.0.0/tcp/9090/wss/p2p-webrtc-star',
] ]
}, },
Bootstrap: [],
Discovery: {
MDNS: {
Enabled: true,
Interval: 10
},
webRTCStar: {
Enabled: true
}
},
} }
}) })

14
package-lock.json generated
View File

@ -1778,9 +1778,9 @@
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
}, },
"crdts": { "crdts": {
"version": "0.1.2", "version": "0.1.5",
"resolved": "https://registry.npmjs.org/crdts/-/crdts-0.1.2.tgz", "resolved": "https://registry.npmjs.org/crdts/-/crdts-0.1.5.tgz",
"integrity": "sha512-fmJEhm4BxtTxMVFf1FvJEP4f57yyHxSLpGFW6sbL1zOlavGp6B39WSvX9J0fLjE0AtOLjdb0rPMN0K/sdSW+Pw==" "integrity": "sha512-4Z/dQqa9qzMPlrE+zd0ecl53QFwaTZVVYTUgxvpF0k8OcOy4HY7c+C9brXp81eigLE0EKENTVp3CjIMY9b/ezg=="
}, },
"create-ecdh": { "create-ecdh": {
"version": "4.0.0", "version": "4.0.0",
@ -4564,9 +4564,9 @@
} }
}, },
"ipfs": { "ipfs": {
"version": "0.27.1", "version": "0.27.3",
"resolved": "https://registry.npmjs.org/ipfs/-/ipfs-0.27.1.tgz", "resolved": "https://registry.npmjs.org/ipfs/-/ipfs-0.27.3.tgz",
"integrity": "sha512-sv82SR/0MJCyRgZ2VoHn1rKJbLTXKej1usRQjpg0sa78wVum+wzJm9QzaW5RaexFiGXJcE9w1tiopcAC1ysfJA==", "integrity": "sha512-pUvmBE/Vo5vGPuChJchl/1AQBldjmtJU7iddtbR9iLz8f1qdtz2y7p9HyHsPM8N7t+VjB1Y+B2JchUap4wPdUg==",
"dev": true, "dev": true,
"requires": { "requires": {
"async": "2.6.0", "async": "2.6.0",
@ -6968,7 +6968,7 @@
"resolved": "https://registry.npmjs.org/orbit-db-counterstore/-/orbit-db-counterstore-1.1.0.tgz", "resolved": "https://registry.npmjs.org/orbit-db-counterstore/-/orbit-db-counterstore-1.1.0.tgz",
"integrity": "sha512-25CtAWuT5Ni4rDLziNj5qbjgAP0d+nyWWV9Tx30VqPXgCA4hYG3hAgIs3EYCVLWIRFZH7xdCfLyHfXY/v8pQvg==", "integrity": "sha512-25CtAWuT5Ni4rDLziNj5qbjgAP0d+nyWWV9Tx30VqPXgCA4hYG3hAgIs3EYCVLWIRFZH7xdCfLyHfXY/v8pQvg==",
"requires": { "requires": {
"crdts": "0.1.2", "crdts": "0.1.5",
"orbit-db-store": "2.1.0" "orbit-db-store": "2.1.0"
} }
}, },