Merge remote-tracking branch 'upstream/master' into DepauMD

This commit is contained in:
Davide Depau 2019-04-25 21:30:07 +02:00
commit 36749cc645
21 changed files with 267 additions and 237 deletions

View file

@ -4,7 +4,7 @@ cache: yarn
env: env:
global: global:
- CXX=g++-4.8 - CXX=g++-4.8
- YARN_VERSION=1.3.2 - YARN_VERSION=1.15.2
jobs: jobs:
include: include:

3
app.js
View file

@ -289,6 +289,9 @@ function handleTermSignals () {
socket.disconnect(true) socket.disconnect(true)
}, 0) }, 0)
}) })
if (config.path) {
fs.unlink(config.path)
}
var checkCleanTimer = setInterval(function () { var checkCleanTimer = setInterval(function () {
if (realtime.isReady()) { if (realtime.isReady()) {
models.Revision.checkAllNotesRevision(function (err, notes) { models.Revision.checkAllNotesRevision(function (err, notes) {

View file

@ -6,34 +6,35 @@ Manual Installation
- Node.js 6.x or up (test up to 7.5.0) and <10.x - Node.js 6.x or up (test up to 7.5.0) and <10.x
- Database (PostgreSQL, MySQL, MariaDB, SQLite, MSSQL) use charset `utf8` - Database (PostgreSQL, MySQL, MariaDB, SQLite, MSSQL) use charset `utf8`
- npm (and its dependencies, [node-gyp](https://github.com/nodejs/node-gyp#installation)) - npm (and its dependencies, [node-gyp](https://github.com/nodejs/node-gyp#installation))
- yarn
- `libssl-dev` for building scrypt (see [here](https://github.com/ml1nk/node-scrypt/blob/master/README.md#installation-instructions) for further information) - `libssl-dev` for building scrypt (see [here](https://github.com/ml1nk/node-scrypt/blob/master/README.md#installation-instructions) for further information)
- Bash (for the setup script)
- For **building** CodiMD we recommend to use a machine with at least **2GB** RAM - For **building** CodiMD we recommend to use a machine with at least **2GB** RAM
## Instructions ## Instructions
1. Download a release and unzip or clone into a directory 1. Check if you meet the [requirements at the top of this document](#requirements-on-your-server).
2. Enter the directory and type `bin/setup`, which will install npm dependencies and create configs. The setup script is written in Bash, you would need bash as a prerequisite. 2. Clone this repository (preferred) or download a release and unzip it.
3. Setup the configs, see more below 3. Enter the directory and type `bin/setup`, which will install npm dependencies and create configs.
4. Setup environment variables which will overwrite the configs 4. Setup the configs, see more below
5. Build front-end bundle by `npm run build` (use `npm run dev` if you are in development) 5. Setup environment variables which will overwrite the configs
6. Modify the file named `.sequelizerc`, change the value of the variable `url` with your db connection string 6. Build front-end bundle by `npm run build` (use `npm run dev` if you are in development)
7. Modify the file named `.sequelizerc`, change the value of the variable `url` with your db connection string
For example: `postgres://username:password@localhost:5432/codimd` For example: `postgres://username:password@localhost:5432/codimd`
7. Run `node_modules/.bin/sequelize db:migrate`, this step will migrate your db to the latest schema 8. It is recommended to start your server manually once: `npm start --production`, this way it's easier to see warnings or errors that might occur (leave out `--production` for development).
8. Run the server as you like (node, forever, pm2) 9. Run the server as you like (node, forever, pm2, SystemD, Init-Scripts)
## How to upgrade your installation ## How to upgrade your installation
:warning: When you are still running from the old repository, please run: `git remote set-url origin https://github.com/codimd/server.git` :warning:
If you are upgrading CodiMD from an older version, follow these steps: If you are upgrading CodiMD from an older version, follow these steps:
1. Fully stop your old server first (important) 1. Check if you meet the [requirements at the top of this document](#requirements-on-your-server).
2. `git pull` or do whatever that updates the files 2. Verify which version you were running before and take a look at [migrations and breaking changes](../guides/migrations-and-breaking-changes.md) to see if additional steps, or configuration changes are necessary!
3. `npm install` to update dependencies 3. Fully stop your old CodiMD server.
4. Build front-end bundle by `npm run build` (use `npm run dev` if you are in development) 4. `git pull` or unzip a new release in the directory.
5. Modify the file named `.sequelizerc`, change the value of the variable `url` with your db connection string 5. Run `bin/setup`. This will take care of installing dependencies. It is safe to run on an existing installation.
For example: `postgres://username:password@localhost:5432/codimd` 6. Build front-end bundle by `npm run build` (use `npm run dev` if you are in development).
6. Run `node_modules/.bin/sequelize db:migrate`, this step will migrate your db to the latest schema 7. It is recommended to start your server manually once: `npm start --production`, this way it's easier to see warnings or errors that might occur (leave out `--production` for development).
7. Start your whole new server! 8. You can now restart the CodiMD server!

View file

@ -113,5 +113,9 @@
"Delete user": "Benutzer löschen", "Delete user": "Benutzer löschen",
"Export user data": "Exportiere Nutzerdaten", "Export user data": "Exportiere Nutzerdaten",
"Help us translating on %s": "Hilf uns übersetzen auf %s", "Help us translating on %s": "Hilf uns übersetzen auf %s",
"Source Code": "Quelltext" "Source Code": "Quelltext",
"Register": "Registrieren",
"Powered by %s": "Ermöglicht durch %s",
"Help us translating": "Hilf uns übersetzen",
"Join the community": "Tritt der Community bei"
} }

View file

@ -112,8 +112,9 @@
"This will delete your account, all notes that are owned by you and remove all references to your account from other notes.": "This will delete your account, all notes that are owned by you and remove all references to your account from other notes.", "This will delete your account, all notes that are owned by you and remove all references to your account from other notes.": "This will delete your account, all notes that are owned by you and remove all references to your account from other notes.",
"Delete user": "Delete user", "Delete user": "Delete user",
"Export user data": "Export user data", "Export user data": "Export user data",
"Help us translating on %s": "Help us translating on %s",
"Source Code": "Source Code", "Source Code": "Source Code",
"Powered by %s": "Powered by %s", "Powered by %s": "Powered by %s",
"Register": "Register" "Register": "Register",
"Help us translating": "Help us translating",
"Join the community": "Join the community"
} }

View file

@ -115,5 +115,7 @@
"Help us translating on %s": "Aidez nous à traduire sur %s", "Help us translating on %s": "Aidez nous à traduire sur %s",
"Source Code": "Code source", "Source Code": "Code source",
"Register": "S'enregistrer", "Register": "S'enregistrer",
"Powered by %s": "Propulsé par %s" "Powered by %s": "Propulsé par %s",
"Help us translating": "Aidez nous à traduire",
"Join the community": "Rejoignez la communauté"
} }

View file

@ -115,5 +115,7 @@
"Help us translating on %s": "Aiutaci nella traduzione su %s", "Help us translating on %s": "Aiutaci nella traduzione su %s",
"Source Code": "Codice Sorgente", "Source Code": "Codice Sorgente",
"Register": "Registrati", "Register": "Registrati",
"Powered by %s": "Alimentato da %s" "Powered by %s": "Alimentato da %s",
"Help us translating": "Aiutaci nella traduzione",
"Join the community": "Unisciti alla comunità"
} }

View file

@ -115,5 +115,7 @@
"Help us translating on %s": "%s の翻訳にご協力ください", "Help us translating on %s": "%s の翻訳にご協力ください",
"Source Code": "ソースコード", "Source Code": "ソースコード",
"Register": "登録", "Register": "登録",
"Powered by %s": "Powered by %s" "Powered by %s": "Powered by %s",
"Help us translating": "翻訳のお手伝いをお願いします",
"Join the community": "コミュニティに参加しましょう"
} }

View file

@ -115,5 +115,7 @@
"Help us translating on %s": "Pomóż nam przetłumaczyć na język %s", "Help us translating on %s": "Pomóż nam przetłumaczyć na język %s",
"Source Code": "Kod źródłowy", "Source Code": "Kod źródłowy",
"Register": "Zarejestruj", "Register": "Zarejestruj",
"Powered by %s": "Wspierany przez %s" "Powered by %s": "Wspierany przez %s",
"Help us translating": "Pomóż nam w tłumaczeniu",
"Join the community": "Dołącz do społeczności"
} }

View file

@ -110,10 +110,12 @@
"Terms of Use": "Услови коришћења", "Terms of Use": "Услови коришћења",
"Do you really want to delete your user account?": "Да ли заиста желите да трајно обришете свој налог?", "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.": "Ова операција ће избрисати ваш налог, све ваше белешке, а уклониће и све везе ка вашем налогу из других белешки.", "This will delete your account, all notes that are owned by you and remove all references to your account from other notes.": "Ова операција ће избрисати ваш налог, све ваше белешке, а уклониће и све везе ка вашем налогу из других белешки.",
"Delete user": "Брисање корисника", "Delete user": "Обриши корисника",
"Export user data": "Извоз свих корисничких података", "Export user data": "Извоз свих корисничких података",
"Help us translating on %s": "Помозите нам да преведемо на %s", "Help us translating on %s": "Помозите око превода на %s",
"Source Code": "Изворни код", "Source Code": "Изворни код",
"Register": "Региструј се", "Register": "Региструј се",
"Powered by %s": "Покреће %s" "Powered by %s": "Покреће %s",
"Help us translating": "Помозите око превода",
"Join the community": "Приступите заједници"
} }

View file

@ -29,6 +29,8 @@
"Import from browser": "Importera från webbläsare", "Import from browser": "Importera från webbläsare",
"Releases": "Lanseringar", "Releases": "Lanseringar",
"Are you sure?": "Är du säker?", "Are you sure?": "Är du säker?",
"Do you really want to delete this note?": "Vill du verkligen radera denna anteckning?",
"All users will lose their connection.": "Alla användare kommer att förlora sin anslutning.",
"Cancel": "Avbryt", "Cancel": "Avbryt",
"Yes, do it!": "Ja, gör det!", "Yes, do it!": "Ja, gör det!",
"Choose method": "Välj metod", "Choose method": "Välj metod",
@ -60,6 +62,7 @@
"Refresh": "Ladda om", "Refresh": "Ladda om",
"Contacts": "Kontakter", "Contacts": "Kontakter",
"Report an issue": "Rapportera ett fel", "Report an issue": "Rapportera ett fel",
"Meet us on %s": "Träffa oss på% s",
"Send us email": "Skicka e-post till oss", "Send us email": "Skicka e-post till oss",
"Documents": "Dokument", "Documents": "Dokument",
"Features": "Funktioner", "Features": "Funktioner",
@ -100,5 +103,19 @@
"Select From Available Snippets": "Välj från tillgängliga Snippets", "Select From Available Snippets": "Välj från tillgängliga Snippets",
"OR": "ELLER", "OR": "ELLER",
"Export to Snippet": "Exportera till Snippet", "Export to Snippet": "Exportera till Snippet",
"Select Visibility Level": "Välj synlighetsnivå" "Select Visibility Level": "Välj synlighetsnivå",
"Night Theme": "Natttema",
"Follow us on %s and %s.": "Följ oss på %s och %s.",
"Privacy": "Integritet",
"Terms of Use": "Villkor",
"Do you really want to delete your user account?": "Vill du verkligen ta bort ditt användarkonto?",
"This will delete your account, all notes that are owned by you and remove all references to your account from other notes.": "Detta tar bort ditt konto, alla anteckningar som ägs av dig och tar bort alla referenser till ditt konto från andra anteckningar.",
"Delete user": "Ta bort användare",
"Export user data": "Exportera användardata",
"Help us translating on %s": "Hjälp oss att översätta på %s",
"Source Code": "Källkod",
"Register": "Registrera",
"Powered by %s": "Drivs av %s",
"Help us translating": "Hjälp oss att översätta",
"Join the community": "Gå med i samhället"
} }

View file

@ -1,117 +1,121 @@
{ {
"Collaborative markdown notes": "Markdown 协作笔记", "Collaborative markdown notes": "Markdown 协作笔记",
"Realtime collaborative markdown notes on all platforms.": "使用 Markdown 的跨平台即时协作笔记", "Realtime collaborative markdown notes on all platforms.": "使用 Markdown 的跨平台即时协作笔记",
"Best way to write and share your knowledge in markdown.": "您使用 Markdown 写作与分享知识的最佳方式", "Best way to write and share your knowledge in markdown.": "写作与分享 Markdown 的最佳平台。",
"Intro": "简介", "Intro": "简介",
"History": "历史", "History": "历史",
"New guest note": "访客笔记", "New guest note": "建访客笔记",
"Collaborate with URL": "使用网址协作", "Collaborate with URL": "实时协作",
"Support charts and MathJax": "支持图表与 MathJax", "Support charts and MathJax": "支持图表与 MathJax",
"Support slide mode": "支持简报模式", "Support slide mode": "支持幻灯模式",
"Sign In": "登录", "Sign In": "登录",
"Below is the history from browser": "以下为来自浏览器的历史", "Below is the history from browser": "以下为来自浏览器的历史",
"Welcome!": "欢迎!", "Welcome!": "欢迎!",
"New note": "笔记", "New note": "建笔记",
"or": "或", "or": "或",
"Sign Out": "登出", "Sign Out": "登出",
"Explore all features": "探索所有功能", "Explore all features": "探索所有功能",
"Select tags...": "选择标签...", "Select tags...": "选择标签...",
"Search keyword...": "搜索关键字...", "Search keyword...": "搜索关键字...",
"Sort by title": "标题排序", "Sort by title": "标题排序",
"Title": "标题", "Title": "标题",
"Sort by time": "时间排序", "Sort by time": "时间排序",
"Time": "时间", "Time": "时间",
"Export history": "导出历史", "Export history": "导出历史",
"Import history": "导入历史", "Import history": "导入历史",
"Clear history": "清空历史", "Clear history": "清空历史",
"Refresh history": "刷新历史", "Refresh history": "刷新历史",
"No history": "没有历史", "No history": "无历史记录",
"Import from browser": "从浏览器导入", "Import from browser": "从浏览器导入",
"Releases": "版本", "Releases": "版本",
"Are you sure?": "确定吗?", "Are you sure?": "确定吗?",
"Do you really want to delete this note?": "确定要删除这个文件吗?", "Do you really want to delete this note?": "您确定要删除这篇笔记吗?",
"All users will lose their connection.": "所有用户将失去连接", "All users will lose their connection.": "所有用户将失去连接",
"Cancel": "取消", "Cancel": "取消",
"Yes, do it!": "没错,就这样办", "Yes, do it!": "是的,就这样做",
"Choose method": "选择方式", "Choose method": "选择方式",
"Sign in via %s": "通过 %s 登录", "Sign in via %s": "通过 %s 登录",
"New": "新", "New": "新",
"Publish": "发表", "Publish": "发表",
"Extra": "增益", "Extra": "附加功能",
"Revision": "修订版本", "Revision": "修订版本",
"Slide Mode": "简报模式", "Slide Mode": "幻灯模式",
"Export": "导出", "Export": "导出",
"Import": "导入", "Import": "导入",
"Clipboard": "剪贴板", "Clipboard": "剪贴板",
"Download": "下载", "Download": "下载",
"Raw HTML": " HTML", "Raw HTML": "原始 HTML",
"Edit": "编辑", "Edit": "编辑",
"View": "检视", "View": "预览",
"Both": "双栏", "Both": "双栏",
"Help": "帮助", "Help": "帮助",
"Upload Image": "上传图片", "Upload Image": "上传图片",
"Menu": "菜单", "Menu": "菜单",
"This page need refresh": "此页面需要重新整理", "This page need refresh": "此页面需要刷新",
"You have an incompatible client version.": "您使用的是不相容的客户端", "You have an incompatible client version.": "您的客户端版本不兼容。",
"Refresh to update.": "请重新整理来更新", "Refresh to update.": "刷新页面以更新。",
"New version available!": "新版本来了", "New version available!": "新版本可用",
"See releases notes here": "请由此查阅更新纪录", "See releases notes here": "在此查看更新记录",
"Refresh to enjoy new features.": "请重新整理来享受最新功能", "Refresh to enjoy new features.": "刷新页面以体验新功能。",
"Your user state has changed.": "您的使用者状态已变更", "Your user state has changed.": "您的用户状态已变更。",
"Refresh to load new user state.": "请重新整理来载入新的使用者状态", "Refresh to load new user state.": "刷新页面以加载新的用户状态。",
"Refresh": "重新整理", "Refresh": "刷新",
"Contacts": "联络方式", "Contacts": "联系我们",
"Report an issue": "报告问题", "Report an issue": "报告问题",
"Meet us on %s": "在 %s 上联系我们", "Meet us on %s": "在 %s 上联系我们",
"Send us email": "寄信给我们", "Send us email": "给我们发送电子邮件",
"Documents": "文", "Documents": "文",
"Features": "功能简介", "Features": "功能",
"YAML Metadata": "YAML Metadata", "YAML Metadata": "YAML 元数据",
"Slide Example": "简报范例", "Slide Example": "幻灯范例",
"Cheatsheet": "快速简表", "Cheatsheet": "速查表",
"Example": "范例", "Example": "范例",
"Syntax": "语法", "Syntax": "语法",
"Header": "标题", "Header": "标题",
"Unordered List": "无序清单", "Unordered List": "无序列表",
"Ordered List": "有序清单", "Ordered List": "有序列表",
"Todo List": "待办事项", "Todo List": "清单",
"Blockquote": "引用", "Blockquote": "引用",
"Bold font": "粗体", "Bold font": "粗体",
"Italics font": "斜体", "Italics font": "斜体",
"Strikethrough": "删除线", "Strikethrough": "删除线",
"Inserted text": "插入文字", "Inserted text": "下划线文字",
"Marked text": "标记文字", "Marked text": "高亮文字",
"Link": "链接", "Link": "链接",
"Image": "图片", "Image": "图片",
"Code": "代码", "Code": "代码",
"Externals": "外部", "Externals": "外部扩展",
"This is a alert area.": "这是警告区块", "This is a alert area.": "这是一个警告区块",
"Revert": "还原", "Revert": "还原",
"Import from clipboard": "从剪贴板导入", "Import from clipboard": "从剪贴板导入",
"Paste your markdown or webpage here...": "在这里 Markdown 或网页内容...", "Paste your markdown or webpage here...": "在这里贴 Markdown 或网页内容...",
"Clear": "清除", "Clear": "清除",
"This note is locked": "此份笔记已被锁定", "This note is locked": "这篇笔记已被锁定",
"Sorry, only owner can edit this note.": "抱歉,只有拥有者可以编辑此笔记", "Sorry, only owner can edit this note.": "抱歉,只有所有者可以编辑这篇笔记。",
"OK": "好的", "OK": "好的",
"Reach the limit": "达上限", "Reach the limit": "上限",
"Sorry, you've reached the max length this note can be.": "抱歉,您已使用到此份笔记可用的最大长度", "Sorry, you've reached the max length this note can be.": "抱歉,您的这篇笔记已达到可用的最大长度。",
"Please reduce the content or divide it to more notes, thank you!": "请减少内容或是将内容切成更多笔记,谢谢!", "Please reduce the content or divide it to more notes, thank you!": "请减少笔记的内容。",
"Import from Gist": "从 Gist 导入", "Import from Gist": "从 Gist 导入",
"Paste your gist url here...": "在这里贴上 gist 网址...", "Paste your gist url here...": "在这里粘贴 Gist 网址...",
"Import from Snippet": "从 Snippet 导入", "Import from Snippet": "从 Snippet 导入",
"Select From Available Projects": "从可用的项目中选择", "Select From Available Projects": "从可用的项目中选择",
"Select From Available Snippets": "从可用的 Snippets 中选择", "Select From Available Snippets": "从可用的 Snippet 中选择",
"OR": "或", "OR": "或",
"Export to Snippet": "导出到 Snippet", "Export to Snippet": "导出到 Snippet",
"Select Visibility Level": "选择可见层级", "Select Visibility Level": "选择可见层级",
"Night Theme": "夜间主题", "Night Theme": "夜间主题",
"Follow us on %s and %s.": "在 %s 和 %s 上关注我们", "Follow us on %s and %s.": "在 %s 和 %s 上关注我们",
"Privacy": "隐私政策", "Privacy": "隐私",
"Terms of Use": "使用条款", "Terms of Use": "使用条款",
"Do you really want to delete your user account?": "你确定真的想要删除帐户", "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.": "我们将会删除你的帐户、你所拥有的笔记、以及你在别人笔记里的作者纪录。", "This will delete your account, all notes that are owned by you and remove all references to your account from other notes.": "您的帐户、您所拥有的笔记、他人笔记中对您帐户的引用都将被删除。",
"Delete user": "删除帐户", "Delete user": "删除帐户",
"Export user data": "汇出使用者资料", "Export user data": "导出用户数据",
"Help us translating on %s": "来 %s 帮我们翻译", "Help us translating on %s": "在 %s 上帮我们翻译",
"Source Code": "源码" "Source Code": "源代码",
"Register": "注册",
"Powered by %s": "由 %s 驱动",
"Help us translating": "帮助我们翻译",
"Join the community": "加入社区"
} }

View file

@ -114,6 +114,8 @@
"Export user data": "匯出使用者資料", "Export user data": "匯出使用者資料",
"Help us translating on %s": "來 %s 幫我們翻譯", "Help us translating on %s": "來 %s 幫我們翻譯",
"Source Code": "原始碼", "Source Code": "原始碼",
"Powered by %s": "Powered by %s", "Register": "註冊",
"Register": "註冊" "Powered by %s": "由 %s 強力驅動",
"Help us translating": "幫助我們改進翻譯",
"Join the community": "加入社群"
} }

View file

@ -38,6 +38,7 @@
"diff-match-patch": "git+https://github.com/hackmdio/diff-match-patch.git", "diff-match-patch": "git+https://github.com/hackmdio/diff-match-patch.git",
"ejs": "^2.5.5", "ejs": "^2.5.5",
"emojify.js": "~1.1.0", "emojify.js": "~1.1.0",
"escape-html": "^1.0.3",
"express": ">=4.14", "express": ">=4.14",
"express-session": "^1.14.2", "express-session": "^1.14.2",
"file-saver": "^1.3.3", "file-saver": "^1.3.3",
@ -46,7 +47,7 @@
"formidable": "^1.0.17", "formidable": "^1.0.17",
"gist-embed": "~2.6.0", "gist-embed": "~2.6.0",
"graceful-fs": "^4.1.11", "graceful-fs": "^4.1.11",
"handlebars": "^4.0.13", "handlebars": "^4.1.2",
"helmet": "^3.13.0", "helmet": "^3.13.0",
"highlight.js": "~9.12.0", "highlight.js": "~9.12.0",
"i18n": "^0.8.3", "i18n": "^0.8.3",
@ -57,7 +58,7 @@
"jquery-ui": "^1.12.1", "jquery-ui": "^1.12.1",
"js-cookie": "^2.1.3", "js-cookie": "^2.1.3",
"js-sequence-diagrams": "git+https://github.com/codimd/js-sequence-diagrams.git", "js-sequence-diagrams": "git+https://github.com/codimd/js-sequence-diagrams.git",
"js-url": "^2.3.0", "wurl": "^2.5.3",
"js-yaml": "^3.13.1", "js-yaml": "^3.13.1",
"jsdom-nogyp": "^0.8.3", "jsdom-nogyp": "^0.8.3",
"keymaster": "^1.6.2", "keymaster": "^1.6.2",
@ -82,7 +83,7 @@
"mathjax": "~2.7.0", "mathjax": "~2.7.0",
"mattermost": "^3.4.0", "mattermost": "^3.4.0",
"mermaid": "~7.1.0", "mermaid": "~7.1.0",
"meta-marked": "^0.4.2", "meta-marked": "git+https://github.com/codimd/meta-marked#semver:^0.4.2",
"method-override": "^2.3.7", "method-override": "^2.3.7",
"minimist": "^1.2.0", "minimist": "^1.2.0",
"minio": "^6.0.0", "minio": "^6.0.0",

View file

@ -15,6 +15,7 @@ import hljs from 'highlight.js'
import PDFObject from 'pdfobject' import PDFObject from 'pdfobject'
import S from 'string' import S from 'string'
import { saveAs } from 'file-saver' import { saveAs } from 'file-saver'
import escapeHTML from 'escape-html'
require('./lib/common/login') require('./lib/common/login')
require('../vendor/md-toc') require('../vendor/md-toc')
@ -323,7 +324,7 @@ export function finishView (view) {
svg[0].setAttribute('preserveAspectRatio', 'xMidYMid meet') svg[0].setAttribute('preserveAspectRatio', 'xMidYMid meet')
} catch (err) { } catch (err) {
$value.unwrap() $value.unwrap()
$value.parent().append('<div class="alert alert-warning">' + err + '</div>') $value.parent().append(`<div class="alert alert-warning">${escapeHTML(err)}</div>`)
console.warn(err) console.warn(err)
} }
}) })
@ -347,7 +348,7 @@ export function finishView (view) {
$value.children().unwrap().unwrap() $value.children().unwrap().unwrap()
} catch (err) { } catch (err) {
$value.unwrap() $value.unwrap()
$value.parent().append('<div class="alert alert-warning">' + err + '</div>') $value.parent().append(`<div class="alert alert-warning">${escapeHTML(err)}</div>`)
console.warn(err) console.warn(err)
} }
}) })
@ -366,7 +367,7 @@ export function finishView (view) {
$value.children().unwrap().unwrap() $value.children().unwrap().unwrap()
} catch (err) { } catch (err) {
$value.unwrap() $value.unwrap()
$value.parent().append('<div class="alert alert-warning">' + err + '</div>') $value.parent().append(`<div class="alert alert-warning">${escapeHTML(err)}</div>`)
console.warn(err) console.warn(err)
} }
}) })
@ -388,7 +389,7 @@ export function finishView (view) {
} }
$value.unwrap() $value.unwrap()
$value.parent().append('<div class="alert alert-warning">' + errormessage + '</div>') $value.parent().append(`<div class="alert alert-warning">${escapeHTML(errormessage)}</div>`)
console.warn(errormessage) console.warn(errormessage)
} }
}) })
@ -408,7 +409,7 @@ export function finishView (view) {
svg[0].setAttribute('preserveAspectRatio', 'xMidYMid meet') svg[0].setAttribute('preserveAspectRatio', 'xMidYMid meet')
} catch (err) { } catch (err) {
$value.unwrap() $value.unwrap()
$value.parent().append('<div class="alert alert-warning">' + err + '</div>') $value.parent().append(`<div class="alert alert-warning">${escapeHTML(err)}</div>`)
console.warn(err) console.warn(err)
} }
}) })
@ -568,7 +569,7 @@ export function postProcess (code) {
if (warning && warning.length > 0) { if (warning && warning.length > 0) {
warning.text(md.metaError) warning.text(md.metaError)
} else { } else {
warning = $('<div id="meta-error" class="alert alert-warning">' + md.metaError + '</div>') warning = $(`<div id="meta-error" class="alert alert-warning">${escapeHTML(md.metaError)}</div>`)
result.prepend(warning) result.prepend(warning)
} }
} }

View file

@ -4,6 +4,7 @@
import store from 'store' import store from 'store'
import S from 'string' import S from 'string'
import LZString from 'lz-string' import LZString from 'lz-string'
import url from 'wurl'
import { import {
checkNoteIdValid, checkNoteIdValid,
@ -23,9 +24,9 @@ window.migrateHistoryFromTempCallback = null
migrateHistoryFromTemp() migrateHistoryFromTemp()
function migrateHistoryFromTemp () { function migrateHistoryFromTemp () {
if (window.url('#tempid')) { if (url('#tempid')) {
$.get(`${serverurl}/temp`, { $.get(`${serverurl}/temp`, {
tempid: window.url('#tempid') tempid: url('#tempid')
}) })
.done(data => { .done(data => {
if (data && data.temp) { if (data && data.temp) {

View file

@ -17,6 +17,7 @@ import { saveAs } from 'file-saver'
import randomColor from 'randomcolor' import randomColor from 'randomcolor'
import store from 'store' import store from 'store'
import hljs from 'highlight.js' import hljs from 'highlight.js'
import url from 'wurl'
import _ from 'lodash' import _ from 'lodash'
@ -1373,12 +1374,12 @@ $('#gistImportModalConfirm').click(function () {
if (!isValidURL(gisturl)) { if (!isValidURL(gisturl)) {
showMessageModal('<i class="fa fa-github"></i> Import from Gist', 'Not a valid URL :(', '', '', false) showMessageModal('<i class="fa fa-github"></i> Import from Gist', 'Not a valid URL :(', '', '', false)
} else { } else {
var hostname = window.url('hostname', gisturl) var hostname = url('hostname', gisturl)
if (hostname !== 'gist.github.com') { if (hostname !== 'gist.github.com') {
showMessageModal('<i class="fa fa-github"></i> Import from Gist', 'Not a valid Gist URL :(', '', '', false) showMessageModal('<i class="fa fa-github"></i> Import from Gist', 'Not a valid Gist URL :(', '', '', false)
} else { } else {
ui.spinner.show() ui.spinner.show()
$.get('https://api.github.com/gists/' + window.url('-1', gisturl)) $.get('https://api.github.com/gists/' + url('-1', gisturl))
.done(function (data) { .done(function (data) {
if (data.files) { if (data.files) {
var contents = '' var contents = ''

View file

@ -5,7 +5,6 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/list.pagination.js/0.1.1/list.pagination.min.js" integrity="sha256-WwTza96H3BgcQTfEfxX7MFaFc/dZA0QrPRKDRLdFHJo=" crossorigin="anonymous" defer></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/list.pagination.js/0.1.1/list.pagination.min.js" integrity="sha256-WwTza96H3BgcQTfEfxX7MFaFc/dZA0QrPRKDRLdFHJo=" crossorigin="anonymous" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/3.5.2/select2.min.js" integrity="sha256-HzzZFiY4t0PIv02Tm8/R3CVvLpcjHhO1z/YAUCp4oQ4=" crossorigin="anonymous" defer></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/select2/3.5.2/select2.min.js" integrity="sha256-HzzZFiY4t0PIv02Tm8/R3CVvLpcjHhO1z/YAUCp4oQ4=" crossorigin="anonymous" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/moment-with-locales.min.js" integrity="sha256-vvT7Ok9u6GbfnBPXnbM6FVDEO8E1kTdgHOFZOAXrktA=" crossorigin="anonymous" defer></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/moment-with-locales.min.js" integrity="sha256-vvT7Ok9u6GbfnBPXnbM6FVDEO8E1kTdgHOFZOAXrktA=" crossorigin="anonymous" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-url/2.3.0/url.min.js" integrity="sha256-HOZJz4x+1mn1Si84WT5XKXPtOlTytmZLnMb6n1v4+5Q=" crossorigin="anonymous" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/1000hz-bootstrap-validator/0.11.8/validator.min.js" integrity="sha256-LHeY7YoYJ0SSXbCx7sR14Pqna+52moaH3bhv0Mjzd/M=" crossorigin="anonymous" defer></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/1000hz-bootstrap-validator/0.11.8/validator.min.js" integrity="sha256-LHeY7YoYJ0SSXbCx7sR14Pqna+52moaH3bhv0Mjzd/M=" crossorigin="anonymous" defer></script>
<%- include ../build/cover-scripts %> <%- include ../build/cover-scripts %>
<% } else { %> <% } else { %>

View file

@ -15,11 +15,13 @@
<h3 class="panel-title"><%= __('Contacts') %></h3> <h3 class="panel-title"><%= __('Contacts') %></h3>
</div> </div>
<div class="panel-body"> <div class="panel-body">
<a href="https://github.com/codimd/server/issues" target="_blank"><i class="fa fa-tag fa-fw"></i> <%= __('Report an issue') %></a> <a href="https://community.codimd.org" target="_blank"><i class="fa fa-users fa-fw"></i> <%= __('Join the community') %></a>
<br> <br>
<a href="https://riot.im/app/#/room/#codimd:matrix.org" target="_blank"><i class="fa fa-hashtag fa-fw"></i> <%= __('Meet us on %s', 'Matrix') %></a> <a href="https://riot.im/app/#/room/#codimd:matrix.org" target="_blank"><i class="fa fa-hashtag fa-fw"></i> <%= __('Meet us on %s', 'Matrix') %></a>
<br> <br>
<a href="https://translate.codimd.org" target="_blank"><i class="fa fa-language fa-fw"></i> <%= __('Help us translating on %s', 'POEditor') %></a> <a href="https://github.com/codimd/server/issues" target="_blank"><i class="fa fa-tag fa-fw"></i> <%= __('Report an issue') %></a>
<br>
<a href="https://translate.codimd.org" target="_blank"><i class="fa fa-language fa-fw"></i> <%= __('Help us translating') %></a>
</div> </div>
</div> </div>
<div class="panel panel-default"> <div class="panel panel-default">

View file

@ -195,13 +195,11 @@ module.exports = {
'bootstrap-validator', 'bootstrap-validator',
'expose-loader?select2!select2', 'expose-loader?select2!select2',
'expose-loader?moment!moment', 'expose-loader?moment!moment',
'script-loader!js-url',
path.join(__dirname, 'public/js/cover.js') path.join(__dirname, 'public/js/cover.js')
], ],
index: [ index: [
'babel-polyfill', 'babel-polyfill',
'script-loader!jquery-ui-resizable', 'script-loader!jquery-ui-resizable',
'script-loader!js-url',
'script-loader!Idle.Js', 'script-loader!Idle.Js',
'expose-loader?LZString!lz-string', 'expose-loader?LZString!lz-string',
'script-loader!codemirror', 'script-loader!codemirror',
@ -248,7 +246,6 @@ module.exports = {
'expose-loader?jsyaml!js-yaml', 'expose-loader?jsyaml!js-yaml',
'script-loader!mermaid', 'script-loader!mermaid',
'expose-loader?moment!moment', 'expose-loader?moment!moment',
'script-loader!js-url',
'script-loader!handlebars', 'script-loader!handlebars',
'expose-loader?hljs!highlight.js', 'expose-loader?hljs!highlight.js',
'expose-loader?emojify!emojify.js', 'expose-loader?emojify!emojify.js',

View file

@ -510,7 +510,7 @@ are-we-there-yet@~1.1.2:
delegates "^1.0.0" delegates "^1.0.0"
readable-stream "^2.0.6" readable-stream "^2.0.6"
argparse@^1.0.2, argparse@^1.0.7: argparse@^1.0.7:
version "1.0.10" version "1.0.10"
resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911"
integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==
@ -3363,7 +3363,7 @@ es6-weak-map@^2.0.2:
es6-iterator "^2.0.1" es6-iterator "^2.0.1"
es6-symbol "^3.1.1" es6-symbol "^3.1.1"
escape-html@~1.0.3: escape-html@^1.0.3, escape-html@~1.0.3:
version "1.0.3" version "1.0.3"
resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988"
integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg= integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=
@ -3521,11 +3521,6 @@ espree@^5.0.1:
acorn-jsx "^5.0.0" acorn-jsx "^5.0.0"
eslint-visitor-keys "^1.0.0" eslint-visitor-keys "^1.0.0"
esprima@^2.6.0:
version "2.7.3"
resolved "https://registry.yarnpkg.com/esprima/-/esprima-2.7.3.tgz#96e3b70d5779f6ad49cd032673d1c312767ba581"
integrity sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=
esprima@^3.1.3: esprima@^3.1.3:
version "3.1.3" version "3.1.3"
resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633" resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633"
@ -5608,7 +5603,7 @@ js-url@^2.3.0:
grunt-contrib-qunit "" grunt-contrib-qunit ""
grunt-contrib-uglify "" grunt-contrib-uglify ""
js-yaml@^3.13.0, js-yaml@^3.13.1: js-yaml@^3.13.0, js-yaml@^3.13.1, js-yaml@~3.13.1:
version "3.13.1" version "3.13.1"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847"
integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==
@ -5616,14 +5611,6 @@ js-yaml@^3.13.0, js-yaml@^3.13.1:
argparse "^1.0.7" argparse "^1.0.7"
esprima "^4.0.0" esprima "^4.0.0"
js-yaml@~3.5.5:
version "3.5.5"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.5.5.tgz#0377c38017cabc7322b0d1fbcd25a491641f2fbe"
integrity sha1-A3fDgBfKvHMisNH7zSWkkWQfL74=
dependencies:
argparse "^1.0.2"
esprima "^2.6.0"
jsbn@~0.1.0: jsbn@~0.1.0:
version "0.1.1" version "0.1.1"
resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513"
@ -6406,10 +6393,10 @@ markdown-pdf@^9.0.0:
through2 "^2.0.0" through2 "^2.0.0"
tmp "0.0.33" tmp "0.0.33"
marked@~0.3.6: marked@~0.6.2:
version "0.3.19" version "0.6.2"
resolved "https://registry.yarnpkg.com/marked/-/marked-0.3.19.tgz#5d47f709c4c9fc3c216b6d46127280f40b39d790" resolved "https://registry.yarnpkg.com/marked/-/marked-0.6.2.tgz#c574be8b545a8b48641456ca1dbe0e37b6dccc1a"
integrity sha512-ea2eGWOqNxPcXv8dyERdSr/6FmzvWwzjMxpfGB/sbMccXoct+xY+YukPD+QTUZwyvK7BZwcr4m21WBOW41pAkg== integrity sha512-LqxwVH3P/rqKX4EKGz7+c2G9r98WeM/SW34ybhgNGhUQNKtf1GmmSkJ6cDGJ/t6tiyae49qRkpyTw2B9HOrgUA==
math-interval-parser@^1.1.0: math-interval-parser@^1.1.0:
version "1.1.0" version "1.1.0"
@ -6543,13 +6530,12 @@ messageformat@^0.3.1:
nopt "~3.0.6" nopt "~3.0.6"
watchr "~2.4.13" watchr "~2.4.13"
meta-marked@^0.4.2: "meta-marked@git+https://github.com/codimd/meta-marked#semver:^0.4.2":
version "0.4.2" version "0.4.4"
resolved "https://registry.yarnpkg.com/meta-marked/-/meta-marked-0.4.2.tgz#4a1fae344f53d7040aacabb723e2f432a37455f8" resolved "git+https://github.com/codimd/meta-marked#04fd9775b38566e41b71e3e63bd78717d3eb4445"
integrity sha1-Sh+uNE9T1wQKrKu3I+L0MqN0Vfg=
dependencies: dependencies:
js-yaml "~3.5.5" js-yaml "~3.13.1"
marked "~0.3.6" marked "~0.6.2"
method-override@^2.3.7: method-override@^2.3.7:
version "2.3.10" version "2.3.10"