Skip to content

Commit

Permalink
v.0.9.172
Browse files Browse the repository at this point in the history
  • Loading branch information
mbykov committed Oct 15, 2019
1 parent 18849ad commit 98a106c
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 32 deletions.
2 changes: 1 addition & 1 deletion app/app.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/app.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/background.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/background.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.9.170",
"version": "0.9.172",
"name": "biblos.js",
"productName": "Biblos.js",
"description": "Biblos.js, a.k.a Morpheus for Ancient Greek based on CouchDB && Electron.js",
Expand Down Expand Up @@ -76,7 +76,7 @@
"release": "webpack --config=build/webpack.app.config.js --env=production && electron-builder"
},
"dependencies": {
"antrax": "^0.9.149",
"antrax": "^0.9.151",
"axios": "^0.18.0",
"electron-clipboard-extended": "^1.1.1",
"electron-settings": "^3.2.0",
Expand Down
2 changes: 1 addition & 1 deletion src/lib/nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Mousetrap.bind(['ctrl+g'], function(ev) {
let cfg = settings.get('cfg')
if (!cfg) return
cfg = JSON.parse(JSON.stringify(cfg))
cfg = _.filter(cfg, dict=> { return dict.dname != 'souda'})
cfg = _.filter(cfg, dict=> { return dict.dname != 'lsj'})
cfg.forEach((dict, idx)=> { dict.idx = idx})
console.log('_________+G: cfg:', cfg)
settings.set('cfg', cfg)
Expand Down
31 changes: 7 additions & 24 deletions src/lib/remote.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import path from "path"
import { antrax } from 'antrax'
// import { antrax } from '/home/michael/a/loigos'
import { checkConnection, ensureDBdir, emptyDBdir, streamDB } from 'antrax/dist/lib/pouch'
// import { checkConnection, ensureDBdir, streamDB } from '/home/michael/a/loigos/dist/lib/pouch'
// import { checkConnection, ensureDBdir, emptyDBdir, streamDB } from '/home/michael/a/loigos/dist/lib/pouch'

let MemoryStream = require('memorystream');
// let MemoryStream = require('memorystream');

const log = console.log
const fse = require('fs-extra')
Expand Down Expand Up @@ -253,38 +253,20 @@ export function activateDict(dname, on) {
function streamDict(cfg, dname) {
let dict = _.find(cfg, dict=> { return dict.dname == dname })
if (!dict) return Promise.resolve([])
let stream = new MemoryStream()
let sec = settings.get('state').sec
let ocounters
if (sec == 'remote-dicts') ocounters = q('#remote-progress-counter')
else ocounters = q('#init-progress-counter')
let ocounter = create('div', 'counter')
ocounters.appendChild(ocounter)

let total = 0
let step = config.batch_size/2
stream.on('data', function(chunk) {
total += step
let percent = Math.round(parseFloat(1 - (dict.size - total)/dict.size).toFixed(2)*100)
// log('__dumped :', dict.size, total, '%', percent)
ocounter.innerHTML = 'cloning <b>' + dict.name + '</b> dictionary: ' + percent + '%'
if (percent > 100) ocounter.textContent = ''
}).on('error', function (err) {
log('____stream error', err)
}).on('change', function (change) {
log('____stream change', dname, change)
}).on('paused', function (info) {
log('____stream paused', dname, info)
}).on('active', function (info) {
log('____stream active', dname, info)
})

return streamDB(upath, dname, stream, config.batch_size)
return streamDB(upath, dict, step, ocounter)
.then(function () {
// console.log('Hooray the stream replication is complete!')
return dname
}).catch(function (err) {
console.log('oh no an error', err.message);
console.log('oh no:', err.message);
})
}

Expand Down Expand Up @@ -372,8 +354,9 @@ document.addEventListener('click', (ev) => {
let cfg = settings.get('cfg')
cfg = JSON.parse(JSON.stringify(cfg))
streamDict(cfg, data.sync)
.then(dname=> {
let installed = _.find(cfg, dict=> { return dict.dname == dname })
.then(res=> {
if (!res) return
let installed = _.find(cfg, dict=> { return dict.dname == data.sync })
if (!installed) return
installed.active = true, installed.sync = true
settings.set('cfg', cfg)
Expand Down
2 changes: 1 addition & 1 deletion src/sections/eng/remote-dicts.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<br> <b>clone</b> before <b>activate</b>.
Cloning and synchronization can take some time, it is slow process.
<!-- But you can work with selected dictionary just after click, before a process will be fully finished. -->
(<b>tip</b>: start from shorter dictionaries to estimate a full synchronization time. <b>tip</b>: if it freezes for a while, just wait a bit. But if you see an error in Tools/Console, reload app with Ctrl-Shift-R and start replication again)
(<b>tip</b>: start from shorter dictionaries to estimate a full synchronization time. <b>tip</b>: if it freezes for a while, just wait a bit. But if you get an error, reload app with Ctrl-Shift-R and start replication again)
</div>

<!-- <div id="before-remote-table" class="error-message">if no remote dictionaries table appears, check an internet connection or just reload a page: </div> -->
Expand Down

0 comments on commit 98a106c

Please sign in to comment.