summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.mailmap14
-rw-r--r--README.md4
-rw-r--r--app.js16
-rw-r--r--lib/config/default.js1
-rw-r--r--lib/config/environment.js2
-rw-r--r--lib/config/index.js2
-rw-r--r--lib/history.js15
-rw-r--r--lib/models/note.js6
-rw-r--r--locales/ja.json217
-rw-r--r--package.json2
-rw-r--r--public/js/lib/editor/toolbar.html4
-rw-r--r--yarn.lock6
12 files changed, 174 insertions, 115 deletions
diff --git a/.mailmap b/.mailmap
new file mode 100644
index 00000000..8f14718b
--- /dev/null
+++ b/.mailmap
@@ -0,0 +1,14 @@
+Max Wu <jackymaxj@gmail.com> Wu Cheng-Han <jacky_cute0808@hotmail.com>
+Max Wu <jackymaxj@gmail.com> Cheng-Han, Wu <jackymaxj@gmail.com>
+Max Wu <jackymaxj@gmail.com> jackycute <jackymaxj@gmail.com>
+Max Wu <jackymaxj@gmail.com> Wu, Cheng-Han <jackymaxj@gmail.com>
+Max Wu <jackymaxj@gmail.com> jackycute <jacky_cute0808@hotmail.com>
+
+Sheogorath <sheogorath@shivering-isles.com> Christoph (Sheogorath) Kern <sheogorath@shivering-isles.com>
+
+Raccoon <raccoon@hackmd.io> Raccoon Li <a60814billy@gmail.com>
+Raccoon <raccoon@hackmd.io> Raccoon <a60814billy@gmail.com>
+
+Peter Dave Hello <hsu@peterdavehello.org> Peter Dave Hello <PeterDaveHello@users.noreply.github.com>
+
+Claudius Coenen <github@amenthes.de> Claudius Coenen <opensource@amenthes.de>
diff --git a/README.md b/README.md
index 34d52b57..a9f0d4bd 100644
--- a/README.md
+++ b/README.md
@@ -170,7 +170,9 @@ There are some config settings you need to change in the files below.
| `DEBUG` | `true` or `false` | set debug mode; show more logs |
| `CMD_DOMAIN` | `codimd.org` | domain name |
| `CMD_URL_PATH` | `codimd` | sub URL path, like `www.example.com/<URL_PATH>` |
+| `CMD_HOST` | `localhost` | host to listen on |
| `CMD_PORT` | `80` | web app port |
+| `CMD_PATH` | `/var/run/codimd.sock` | path to UNIX domain socket to listen on (if specified, `CMD_HOST` and `CMD_PORT` are ignored) |
| `CMD_ALLOW_ORIGIN` | `localhost, codimd.org` | domain name whitelist (use comma to separate) |
| `CMD_PROTOCOL_USESSL` | `true` or `false` | set to use SSL protocol for resources path (only applied when domain is set) |
| `CMD_URL_ADDPORT` | `true` or `false` | set to add port on callback URL (ports `80` or `443` won't be applied) (only applied when domain is set) |
@@ -252,7 +254,9 @@ There are some config settings you need to change in the files below.
| `debug` | `true` or `false` | set debug mode, show more logs |
| `domain` | `localhost` | domain name |
| `urlPath` | `codimd` | sub URL path, like `www.example.com/<urlpath>` |
+| `host` | `localhost` | host to listen on |
| `port` | `80` | web app port |
+| `path` | `/var/run/codimd.sock` | path to UNIX domain socket to listen on (if specified, `host` and `port` are ignored) |
| `allowOrigin` | `['localhost']` | domain name whitelist |
| `useSSL` | `true` or `false` | set to use SSL server (if `true`, will auto turn on `protocolUseSSL`) |
| `hsts` | `{"enable": true, "maxAgeSeconds": 31536000, "includeSubdomains": true, "preload": true}` | [HSTS](https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security) options to use with HTTPS (default is the example value, max age is a year) |
diff --git a/app.js b/app.js
index e2479137..24f0516f 100644
--- a/app.js
+++ b/app.js
@@ -205,11 +205,21 @@ io.sockets.on('connection', realtime.connection)
// listen
function startListen () {
- server.listen(config.port, function () {
+ var address
+ var listenCallback = function () {
var schema = config.useSSL ? 'HTTPS' : 'HTTP'
- logger.info('%s Server listening at port %d', schema, config.port)
+ logger.info('%s Server listening at %s', schema, address)
realtime.maintenance = false
- })
+ }
+
+ // use unix domain socket if 'path' is specified
+ if (config.path) {
+ address = config.path
+ server.listen(config.path, listenCallback)
+ } else {
+ address = config.host + ':' + config.port
+ server.listen(config.port, config.host, listenCallback)
+ }
}
// sync db then start listen
diff --git a/lib/config/default.js b/lib/config/default.js
index 5c39a4da..6096bce4 100644
--- a/lib/config/default.js
+++ b/lib/config/default.js
@@ -3,6 +3,7 @@
module.exports = {
domain: '',
urlPath: '',
+ host: '0.0.0.0',
port: 3000,
urlAddPort: false,
allowOrigin: ['localhost'],
diff --git a/lib/config/environment.js b/lib/config/environment.js
index d850ac9d..6c4ce92f 100644
--- a/lib/config/environment.js
+++ b/lib/config/environment.js
@@ -5,7 +5,9 @@ const {toBooleanConfig, toArrayConfig, toIntegerConfig} = require('./utils')
module.exports = {
domain: process.env.CMD_DOMAIN,
urlPath: process.env.CMD_URL_PATH,
+ host: process.env.CMD_HOST,
port: toIntegerConfig(process.env.CMD_PORT),
+ path: process.env.CMD_PATH,
urlAddPort: toBooleanConfig(process.env.CMD_URL_ADDPORT),
useSSL: toBooleanConfig(process.env.CMD_USESSL),
hsts: {
diff --git a/lib/config/index.js b/lib/config/index.js
index 8705b10b..ac03fcd4 100644
--- a/lib/config/index.js
+++ b/lib/config/index.js
@@ -139,7 +139,7 @@ if (config.sessionSecret === 'secret') {
// Validate upload upload providers
if (['filesystem', 's3', 'minio', 'imgur', 'azure'].indexOf(config.imageUploadType) === -1) {
logger.error('"imageuploadtype" is not correctly set. Please use "filesystem", "s3", "minio", "azure" or "imgur". Defaulting to "imgur"')
- config.imageUploadType = 'imgur'
+ config.imageUploadType = 'filesystem'
}
// figure out mime types for image uploads
diff --git a/lib/history.js b/lib/history.js
index c7d2472c..9c389bfa 100644
--- a/lib/history.js
+++ b/lib/history.js
@@ -31,6 +31,15 @@ function getHistory (userid, callback) {
history = JSON.parse(user.history)
// migrate LZString encoded note id to base64url encoded note id
for (let i = 0, l = history.length; i < l; i++) {
+ // Calculate minimal string length for an UUID that is encoded
+ // base64 encoded and optimize comparsion by using -1
+ // this should make a lot of LZ-String parsing errors obsolete
+ // as we can assume that a nodeId that is 48 chars or longer is a
+ // noteID.
+ const base64UuidLength = ((4 * 36) / 3) - 1
+ if (!(history[i].id.length > base64UuidLength)) {
+ continue
+ }
try {
let id = LZString.decompressFromBase64(history[i].id)
if (id && models.Note.checkNoteIdValid(id)) {
@@ -38,7 +47,11 @@ function getHistory (userid, callback) {
}
} catch (err) {
// most error here comes from LZString, ignore
- logger.error(err)
+ if (err.message === 'Cannot read property \'charAt\' of undefined') {
+ logger.warning('Looks like we can not decode "' + history[i].id + '" with LZString. Can be ignored.')
+ } else {
+ logger.error(err)
+ }
}
}
history = parseHistoryToObject(history)
diff --git a/lib/models/note.js b/lib/models/note.js
index ec7e2b13..0e8dd4dd 100644
--- a/lib/models/note.js
+++ b/lib/models/note.js
@@ -227,7 +227,11 @@ module.exports = function (sequelize, DataTypes) {
var id = LZString.decompressFromBase64(noteId)
if (id && Note.checkNoteIdValid(id)) { return callback(null, id) } else { return _callback(null, null) }
} catch (err) {
- logger.error(err)
+ if (err.message === 'Cannot read property \'charAt\' of undefined') {
+ logger.warning('Looks like we can not decode "' + noteId + '" with LZString. Can be ignored.')
+ } else {
+ logger.error(err)
+ }
return _callback(null, null)
}
},
diff --git a/locales/ja.json b/locales/ja.json
index fb3de586..80623c8d 100644
--- a/locales/ja.json
+++ b/locales/ja.json
@@ -1,104 +1,115 @@
{
- "Collaborative markdown notes": "共同編集できるMarkdownノート",
- "Realtime collaborative markdown notes on all platforms.": "マルチプラットフォーム、リアルタイムで共同編集できるMarkdownノート",
- "Best way to write and share your knowledge in markdown.": "Markdownでナレッジを蓄積・共有できるベストツール",
- "Intro": "サービスの紹介",
- "History": "履歴",
- "New guest note": "新規ゲストノート",
- "Collaborate with URL": "URLで共同編集",
- "Support charts and MathJax": "グラフとMathJaxのサポート",
- "Support slide mode": "スライドモードのサポート",
- "Sign In": "サインイン",
- "Below is the history from browser": "ブラウザからの履歴",
- "Welcome!": "ようこそ!",
- "New note": "新規ノート",
- "or": "または",
- "Sign Out": "サインアウト",
- "Explore all features": "すべての機能をチェック",
- "Select tags...": "タグで検索",
- "Search keyword...": "キーワードで検索",
- "Sort by title": "タイトル順でソート",
- "Title": "タイトル",
- "Sort by time": "日時順でソート",
- "Time": "日時",
- "Export history": "履歴をエクスポート",
- "Import history": "履歴をインポート",
- "Clear history": "履歴をクリア",
- "Refresh history": "履歴を更新",
- "No history": "履歴はありません",
- "Import from browser": "ブラウザからインポート",
- "Releases": "リリース",
- "Are you sure?": "本当にいいですか?",
- "Cancel": "キャンセル",
- "Yes, do it!": "はい",
- "Choose method": "選択してください",
- "Sign in via %s": "%sでサインイン",
- "New": "新規作成",
- "Publish": "公開する",
- "Extra": "その他",
- "Revision": "編集履歴",
- "Slide Mode": "スライドモード",
- "Export": "エクスポート",
- "Import": "インポート",
- "Clipboard": "クリップボード",
- "Download": "ダウンロード",
- "Raw HTML": "HTMLパーツ",
- "Edit": "編集モード",
- "View": "表示モード",
- "Both": "分割モード",
- "Help": "ヘルプ",
- "Upload Image": "画像をアップロード",
- "Menu": "メニュー",
- "This page need refresh": "ページをリロードしてください",
- "You have an incompatible client version.": "クライアントのバージョンが一致しません",
- "Refresh to update.": "リロードして更新を反映させてください",
- "New version available!": "新しいバージョンが利用できます!",
- "See releases notes here": "リリースノートをごらんください",
- "Refresh to enjoy new features.": "リロードして新しい機能を試してみましょう",
- "Your user state has changed.": "ユーザー情報が変更されました",
- "Refresh to load new user state.": "リロードすると最新のユーザー情報が反映されます",
- "Refresh": "リロード",
- "Contacts": "コンタクト",
- "Report an issue": "問題を報告する",
- "Send us email": "メールを送る",
- "Documents": "ドキュメント",
- "Features": "機能",
- "YAML Metadata": "YAMLメタデータ",
- "Slide Example": "スライドサンプル",
- "Cheatsheet": "チートシート",
- "Example": "例",
- "Syntax": "構文",
- "Header": "見出し",
- "Unordered List": "番号なしリスト",
- "Ordered List": "番号付きリスト",
- "Todo List": "TODOリスト",
- "Blockquote": "引用文",
- "Bold font": "太字",
- "Italics font": "斜体",
- "Strikethrough": "打ち消し線",
- "Inserted text": "挿入文",
- "Marked text": "マーカー",
- "Link": "リンク",
- "Image": "画像",
- "Code": "コード",
- "Externals": "モジュール",
- "This is a alert area.": "これはアラートエリアです",
- "Revert": "戻す",
- "Import from clipboard": "クリップボードからインポート",
- "Paste your markdown or webpage here...": "Markdownまたはウェブページを貼り付けてください",
- "Clear": "クリア",
- "This note is locked": "このノートはロックされています",
- "Sorry, only owner can edit this note.": "このノートはオーナーのみが編集できます",
- "OK": "OK",
- "Reach the limit": "上限に達しました",
- "Sorry, you've reached the max length this note can be.": "ノートの文字数が上限に達しました。",
- "Please reduce the content or divide it to more notes, thank you!": "内容を減らすか、別のノートに分けてください",
- "Import from Gist": "gistからインポート",
- "Paste your gist url here...": "gistのURLを貼り付けてください",
- "Import from Snippet": "スニペットからインポート",
- "Select From Available Projects": "プロジェクトを一覧から選択してください",
- "Select From Available Snippets": "スニペットを一覧から選択してください",
- "OR": "または",
- "Export to Snippet": "スニペットにエクスポート",
- "Select Visibility Level": "公開範囲を選んでください"
-}
+ "Collaborative markdown notes": "共同編集できるMarkdownノート",
+ "Realtime collaborative markdown notes on all platforms.": "マルチプラットフォーム、リアルタイムで共同編集できるMarkdownノート",
+ "Best way to write and share your knowledge in markdown.": "Markdownでナレッジを蓄積・共有できるベストツール",
+ "Intro": "サービスの紹介",
+ "History": "履歴",
+ "New guest note": "新規ゲストノート",
+ "Collaborate with URL": "URLで共同編集",
+ "Support charts and MathJax": "グラフとMathJaxのサポート",
+ "Support slide mode": "スライドモードのサポート",
+ "Sign In": "サインイン",
+ "Below is the history from browser": "ブラウザからの履歴",
+ "Welcome!": "ようこそ!",
+ "New note": "新規ノート",
+ "or": "または",
+ "Sign Out": "サインアウト",
+ "Explore all features": "すべての機能をチェック",
+ "Select tags...": "タグで検索",
+ "Search keyword...": "キーワードで検索",
+ "Sort by title": "タイトル順でソート",
+ "Title": "タイトル",
+ "Sort by time": "日時順でソート",
+ "Time": "日時",
+ "Export history": "履歴をエクスポート",
+ "Import history": "履歴をインポート",
+ "Clear history": "履歴をクリア",
+ "Refresh history": "履歴を更新",
+ "No history": "履歴はありません",
+ "Import from browser": "ブラウザからインポート",
+ "Releases": "リリース",
+ "Are you sure?": "本当にいいですか?",
+ "Do you really want to delete this note?": "本当にこのノートを削除しますか?",
+ "All users will lose their connection.": "すべてのユーザーの接続が切断されます。",
+ "Cancel": "キャンセル",
+ "Yes, do it!": "はい",
+ "Choose method": "選択してください",
+ "Sign in via %s": "%sでサインイン",
+ "New": "新規作成",
+ "Publish": "公開する",
+ "Extra": "その他",
+ "Revision": "編集履歴",
+ "Slide Mode": "スライドモード",
+ "Export": "エクスポート",
+ "Import": "インポート",
+ "Clipboard": "クリップボード",
+ "Download": "ダウンロード",
+ "Raw HTML": "HTMLパーツ",
+ "Edit": "編集モード",
+ "View": "表示モード",
+ "Both": "分割モード",
+ "Help": "ヘルプ",
+ "Upload Image": "画像をアップロード",
+ "Menu": "メニュー",
+ "This page need refresh": "ページをリロードしてください",
+ "You have an incompatible client version.": "クライアントのバージョンが一致しません",
+ "Refresh to update.": "リロードして更新を反映させてください",
+ "New version available!": "新しいバージョンが利用できます!",
+ "See releases notes here": "リリースノートをごらんください",
+ "Refresh to enjoy new features.": "リロードして新しい機能を試してみましょう",
+ "Your user state has changed.": "ユーザー情報が変更されました",
+ "Refresh to load new user state.": "リロードすると最新のユーザー情報が反映されます",
+ "Refresh": "リロード",
+ "Contacts": "コンタクト",
+ "Report an issue": "問題を報告する",
+ "Meet us on %s": "%sでチャットする",
+ "Send us email": "メールを送る",
+ "Documents": "ドキュメント",
+ "Features": "機能",
+ "YAML Metadata": "YAMLメタデータ",
+ "Slide Example": "スライドサンプル",
+ "Cheatsheet": "チートシート",
+ "Example": "例",
+ "Syntax": "構文",
+ "Header": "見出し",
+ "Unordered List": "番号なしリスト",
+ "Ordered List": "番号付きリスト",
+ "Todo List": "TODOリスト",
+ "Blockquote": "引用文",
+ "Bold font": "太字",
+ "Italics font": "斜体",
+ "Strikethrough": "打ち消し線",
+ "Inserted text": "挿入文",
+ "Marked text": "マーカー",
+ "Link": "リンク",
+ "Image": "画像",
+ "Code": "コード",
+ "Externals": "モジュール",
+ "This is a alert area.": "これはアラートエリアです",
+ "Revert": "戻す",
+ "Import from clipboard": "クリップボードからインポート",
+ "Paste your markdown or webpage here...": "Markdownまたはウェブページを貼り付けてください",
+ "Clear": "クリア",
+ "This note is locked": "このノートはロックされています",
+ "Sorry, only owner can edit this note.": "このノートはオーナーのみが編集できます",
+ "OK": "OK",
+ "Reach the limit": "上限に達しました",
+ "Sorry, you've reached the max length this note can be.": "ノートの文字数が上限に達しました。",
+ "Please reduce the content or divide it to more notes, thank you!": "内容を減らすか、別のノートに分けてください",
+ "Import from Gist": "gistからインポート",
+ "Paste your gist url here...": "gistのURLを貼り付けてください",
+ "Import from Snippet": "スニペットからインポート",
+ "Select From Available Projects": "プロジェクトを一覧から選択してください",
+ "Select From Available Snippets": "スニペットを一覧から選択してください",
+ "OR": "または",
+ "Export to Snippet": "スニペットにエクスポート",
+ "Select Visibility Level": "公開範囲を選んでください",
+ "Night Theme": "ナイトテーマ",
+ "Follow us on %s and %s.": "%s と %s でフォローしてください。",
+ "Privacy": "プライバシー",
+ "Terms of Use": "利用条件",
+ "Do you really want to delete your user account?": "本当にアカウントを削除しますか?",
+ "This will delete your account, all notes that are owned by you and remove all references to your account from other notes.": "この操作はあなたのアカウントとあなたの所有するすべてのノートを削除し、さらに他の人のノートからあなたのアカウントへの参照を除去します。",
+ "Delete user": "ユーザーの削除",
+ "Export user data": "ユーザーデータをエクスポート"
+} \ No newline at end of file
diff --git a/package.json b/package.json
index 88bef3e0..1740500c 100644
--- a/package.json
+++ b/package.json
@@ -76,7 +76,7 @@
"markdown-it-regexp": "^0.4.0",
"markdown-it-sub": "^1.0.0",
"markdown-it-sup": "^1.0.0",
- "markdown-pdf": "^8.0.0",
+ "markdown-pdf": "^9.0.0",
"mathjax": "~2.7.0",
"mermaid": "~7.1.0",
"mattermost": "^3.4.0",
diff --git a/public/js/lib/editor/toolbar.html b/public/js/lib/editor/toolbar.html
index 2894eef9..a2ac476f 100644
--- a/public/js/lib/editor/toolbar.html
+++ b/public/js/lib/editor/toolbar.html
@@ -13,7 +13,7 @@
<a id="makeHeader" class="btn btn-sm btn-dark text-uppercase" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" title="Heading">
<i class="fa fa-h1 fa-fw">H</i>
</a>
- <a id="makeCode" class="btn btn-sm btn-dark text-uppercase" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" title="Quote">
+ <a id="makeCode" class="btn btn-sm btn-dark text-uppercase" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" title="Code">
<i class="fa fa-code fa-fw"></i>
</a>
<a id="makeQuote" class="btn btn-sm btn-dark text-uppercase" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" title="Quote">
@@ -40,7 +40,7 @@
<a id="makeLine" class="btn btn-sm btn-dark text-uppercase" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" title="Line">
<i class="fa fa-minus fa-fw"></i>
</a>
- <a id="makeComment" class="btn btn-sm btn-dark text-uppercase" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" title="Line">
+ <a id="makeComment" class="btn btn-sm btn-dark text-uppercase" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" title="Comment">
<i class="fa fa-comment fa-fw"></i>
</a>
</div>
diff --git a/yarn.lock b/yarn.lock
index 796c2bd3..f3d2eda6 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -4698,9 +4698,9 @@ markdown-it@^8.2.2:
mdurl "^1.0.1"
uc.micro "^1.0.3"
-markdown-pdf@^8.0.0:
- version "8.1.1"
- resolved "https://registry.yarnpkg.com/markdown-pdf/-/markdown-pdf-8.1.1.tgz#25c025d4f4f91869ac0f3f6fd7f7d32237669438"
+markdown-pdf@^9.0.0:
+ version "9.0.0"
+ resolved "https://registry.yarnpkg.com/markdown-pdf/-/markdown-pdf-9.0.0.tgz#d699f29c3b6c41da4b9a2ec7d09ea8895daef146"
dependencies:
commander "^2.2.0"
duplexer "^0.1.1"