Compare commits

...

8 Commits

Author SHA1 Message Date
zadam b8509c487d release 0.34.1 2019-07-28 15:02:36 +02:00
zadam 083dee9bdd note activation from API will also scroll to it / focus 2019-07-28 14:47:35 +02:00
zadam 0c2dd6aa35 fix distraction free mode 2019-07-28 14:36:40 +02:00
zadam 743c15aacc fix code editor in mobile 2019-07-28 14:23:41 +02:00
zadam 263bff903c mobile frontend shows only the active tab 2019-07-28 14:08:05 +02:00
zadam 741dfaf2de hide tab row in distraction free mode 2019-07-28 13:50:46 +02:00
zadam b3834324f6 fix sync proxy with TLS 2019-07-24 20:47:41 +02:00
zadam ea0835561c option to use node's http client for sync without proxy 2019-07-22 22:46:06 +02:00
9 changed files with 124 additions and 37 deletions
+65 -1
View File
@@ -1,6 +1,6 @@
{
"name": "trilium",
"version": "0.33.7",
"version": "0.34.0-beta",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -661,6 +661,14 @@
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-6.1.1.tgz",
"integrity": "sha512-OtUw6JUTgxA2QoqqmrmQ7F2NYqiBPi/L2jqHyFtllhOUvXYQXf0Z1CYUinIfyT4bTCGmrA7gX9FvHA81uzCoVw=="
},
"agent-base": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz",
"integrity": "sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==",
"requires": {
"es6-promisify": "^5.0.0"
}
},
"ajv": {
"version": "5.5.2",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz",
@@ -4111,6 +4119,19 @@
"is-symbol": "^1.0.2"
}
},
"es6-promise": {
"version": "4.2.8",
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz",
"integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w=="
},
"es6-promisify": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz",
"integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=",
"requires": {
"es6-promise": "^4.0.3"
}
},
"escape-html": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
@@ -6615,6 +6636,25 @@
"toidentifier": "1.0.0"
}
},
"http-proxy-agent": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-2.1.0.tgz",
"integrity": "sha512-qwHbBLV7WviBl0rQsOzH6o5lwyOIvwp/BdFnvVxXORldu5TmjFfjzBcWUWS5kWAZhmv+JtiDhSuQCp4sBfbIgg==",
"requires": {
"agent-base": "4",
"debug": "3.1.0"
},
"dependencies": {
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"requires": {
"ms": "2.0.0"
}
}
}
},
"http-signature": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
@@ -6625,6 +6665,30 @@
"sshpk": "^1.7.0"
}
},
"https-proxy-agent": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.2.tgz",
"integrity": "sha512-c8Ndjc9Bkpfx/vCJueCPy0jlP4ccCCSNDp8xwCZzPjKJUm+B+u9WX2x98Qx4n1PiMNTWo3D7KK5ifNV/yJyRzg==",
"requires": {
"agent-base": "^4.3.0",
"debug": "^3.1.0"
},
"dependencies": {
"debug": {
"version": "3.2.6",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
"integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==",
"requires": {
"ms": "^2.1.1"
}
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
}
}
},
"humanize-plus": {
"version": "1.8.2",
"resolved": "https://registry.npmjs.org/humanize-plus/-/humanize-plus-1.8.2.tgz",
+3 -1
View File
@@ -2,7 +2,7 @@
"name": "trilium",
"productName": "Trilium Notes",
"description": "Trilium Notes",
"version": "0.34.0-beta",
"version": "0.34.1",
"license": "AGPL-3.0-only",
"main": "electron.js",
"bin": {
@@ -43,6 +43,8 @@
"helmet": "3.19.0",
"html": "1.0.0",
"html2plaintext": "2.1.2",
"http-proxy-agent": "^2.1.0",
"https-proxy-agent": "^2.2.2",
"image-type": "4.1.0",
"imagemin": "7.0.0",
"imagemin-giflossy": "5.1.10",
@@ -39,7 +39,11 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte
* @param {string} notePath (or noteId)
* @returns {Promise<void>}
*/
this.activateNote = treeService.activateNote;
this.activateNote = async (notePath, noteLoadedListener) => {
await treeService.activateNote(notePath, noteLoadedListener);
await treeService.scrollToActiveNote();
};
/**
* Activates newly created note. Compared to this.activateNote() also refreshes tree.
+13 -3
View File
@@ -196,7 +196,11 @@ async function resolveNotePath(notePath) {
async function getRunPath(notePath) {
utils.assertArguments(notePath);
notePath = notePath.split("-")[0];
notePath = notePath.split("-")[0].trim();
if (notePath.length === 0) {
return;
}
const path = notePath.split("/").reverse();
@@ -362,7 +366,7 @@ async function treeInitialized() {
}
}
const filteredTabs = [];
let filteredTabs = [];
for (const openTab of openTabs) {
const noteId = treeUtils.getNoteIdFromNotePath(openTab.notePath);
@@ -373,6 +377,11 @@ async function treeInitialized() {
}
}
if (utils.isMobile()) {
// mobile frontend doesn't have tabs so show only the active tab
filteredTabs = filteredTabs.filter(tab => tab.active);
}
if (filteredTabs.length === 0) {
filteredTabs.push({
notePath: 'root',
@@ -872,5 +881,6 @@ export default {
getNodeFromPath,
resolveNotePath,
getSomeNotePath,
focusTree
focusTree,
scrollToActiveNote
};
+1 -2
View File
@@ -20,8 +20,7 @@ body {
#container.distraction-free-mode {
grid-template-areas:
"title"
"note-detail" !important;
"tab-container" !important;
grid-template-rows: auto
auto
!important;
+1 -1
View File
@@ -1 +1 @@
module.exports = { buildDate:"2019-07-21T21:57:35+02:00", buildRevision: "6d5f8e056263dbaaf3abf2d532a4fd1059745b58" };
module.exports = { buildDate:"2019-07-28T15:02:36+02:00", buildRevision: "083dee9bdd98ff4579fbd221e3b3d5f9a871b685" };
+31 -25
View File
@@ -8,7 +8,13 @@ const url = require('url');
// this allows to support system proxy
function exec(opts) {
// hack for cases where electron.net does not work but we don't want to set proxy
if (opts.proxy === 'noproxy') {
opts.proxy = null;
}
const client = getClient(opts);
const proxyAgent = getProxyAgent(opts);
const parsedTargetUrl = url.parse(opts.url);
return new Promise(async (resolve, reject) => {
@@ -24,34 +30,18 @@ function exec(opts) {
headers['Authorization'] = `Basic ${token}`;
}
let host = parsedTargetUrl.hostname;
let protocol = parsedTargetUrl.protocol;
let port = parsedTargetUrl.port;
let path = parsedTargetUrl.path;
if (opts.proxy) {
// see https://stackoverflow.com/questions/3862813/how-can-i-use-an-http-proxy-with-node-js-http-client
const parsedProxyUrl = url.parse(opts.proxy);
protocol = parsedProxyUrl.protocol;
host = parsedProxyUrl.hostname;
port = parsedProxyUrl.port;
path = opts.url;
headers['Host'] = parsedTargetUrl.host; // host also includes port
}
const request = client.request({
method: opts.method,
// url is used by electron net module
url: opts.url,
// 4 fields below are used by http and https node modules
protocol,
host,
port,
path,
protocol: parsedTargetUrl.protocol,
host: parsedTargetUrl.hostname,
port: parsedTargetUrl.port,
path: parsedTargetUrl.path,
timeout: opts.timeout,
headers
headers,
agent: proxyAgent
});
request.on('error', err => reject(generateError(opts, err)));
@@ -91,6 +81,24 @@ function exec(opts) {
})
}
function getProxyAgent(opts) {
if (!opts.proxy) {
return;
}
const {protocol} = url.parse(opts.url);
if (protocol === 'http:' || protocol === 'https:') {
const protoNoColon = protocol.substr(0, protocol.length - 1);
const AgentClass = require(protoNoColon + '-proxy-agent');
return new AgentClass(opts.proxy);
}
else {
return null;
}
}
function getClient(opts) {
// it's not clear how to explicitly configure proxy (as opposed to system proxy)
// so in that case we always use node's modules
@@ -98,9 +106,7 @@ function getClient(opts) {
return require('electron').net;
}
else {
// in case there's explicit proxy then we need to use protocol of the proxy since we're actually
// connecting to the proxy server and not to the end-target server
const {protocol} = url.parse(opts.proxy || opts.url);
const {protocol} = url.parse(opts.url);
if (protocol === 'http:' || protocol === 'https:') {
return require(protocol.substr(0, protocol.length - 1));
+3 -1
View File
@@ -53,7 +53,9 @@
<div class="note-detail-text-editor"></div>
</div>
<div class="note-detail-code note-detail-component"></div>
<div class="note-detail-code note-detail-component">
<div class="note-detail-code-editor"></div>
</div>
<% include details/search.ejs %>
+2 -2
View File
@@ -1,4 +1,4 @@
<div class="note-tab-row">
<div class="note-tab-row hide-toggle">
<div class="note-tab-row-content"></div>
</div>
@@ -33,7 +33,7 @@
<% include details/protected_session_password.ejs %>
<div class="children-overview"></div>
<div class="children-overview hide-toggle"></div>
</div>
<div class="attribute-list">