tiro-notes 0.51.61 → 0.51.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/node-build/cli.js +0 -309
- package/node-build/package.json +0 -28
- package/node-build/v6 copy.ino +0 -956
- package/node-build/v6.ino +0 -872
- /package/{node-build/README.md → README.md} +0 -0
- /package/{node-build/client → client}/appicons/icons/mac/icon.icns +0 -0
- /package/{node-build/client → client}/appicons/icons/png/1024x1024.png +0 -0
- /package/{node-build/client → client}/appicons/icons/png/128x128.png +0 -0
- /package/{node-build/client → client}/appicons/icons/png/16x16.png +0 -0
- /package/{node-build/client → client}/appicons/icons/png/24x24.png +0 -0
- /package/{node-build/client → client}/appicons/icons/png/256x256.png +0 -0
- /package/{node-build/client → client}/appicons/icons/png/32x32.png +0 -0
- /package/{node-build/client → client}/appicons/icons/png/48x48.png +0 -0
- /package/{node-build/client → client}/appicons/icons/png/512x512.png +0 -0
- /package/{node-build/client → client}/appicons/icons/png/64x64.png +0 -0
- /package/{node-build/client → client}/appicons/icons/win/icon.ico +0 -0
- /package/{node-build/client → client}/appicons/tiro_icon.icns +0 -0
- /package/{node-build/client → client}/appicons/tiro_icon.ico +0 -0
- /package/{node-build/client → client}/appicons/tiro_icon.png +0 -0
- /package/{node-build/client → client}/asset-manifest.json +0 -0
- /package/{node-build/client → client}/custom_icons/bottom-left.png +0 -0
- /package/{node-build/client → client}/custom_icons/bottom-right.png +0 -0
- /package/{node-build/client → client}/custom_icons/bottom.png +0 -0
- /package/{node-build/client → client}/custom_icons/check.svg +0 -0
- /package/{node-build/client → client}/custom_icons/left.png +0 -0
- /package/{node-build/client → client}/custom_icons/line.svg +0 -0
- /package/{node-build/client → client}/custom_icons/right.png +0 -0
- /package/{node-build/client → client}/custom_icons/top-left.png +0 -0
- /package/{node-build/client → client}/custom_icons/top-right.png +0 -0
- /package/{node-build/client → client}/custom_icons/top.png +0 -0
- /package/{node-build/client → client}/custom_icons/uncheck.svg +0 -0
- /package/{node-build/client → client}/custom_icons/view-1.svg +0 -0
- /package/{node-build/client → client}/custom_icons/view-2.svg +0 -0
- /package/{node-build/client → client}/custom_icons/view-3.svg +0 -0
- /package/{node-build/client → client}/custom_icons/view-4.svg +0 -0
- /package/{node-build/client → client}/favicon.png +0 -0
- /package/{node-build/client → client}/icon-192x192.png +0 -0
- /package/{node-build/client → client}/icon-256x256.png +0 -0
- /package/{node-build/client → client}/icon-384x384.png +0 -0
- /package/{node-build/client → client}/icon-512x512.png +0 -0
- /package/{node-build/client → client}/index.html +0 -0
- /package/{node-build/client → client}/manifest.json +0 -0
- /package/{node-build/client → client}/manifest.webmanifest +0 -0
- /package/{node-build/client → client}/service-worker.js +0 -0
- /package/{node-build/client → client}/static/css/12.394917b1.chunk.css +0 -0
- /package/{node-build/client → client}/static/js/0.b890b1cb.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/1.24c0d2eb.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/100.4020f20c.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/101.21c27e18.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/102.e3f94c8e.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/103.18e92661.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/104.cd956379.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/105.1e2e5889.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/106.5c24ba4b.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/107.80b988bf.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/108.fff04134.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/109.ec78f8d9.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/110.44788eb1.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/12.6d6dc9bb.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/12.6d6dc9bb.chunk.js.LICENSE.txt +0 -0
- /package/{node-build/client → client}/static/js/13.9e34d8ba.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/14.a886302f.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/15.01bf8225.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/16.67051f41.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/17.82cdd47c.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/18.ddb404ef.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/19.7dd55448.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/2.b4b18203.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/20.59f5165d.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/21.79c4b0e8.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/22.007e32b0.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/23.f61a9d2c.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/24.e0d7947e.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/25.e8450ff4.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/26.ea917da6.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/27.40c86fd7.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/28.36540711.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/29.90bee6cc.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/3.303b3d58.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/30.41fd826a.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/31.ceec3129.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/32.f164128c.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/33.0aa32cf1.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/34.a7b2b96c.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/35.d6fc00c0.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/36.2c384957.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/37.a4733489.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/38.151ab2a6.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/39.79ebafd7.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/4.5e26b40b.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/40.f3d995a0.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/41.e90a9137.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/42.bd656ca1.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/43.8074805b.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/44.8da981a2.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/45.1a2b3b01.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/46.2e55aca9.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/47.57672172.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/48.3bfd34d7.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/49.c657ccf4.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/5.f7811373.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/50.36421e1d.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/51.cd3bd891.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/52.ddd90678.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/53.8933ff1d.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/54.1d25d19c.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/55.f0195607.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/56.931338e0.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/57.8304da63.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/58.3dbe9d9e.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/59.d8dd3c13.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/6.b8cf2c81.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/60.e8ba53a7.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/61.41f7057e.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/62.8312dcd3.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/63.ceff6f5a.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/64.2b51a3a2.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/65.5b662f09.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/66.aed0e545.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/67.c68e472b.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/68.482d5776.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/69.adf6efab.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/7.5575eef7.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/70.54d4c087.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/71.e02a4ef4.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/72.cdabbbd2.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/73.b58eb627.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/74.a7b0defd.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/75.7ee75f2a.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/76.88cf92c8.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/77.64a32f3b.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/78.e19d46e1.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/79.2daf87c6.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/8.977d1a5d.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/80.2591cada.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/81.4a8cdda6.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/82.285db5b4.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/83.c3ae3b75.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/84.0316e16e.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/85.da21c20c.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/86.54af0d45.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/87.c3e1d4bb.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/88.6f1f304d.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/89.9bf1904b.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/9.3b7d0e8d.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/90.f4f97bc7.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/91.06e2ef0f.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/92.05d93a9c.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/93.84099dca.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/94.c20443c3.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/95.eef2f092.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/96.1f09d3f2.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/97.e7cce996.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/98.ed47f20f.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/99.038f33b0.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/main.608d7586.chunk.js +0 -0
- /package/{node-build/client → client}/static/js/runtime-main.bbeed8c8.js +0 -0
- /package/{node-build/client → client}/static/media/book-solid.87f5b737.svg +0 -0
- /package/{node-build/client → client}/static/media/compact-disc-solid.55b6e50c.svg +0 -0
- /package/{node-build/client → client}/static/media/deco-bg-map.7ca9103b.png +0 -0
- /package/{node-build/client → client}/static/media/fa-brands-400.150de8ea.ttf +0 -0
- /package/{node-build/client → client}/static/media/fa-brands-400.e033a13e.woff2 +0 -0
- /package/{node-build/client → client}/static/media/fa-regular-400.3223dc79.woff2 +0 -0
- /package/{node-build/client → client}/static/media/fa-regular-400.d8747423.ttf +0 -0
- /package/{node-build/client → client}/static/media/fa-solid-900.4a2cd718.ttf +0 -0
- /package/{node-build/client → client}/static/media/fa-solid-900.bb975c96.woff2 +0 -0
- /package/{node-build/client → client}/static/media/fa-v4compatibility.0e3a648b.ttf +0 -0
- /package/{node-build/client → client}/static/media/fa-v4compatibility.68577e40.woff2 +0 -0
- /package/{node-build/client → client}/static/media/file-audio-solid.a76f99f0.svg +0 -0
- /package/{node-build/client → client}/static/media/file-code-solid.62b467ac.svg +0 -0
- /package/{node-build/client → client}/static/media/file-excel-solid.217d73db.svg +0 -0
- /package/{node-build/client → client}/static/media/file-pdf-solid.0a9d75fe.svg +0 -0
- /package/{node-build/client → client}/static/media/file-powerpoint-solid.4d969453.svg +0 -0
- /package/{node-build/client → client}/static/media/file-solid.6415173e.svg +0 -0
- /package/{node-build/client → client}/static/media/file-video-solid.312288cf.svg +0 -0
- /package/{node-build/client → client}/static/media/file-word-solid.9228e1ff.svg +0 -0
- /package/{node-build/client → client}/static/media/file-zipper-solid.7db57917.svg +0 -0
- /package/{node-build/client → client}/static/media/globe-africa-solid.0ad34146.svg +0 -0
- /package/{node-build/client → client}/static/media/link-solid.7b689dbd.svg +0 -0
- /package/{node-build/client → client}/static/media/open-sans-all-400-normal.cb2542fc.woff +0 -0
- /package/{node-build/client → client}/static/media/open-sans-all-700-normal.105e4309.woff +0 -0
- /package/{node-build/client → client}/static/media/open-sans-all-800-normal.86e783c7.woff +0 -0
- /package/{node-build/client → client}/static/media/open-sans-cyrillic-400-normal.5a546777.woff2 +0 -0
- /package/{node-build/client → client}/static/media/open-sans-cyrillic-700-normal.2cf6253f.woff2 +0 -0
- /package/{node-build/client → client}/static/media/open-sans-cyrillic-800-normal.41902933.woff2 +0 -0
- /package/{node-build/client → client}/static/media/open-sans-cyrillic-ext-400-normal.01b11c56.woff2 +0 -0
- /package/{node-build/client → client}/static/media/open-sans-cyrillic-ext-700-normal.00b4dd17.woff2 +0 -0
- /package/{node-build/client → client}/static/media/open-sans-cyrillic-ext-800-normal.2c1c4cc5.woff2 +0 -0
- /package/{node-build/client → client}/static/media/open-sans-greek-400-normal.3064bf7e.woff2 +0 -0
- /package/{node-build/client → client}/static/media/open-sans-greek-700-normal.a0312547.woff2 +0 -0
- /package/{node-build/client → client}/static/media/open-sans-greek-800-normal.d60c6496.woff2 +0 -0
- /package/{node-build/client → client}/static/media/open-sans-greek-ext-400-normal.1ed998a4.woff2 +0 -0
- /package/{node-build/client → client}/static/media/open-sans-greek-ext-700-normal.8850c90c.woff2 +0 -0
- /package/{node-build/client → client}/static/media/open-sans-greek-ext-800-normal.fe3583f2.woff2 +0 -0
- /package/{node-build/client → client}/static/media/open-sans-hebrew-400-normal.daafcec8.woff2 +0 -0
- /package/{node-build/client → client}/static/media/open-sans-hebrew-700-normal.3befb44d.woff2 +0 -0
- /package/{node-build/client → client}/static/media/open-sans-hebrew-800-normal.bfe88fed.woff2 +0 -0
- /package/{node-build/client → client}/static/media/open-sans-latin-400-normal.a1535f45.woff2 +0 -0
- /package/{node-build/client → client}/static/media/open-sans-latin-700-normal.b245bc85.woff2 +0 -0
- /package/{node-build/client → client}/static/media/open-sans-latin-800-normal.185f6b03.woff2 +0 -0
- /package/{node-build/client → client}/static/media/open-sans-latin-ext-400-normal.ccfa20f8.woff2 +0 -0
- /package/{node-build/client → client}/static/media/open-sans-latin-ext-700-normal.64471a17.woff2 +0 -0
- /package/{node-build/client → client}/static/media/open-sans-latin-ext-800-normal.988eae1a.woff2 +0 -0
- /package/{node-build/client → client}/static/media/open-sans-vietnamese-400-normal.473f6b09.woff2 +0 -0
- /package/{node-build/client → client}/static/media/open-sans-vietnamese-700-normal.b4c5968d.woff2 +0 -0
- /package/{node-build/client → client}/static/media/open-sans-vietnamese-800-normal.27b69d87.woff2 +0 -0
- /package/{node-build/client → client}/static/media/search-solid.cc51b702.svg +0 -0
- /package/{node-build/client → client}/tiro-local.crt +0 -0
- /package/{node-build/server → server}/ssl/tiro-local.crt +0 -0
- /package/{node-build/server → server}/ssl/tiro-local.key +0 -0
- /package/{node-build/server → server}/tiro-server.js +0 -0
- /package/{node-build/server → server}/tiro-server.js.LICENSE.txt +0 -0
- /package/{node-build/shared.helpers.build.js → shared.helpers.build.js} +0 -0
package/package.json
CHANGED
package/node-build/cli.js
DELETED
|
@@ -1,309 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// const isDev = false
|
|
4
|
-
const isDev = process.env.ISDEV
|
|
5
|
-
const tHelpers = isDev ? require('../shared.helpers.js') : require(`./shared.helpers.build.js`);
|
|
6
|
-
const pathServerJs = isDev ? `${__dirname}/node-build/server/tiro-server.js` : `${__dirname}/server/tiro-server.js`
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
// CLI HELP MANUAL
|
|
10
|
-
const outputHelp = () => {
|
|
11
|
-
var p = require('./package.json');
|
|
12
|
-
const tiroHelpString = `
|
|
13
|
-
VERSION:
|
|
14
|
-
===
|
|
15
|
-
${p.name.toUpperCase()} v.${p.version} ${isDev ? '(**dev**)' : ''}
|
|
16
|
-
|
|
17
|
-
DESCRIPTION:
|
|
18
|
-
===
|
|
19
|
-
${p.description}
|
|
20
|
-
|
|
21
|
-
====
|
|
22
|
-
|
|
23
|
-
--https/-s : enable https ssl with self signed certificate (boolean, false by default)
|
|
24
|
-
--port/-p : port to use (number, 3023 by default)
|
|
25
|
-
--no-open/-no : do not open Tiro in browser when starting
|
|
26
|
-
--verbose/-v : control logs verbosity [0/1/2/3] (0:none, 1: critical, 2: all, 3: performance monitoring)
|
|
27
|
-
|
|
28
|
-
--tunnel/-t : [require autossh to be installed first!] uses autossh to "publish" the app on the web, requires a server you can access with ssh and autossh installed on that device. (ex:npx tiro-notes@latest -t REMOTE_USER@REMOTE_URL:REMOTE_PORT)
|
|
29
|
-
--tunnel-timeout/-tt : [require autossh to be installed first!] autokill tunnel after x hours (default: -1)
|
|
30
|
-
|
|
31
|
-
--backup/-b : [t/n/now/force/f] [require tar to be installed first!] will incrementally backup changes in archives like tiro.0.xz.tar, tiro.1.xz.tar... every day in a specific folder.
|
|
32
|
-
You can then execute commands after that process in a post backup script (useful for syncing these archives to clouds, think rsync, rclone etc.)
|
|
33
|
-
All folders will be backed up with the exception of folders ending by _NOBAK_ (ex: "my_folder_NOBAK_").
|
|
34
|
-
|
|
35
|
-
--backup-folder : modify backup folder destination. (default: "your/path/to/tiro/data_folder"+_backup
|
|
36
|
-
--backup-post-script : modify script to be executed after a backup finishes. Should be a ".txt" file with your OS commands. (default: "your/path/to/tiro/data_folder"+_backup/post_backup_script.txt
|
|
37
|
-
|
|
38
|
-
--help/-h : help
|
|
39
|
-
|
|
40
|
-
EXAMPLES:
|
|
41
|
-
====
|
|
42
|
-
- npx tiro-notes
|
|
43
|
-
- npx tiro-notes --tunnel ubuntu@myserver.com:3023 --port 3033 --https true
|
|
44
|
-
- npx tiro-notes -t ubuntu@myserver.com:3023 -p 3033 -s true
|
|
45
|
-
`;
|
|
46
|
-
console.log(tiroHelpString);
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// open frontend on default browser
|
|
51
|
-
const openInBrowser = (url) => {
|
|
52
|
-
var start = (process.platform == 'darwin'? 'open': process.platform == 'win32'? 'start': 'xdg-open');
|
|
53
|
-
require('child_process').exec(start + ' ' + url);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
function getCliArgs () {
|
|
58
|
-
var args = process.argv;
|
|
59
|
-
var argsObj = {
|
|
60
|
-
port: 3023,
|
|
61
|
-
https: false,
|
|
62
|
-
help: false,
|
|
63
|
-
open: true,
|
|
64
|
-
verbose: false,
|
|
65
|
-
backup: {
|
|
66
|
-
enabled: false,
|
|
67
|
-
now: false,
|
|
68
|
-
location: "default",
|
|
69
|
-
scriptLocation: "default"
|
|
70
|
-
},
|
|
71
|
-
tunnel: {
|
|
72
|
-
enabled: false,
|
|
73
|
-
timeout: -1,
|
|
74
|
-
},
|
|
75
|
-
}
|
|
76
|
-
for (var i = 0; i < args.length; i++) {
|
|
77
|
-
if (i % 2 !== 0) continue
|
|
78
|
-
var argName = args[i];
|
|
79
|
-
var argVal = args[i+1];
|
|
80
|
-
argName = argName.replace('--', '').replace('-','')
|
|
81
|
-
if (argName === 'p' || argName === 'port') argsObj.port = parseInt(argVal);
|
|
82
|
-
if (argName === 's' || argName === 'https') argsObj.https = true
|
|
83
|
-
if (argName === 'h' || argName === 'help') argsObj.help = true
|
|
84
|
-
if (argName === 'no-open' || argName === 'no') argsObj.open = false
|
|
85
|
-
if (argName === 'v' || argName === 'verbose') argsObj.verbose = parseInt(argVal)
|
|
86
|
-
|
|
87
|
-
if (argName === 'b' || argName === 'backup') argsObj.backup.enabled = true
|
|
88
|
-
if (argName === 'b' || argName === 'backup') argsObj.backup.now = (argVal === "now" || argVal === "n" || argVal === "force" || argVal === "f") ? true : false
|
|
89
|
-
if (argName === 'backup-location') argsObj.backup.location = argVal
|
|
90
|
-
if (argName === 'backup-post-script') argsObj.backup.scriptLocation = argVal
|
|
91
|
-
|
|
92
|
-
if (argName === 'tt' || argName === 'tunnel-timeout') argsObj.tunnel.timeout = parseInt(argVal)
|
|
93
|
-
if (argName === 't' || argName === 'tunnel') {
|
|
94
|
-
const argsArr = argVal.split(':')
|
|
95
|
-
if (argsArr.length > 1) {
|
|
96
|
-
argsObj.tunnel.enabled = true
|
|
97
|
-
argsObj.tunnel.remoteUrl = argsArr[0]
|
|
98
|
-
argsObj.tunnel.remotePort = parseInt(argsArr[1])
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
return argsObj;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function startTiroServer (argsObj, cb) {
|
|
106
|
-
console.log(`Starting Tiro-Notes from CLI with following arguments : ${JSON.stringify(argsObj)}`);
|
|
107
|
-
|
|
108
|
-
// kill all possible remaining servers of tiro
|
|
109
|
-
tHelpers.killPreviousInstances(() => {
|
|
110
|
-
|
|
111
|
-
// start tiro server, detect success message and get server params
|
|
112
|
-
tHelpers.execCmd('node', [pathServerJs], {
|
|
113
|
-
logLevel: argsObj.verbose,
|
|
114
|
-
env: {
|
|
115
|
-
TIRO_PORT: argsObj.port,
|
|
116
|
-
TIRO_HTTPS: argsObj.https,
|
|
117
|
-
TIRO_PERFORMANCE_MONITORING_BACKEND: argsObj.verbose === 3
|
|
118
|
-
},
|
|
119
|
-
logName: 'tiroServer',
|
|
120
|
-
onLog: str => {
|
|
121
|
-
// we get params like dataFolder from server.js directly
|
|
122
|
-
tHelpers.checkAndGetTiroConfig(str, {platform: 'cli', cb})
|
|
123
|
-
}
|
|
124
|
-
})
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
const startBackupScript = async (argsObj, dataFolder) => {
|
|
129
|
-
if (!argsObj.backup.enabled) return;
|
|
130
|
-
if (!dataFolder) return console.warn ("[BACKUP] no dataFolder detected!");
|
|
131
|
-
|
|
132
|
-
// get BACKUP_FOLDER path
|
|
133
|
-
const defaultBackupFolder = dataFolder + "_backup/"
|
|
134
|
-
const backupFolder = argsObj.backup.location !== "default" ? argsObj.backup.location : defaultBackupFolder
|
|
135
|
-
// if does not exists, create it
|
|
136
|
-
if (!tHelpers.fileExists(backupFolder)) await tHelpers.createDir(backupFolder)
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
// get POST_BACKUP_SCRIPT
|
|
140
|
-
const defaultPostBackupScript = backupFolder + "post_backup_script.txt"
|
|
141
|
-
const postBackupScriptFile = argsObj.backup.scriptLocation !== "default" ? argsObj.backup.scriptLocation : defaultPostBackupScript
|
|
142
|
-
// if does not exists, create it, empty
|
|
143
|
-
if (!tHelpers.fileExists(postBackupScriptFile)) await tHelpers.saveFile(postBackupScriptFile, "")
|
|
144
|
-
let postBackupScript = await tHelpers.openFile(postBackupScriptFile)
|
|
145
|
-
if (postBackupScript) postBackupScript += ";"
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
// get LAST_BACKUP_TIMESTAMP
|
|
149
|
-
const timestampFile = backupFolder + "last_backup_timestamp.txt"
|
|
150
|
-
const now = () => new Date().getTime()
|
|
151
|
-
// if does not exists, create it, then give a timestamp of 0
|
|
152
|
-
if (!tHelpers.fileExists(timestampFile)) await tHelpers.saveFile(timestampFile, "0")
|
|
153
|
-
const getLastTimestamp = async () => {
|
|
154
|
-
let lastBackupTimestampRaw = await tHelpers.openFile(timestampFile);
|
|
155
|
-
let lastBackupTimestamp = parseInt(lastBackupTimestampRaw)
|
|
156
|
-
return lastBackupTimestamp
|
|
157
|
-
}
|
|
158
|
-
let replaceTimestampCli = () => `echo ${now()} > '${timestampFile}'`
|
|
159
|
-
|
|
160
|
-
// START INTERVAL
|
|
161
|
-
// const timeInterval = 1000 * 60 * 60 // one hour
|
|
162
|
-
const timeInterval = 1000 * 60 * 10 // one hour
|
|
163
|
-
const backupInterval = 1000 * 60 * 60 * 24 // one day
|
|
164
|
-
|
|
165
|
-
const tarExec = process.platform === "darwin" ? "gtar" : "tar"
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
console.log ("[BACKUP] starting backup logic!");
|
|
169
|
-
|
|
170
|
-
let debugBackupNow = isDev ? false : false
|
|
171
|
-
if (argsObj.backup.now) debugBackupNow = true
|
|
172
|
-
const processBackupEveryDay = async () => {
|
|
173
|
-
// if > 1 day
|
|
174
|
-
const lastTimestamp = await getLastTimestamp()
|
|
175
|
-
const diff = backupInterval + lastTimestamp - new Date().getTime()
|
|
176
|
-
const diffMin = Math.round(diff / (1000 * 60))
|
|
177
|
-
// are we between 1am-5am ?
|
|
178
|
-
const isBetween1am5am = new Date().getHours() >= 1 && new Date().getHours() <= 5
|
|
179
|
-
if ((diff < 0 && isBetween1am5am) || debugBackupNow) {
|
|
180
|
-
debugBackupNow = false
|
|
181
|
-
console.log(`[BACKUP] time has come, BACKUP! (debugBackupNow:${debugBackupNow}) ==> LOGS in log_backup.txt`);
|
|
182
|
-
|
|
183
|
-
// automatically generate a cli.sh from command below and post backup script, then exec it
|
|
184
|
-
let backupCli = `
|
|
185
|
-
${replaceTimestampCli()};
|
|
186
|
-
mkdir '${backupFolder}';
|
|
187
|
-
mkdir '${backupFolder}/backups';
|
|
188
|
-
cd '${backupFolder}';
|
|
189
|
-
echo '====== [${new Date().toLocaleString()}] -> new backup started' >> log_backups.txt;
|
|
190
|
-
${tarExec} --xz --verbose --create --file="backups/tiro.$(ls backups/ | wc -l | sed 's/^ *//;s/ *$//').tar.xz" '${dataFolder}' --listed-incremental='${backupFolder}metadata.snar' --exclude=\'*_NOBAK_';
|
|
191
|
-
echo ' [${new Date().toLocaleString()}] -> compression archive finished' >> log_backups.txt; ${postBackupScript};
|
|
192
|
-
echo ' [${new Date().toLocaleString()}] -> upload finished' >> log_backups.txt;`
|
|
193
|
-
// append to backup CLI current timestamp to last_backup_timestamp
|
|
194
|
-
// remove \n from backupCli
|
|
195
|
-
backupCli = backupCli.replace(/\n/g, ' ')
|
|
196
|
-
// replace all ;; by ;
|
|
197
|
-
backupCli = backupCli.replace(/;;/g, ';')
|
|
198
|
-
|
|
199
|
-
// execute cli
|
|
200
|
-
tHelpers.execCmdInFile(backupCli, backupFolder+"cli.sh", {
|
|
201
|
-
logLevel: argsObj.verbose
|
|
202
|
-
// logLevel: 2 // log level always 2 for backup to see whats happening
|
|
203
|
-
})
|
|
204
|
-
|
|
205
|
-
const debugObj = {backupFolder, postBackupScriptFile, lastTimestamp, postBackupScript, timeInterval, backupCli}
|
|
206
|
-
|
|
207
|
-
console.log (debugObj);
|
|
208
|
-
} else {
|
|
209
|
-
const logTime = new Date().toLocaleString()
|
|
210
|
-
console.log(`[BACKUP] ${logTime} => not yet. Waiting for ${diffMin} mins < 0 AND between 1am-5am ${JSON.stringify({isBetween1am5am, currHour: new Date().getHours()})}}`);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
// every hour
|
|
215
|
-
processBackupEveryDay();
|
|
216
|
-
let int = setInterval(() => {
|
|
217
|
-
processBackupEveryDay()
|
|
218
|
-
}, timeInterval)
|
|
219
|
-
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
const startSshTunnel = (argsObj) => {
|
|
223
|
-
if (argsObj.tunnel.enabled) {
|
|
224
|
-
// kill previous autossh processes
|
|
225
|
-
let cb2 = true
|
|
226
|
-
let cb1 = true
|
|
227
|
-
tHelpers.execCmd('killall', [`autossh`], {
|
|
228
|
-
logName:'tunnel 1/3',
|
|
229
|
-
onLog: () => {
|
|
230
|
-
if (!cb2) return
|
|
231
|
-
cb2 = false
|
|
232
|
-
// check if autossh is working
|
|
233
|
-
tHelpers.execCmd('autossh', [`-V`], {
|
|
234
|
-
logName:'tunnel 2/3',
|
|
235
|
-
onLog: str => {
|
|
236
|
-
if (!cb1) return
|
|
237
|
-
cb1 = false
|
|
238
|
-
// start autossh finally
|
|
239
|
-
tHelpers.execCmd('autossh',['-M',`2${argsObj.tunnel.remotePort}`,'-N', argsObj.tunnel.remoteUrl,'-R', `${argsObj.tunnel.remotePort}:localhost:${argsObj.port}`,'-C'], {
|
|
240
|
-
logName:'tunnel 3/3'
|
|
241
|
-
})
|
|
242
|
-
|
|
243
|
-
// if tunnel.timeout != 1
|
|
244
|
-
if (argsObj.tunnel.timeout != 1) {
|
|
245
|
-
console.log(`Tunnel timeout set to ${argsObj.tunnel.timeout}h.`)
|
|
246
|
-
setTimeout(() => {
|
|
247
|
-
console.log(`Tunnel timeout reached (${argsObj.tunnel.timeout}h). Closing tunnel.`, str)
|
|
248
|
-
tHelpers.execCmd('killall', [`autossh`], {
|
|
249
|
-
logName:'tunnel 4/3',
|
|
250
|
-
onLog: str => {
|
|
251
|
-
console.log(`Tunnel timeout reached (${argsObj.tunnel.timeout}h). Closing tunnel.`, str)
|
|
252
|
-
}
|
|
253
|
-
})
|
|
254
|
-
}, argsObj.tunnel.timeout * 1000 * 60 * 60)
|
|
255
|
-
let countHours = 0
|
|
256
|
-
setTimeout(() => {
|
|
257
|
-
countHours++
|
|
258
|
-
console.log(`Tunnel timeout in ${argsObj.tunnel.timeout - countHours}h`)
|
|
259
|
-
}, argsObj.tunnel.timeout * 1000 * 60 )
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
})
|
|
263
|
-
}
|
|
264
|
-
})
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
// Main script
|
|
269
|
-
function main () {
|
|
270
|
-
|
|
271
|
-
var argsObj = getCliArgs();
|
|
272
|
-
|
|
273
|
-
if (argsObj.help) {
|
|
274
|
-
|
|
275
|
-
outputHelp();
|
|
276
|
-
|
|
277
|
-
} else {
|
|
278
|
-
|
|
279
|
-
startTiroServer(argsObj, (configServerObj) => {
|
|
280
|
-
|
|
281
|
-
const c = configServerObj
|
|
282
|
-
const protocol = c.https ? 'https' : 'http'
|
|
283
|
-
const port = c.port
|
|
284
|
-
const dataFolder = c.dataFolder
|
|
285
|
-
|
|
286
|
-
// open in browser
|
|
287
|
-
if (argsObj.open) openInBrowser(`${protocol}://localhost:${port}`);
|
|
288
|
-
|
|
289
|
-
// start tunnel with autossh if asked
|
|
290
|
-
startSshTunnel(argsObj);
|
|
291
|
-
|
|
292
|
-
// start backup script
|
|
293
|
-
startBackupScript(argsObj, dataFolder);
|
|
294
|
-
|
|
295
|
-
})
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
const test = () => {
|
|
300
|
-
var argsObj = getCliArgs();
|
|
301
|
-
// startBackupScript(argsObj, "/Users/gregoirethiebault/Desktop/your markdown notes")
|
|
302
|
-
startBackupScript(argsObj, "/Users/gregoirethiebault/Desktop/nodal_ex")
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
// start everything
|
|
307
|
-
// isDev ? test() : main();
|
|
308
|
-
isDev ? main() : main();
|
|
309
|
-
|
package/node-build/package.json
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "tiro-notes",
|
|
3
|
-
"version": "0.51.61",
|
|
4
|
-
"description": "Tiro Notes CLI to start Tiro Notes from the command line!",
|
|
5
|
-
"scripts": {
|
|
6
|
-
"dev": "ISDEV=true node cli.js",
|
|
7
|
-
"clean-previous-build": "rm -r node-build",
|
|
8
|
-
"export-cli-module": "cp -r ../../build node-build; cp cli.js node-build/; cp package.json node-build/; ",
|
|
9
|
-
"export-helpers": "cp ../shared.helpers.js ./node-build/shared.helpers.build.js",
|
|
10
|
-
"root-build": "cd ../..; run-s build ",
|
|
11
|
-
"build-then-publish": "run-s root-build publish-to-npm-prod",
|
|
12
|
-
"build-then-publish-dev": "run-s root-build publish-to-npm-dev",
|
|
13
|
-
"publish-to-npm-prod": "cd ./platforms/npm-cli-module; npm run clean-previous-build; npm run export-cli-module; npm run export-helpers; echo WARNING REQUIRES NPM LOGIN BEFORE PUBLISHING!; cd node-build; npm publish",
|
|
14
|
-
"publish-to-npm-dev": "cd ./platforms/npm-cli-module; npm run clean-previous-build; cp ../../.npmrc ./.npmrc; npm run export-cli-module; npm run export-helpers; echo WARNING REQUIRES NPM LOGIN BEFORE PUBLISHING! new method token which expires, check 'npm module and npx' note for more infos; cd node-build; npm publish --tag=develop"
|
|
15
|
-
},
|
|
16
|
-
"bin": "cli.js",
|
|
17
|
-
"repository": {
|
|
18
|
-
"type": "git",
|
|
19
|
-
"url": "https://github.com/dotgreg/tiro"
|
|
20
|
-
},
|
|
21
|
-
"author": "thiebault.gregoire@gmail.com",
|
|
22
|
-
"license": "ISC",
|
|
23
|
-
"homepage": "https://github.com/dotgreg/tiro",
|
|
24
|
-
"dependencies": {
|
|
25
|
-
"npm-run-all": "^4.1.5"
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|