"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "packages/app-clipper/popup/src/bridge.js" between
joplin-2.1.8.tar.gz and joplin-2.1.9.tar.gz

About: Joplin is a cross-platform note taking and to-do application with synchronisation capabilities.

bridge.js  (joplin-2.1.8):bridge.js  (joplin-2.1.9)
skipping to change at line 102 skipping to change at line 102
} }
async onReactAppStarts() { async onReactAppStarts() {
await this.findClipperServerPort(); await this.findClipperServerPort();
if (this.clipperServerPortStatus_ !== 'found') { if (this.clipperServerPortStatus_ !== 'found') {
console.info('Skipping initialisation because server port was not found'); console.info('Skipping initialisation because server port was not found');
return; return;
} }
await this.restoreState(); const restoredState = await this.restoreState();
await this.checkAuth(); await this.checkAuth();
if (!this.token_) return; // Didn't get a token if (!this.token_) return; // Didn't get a token
const folders = await this.folderTree(); const folders = await this.folderTree();
this.dispatch({ type: 'FOLDERS_SET', folders: folders.items ? fol ders.items : folders }); this.dispatch({ type: 'FOLDERS_SET', folders: folders.items ? fol ders.items : folders });
let tags = []; let tags = [];
for (let page = 1; page < 10000; page++) { for (let page = 1; page < 10000; page++) {
const result = await this.clipperApiExec('GET', 'tags', { page: page, order_by: 'title', order_dir: 'ASC' }); const result = await this.clipperApiExec('GET', 'tags', { page: page, order_by: 'title', order_dir: 'ASC' });
const resultTags = result.items ? result.items : result; const resultTags = result.items ? result.items : result;
const hasMore = ('has_more' in result) && result.has_more ; const hasMore = ('has_more' in result) && result.has_more ;
tags = tags.concat(resultTags); tags = tags.concat(resultTags);
if (!hasMore) break; if (!hasMore) break;
} }
this.dispatch({ type: 'TAGS_SET', tags: tags }); this.dispatch({ type: 'TAGS_SET', tags: tags });
if (restoredState.selectedFolderId) this.dispatch({ type: 'SELECT ED_FOLDER_SET', id: restoredState.selectedFolderId });
} }
async checkAuth() { async checkAuth() {
this.dispatch({ type: 'AUTH_STATE_SET', value: 'starting' }); this.dispatch({ type: 'AUTH_STATE_SET', value: 'starting' });
const existingToken = await this.storageGet(['token']); const existingToken = await this.storageGet(['token']);
this.token_ = existingToken.token; this.token_ = existingToken.token;
const authCheckResponse = await this.clipperApiExec('GET', 'auth/ check', { token: this.token_ }); const authCheckResponse = await this.clipperApiExec('GET', 'auth/ check', { token: this.token_ });
skipping to change at line 242 skipping to change at line 243
console.info('Popup: Saving state', toSave); console.info('Popup: Saving state', toSave);
this.storageSet(toSave); this.storageSet(toSave);
}, 100); }, 100);
} }
async restoreState() { async restoreState() {
const s = await this.storageGet(null); const s = await this.storageGet(null);
console.info('Popup: Restoring saved state:', s); console.info('Popup: Restoring saved state:', s);
if (!s) return; return s;
if (s.selectedFolderId) this.dispatch({ type: 'SELECTED_FOLDER_SE
T', id: s.selectedFolderId });
} }
async findClipperServerPort() { async findClipperServerPort() {
this.dispatch({ type: 'CLIPPER_SERVER_SET', foundState: 'searchin g' }); this.dispatch({ type: 'CLIPPER_SERVER_SET', foundState: 'searchin g' });
let state = null; let state = null;
for (let i = 0; i < 10; i++) { for (let i = 0; i < 10; i++) {
state = randomClipperPort(state, this.env()); state = randomClipperPort(state, this.env());
try { try {
 End of changes. 3 change blocks. 
5 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)