diff --git a/.travis.yml b/.travis.yml index 37e3352..a2fce83 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ cache: yarn env: global: - CXX=g++-4.8 - - YARN_VERSION=1.3.2 + - YARN_VERSION=1.15.2 jobs: include: diff --git a/app.js b/app.js index 3de99e6..ceb2259 100644 --- a/app.js +++ b/app.js @@ -289,6 +289,9 @@ function handleTermSignals () { socket.disconnect(true) }, 0) }) + if (config.path) { + fs.unlink(config.path) + } var checkCleanTimer = setInterval(function () { if (realtime.isReady()) { models.Revision.checkAllNotesRevision(function (err, notes) { diff --git a/docs/setup/manual-setup.md b/docs/setup/manual-setup.md index 721d5bf..82ed085 100644 --- a/docs/setup/manual-setup.md +++ b/docs/setup/manual-setup.md @@ -6,34 +6,35 @@ Manual Installation - Node.js 6.x or up (test up to 7.5.0) and <10.x - Database (PostgreSQL, MySQL, MariaDB, SQLite, MSSQL) use charset `utf8` - 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) +- Bash (for the setup script) - For **building** CodiMD we recommend to use a machine with at least **2GB** RAM ## Instructions -1. Download a release and unzip or clone into a directory -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. -3. Setup the configs, see more below -4. Setup environment variables which will overwrite the configs -5. Build front-end bundle by `npm run build` (use `npm run dev` if you are in development) -6. Modify the file named `.sequelizerc`, change the value of the variable `url` with your db connection string +1. Check if you meet the [requirements at the top of this document](#requirements-on-your-server). +2. Clone this repository (preferred) or download a release and unzip it. +3. Enter the directory and type `bin/setup`, which will install npm dependencies and create configs. +4. Setup the configs, see more below +5. Setup environment variables which will overwrite the configs +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` -7. Run `node_modules/.bin/sequelize db:migrate`, this step will migrate your db to the latest schema -8. Run the server as you like (node, forever, pm2) +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). +9. Run the server as you like (node, forever, pm2, SystemD, Init-Scripts) ## 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: -1. Fully stop your old server first (important) -2. `git pull` or do whatever that updates the files -3. `npm install` to update dependencies -4. Build front-end bundle by `npm run build` (use `npm run dev` if you are in development) -5. 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` -6. Run `node_modules/.bin/sequelize db:migrate`, this step will migrate your db to the latest schema -7. Start your whole new server! +1. Check if you meet the [requirements at the top of this document](#requirements-on-your-server). +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. Fully stop your old CodiMD server. +4. `git pull` or unzip a new release in the directory. +5. Run `bin/setup`. This will take care of installing dependencies. It is safe to run on an existing installation. +6. Build front-end bundle by `npm run build` (use `npm run dev` if you are in development). +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). +8. You can now restart the CodiMD server! diff --git a/locales/de.json b/locales/de.json index 57a5e64..a4758db 100644 --- a/locales/de.json +++ b/locales/de.json @@ -113,5 +113,9 @@ "Delete user": "Benutzer löschen", "Export user data": "Exportiere Nutzerdaten", "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" } \ No newline at end of file diff --git a/locales/en.json b/locales/en.json index 15ed6e4..9a601c0 100644 --- a/locales/en.json +++ b/locales/en.json @@ -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.", "Delete user": "Delete user", "Export user data": "Export user data", - "Help us translating on %s": "Help us translating on %s", "Source Code": "Source Code", "Powered by %s": "Powered by %s", - "Register": "Register" + "Register": "Register", + "Help us translating": "Help us translating", + "Join the community": "Join the community" } diff --git a/locales/fr.json b/locales/fr.json index d67dfea..2a47672 100644 --- a/locales/fr.json +++ b/locales/fr.json @@ -115,5 +115,7 @@ "Help us translating on %s": "Aidez nous à traduire sur %s", "Source Code": "Code source", "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é" } \ No newline at end of file diff --git a/locales/it.json b/locales/it.json index 24ee331..b0a6f6a 100644 --- a/locales/it.json +++ b/locales/it.json @@ -115,5 +115,7 @@ "Help us translating on %s": "Aiutaci nella traduzione su %s", "Source Code": "Codice Sorgente", "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à" } \ No newline at end of file diff --git a/locales/ja.json b/locales/ja.json index 1ff726f..32f97d2 100644 --- a/locales/ja.json +++ b/locales/ja.json @@ -115,5 +115,7 @@ "Help us translating on %s": "%s の翻訳にご協力ください", "Source Code": "ソースコード", "Register": "登録", - "Powered by %s": "Powered by %s" + "Powered by %s": "Powered by %s", + "Help us translating": "翻訳のお手伝いをお願いします", + "Join the community": "コミュニティに参加しましょう" } \ No newline at end of file diff --git a/locales/pl.json b/locales/pl.json index 7d22316..8ee04f8 100644 --- a/locales/pl.json +++ b/locales/pl.json @@ -115,5 +115,7 @@ "Help us translating on %s": "Pomóż nam przetłumaczyć na język %s", "Source Code": "Kod źródłowy", "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" } \ No newline at end of file diff --git a/locales/sr.json b/locales/sr.json index 15cb949..ef81fef 100644 --- a/locales/sr.json +++ b/locales/sr.json @@ -110,10 +110,12 @@ "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": "Брисање корисника", + "Delete user": "Обриши корисника", "Export user data": "Извоз свих корисничких података", - "Help us translating on %s": "Помозите нам да преведемо на %s", + "Help us translating on %s": "Помозите око превода на %s", "Source Code": "Изворни код", "Register": "Региструј се", - "Powered by %s": "Покреће %s" + "Powered by %s": "Покреће %s", + "Help us translating": "Помозите око превода", + "Join the community": "Приступите заједници" } \ No newline at end of file diff --git a/locales/sv.json b/locales/sv.json index 8d537a5..93eeb89 100644 --- a/locales/sv.json +++ b/locales/sv.json @@ -1,104 +1,121 @@ { - "Collaborative markdown notes": "Kollaborativa markdownanteckningar", - "Realtime collaborative markdown notes on all platforms.": "Kollaborativa markdownantackningar på alla plattformar.", - "Best way to write and share your knowledge in markdown.": "Bästa sättet att skriva och dela din kunskap i markdown.", - "Intro": "Intro", - "History": "Historia", - "New guest note": "Ny gästanteckning", - "Collaborate with URL": "Samarbeta med URL", - "Support charts and MathJax": "Stöd för diagram och MathJax", - "Support slide mode": "Stöd för slide mode", - "Sign In": "Logga in", - "Below is the history from browser": "Nedanför finns historia från webbläsaren", - "Welcome!": "Välkommen!", - "New note": "Ny anteckning", - "or": "eller", - "Sign Out": "Logga ut", - "Explore all features": "Upptäck alla funktioner", - "Select tags...": "Välj taggar...", - "Search keyword...": "Sök nyckelord...", - "Sort by title": "Sortera titlar", - "Title": "Titel", - "Sort by time": "Sortera kronologiskt", - "Time": "Tid", - "Export history": "Exporthistorik", - "Import history": "Importhistorik", - "Clear history": "Rensa historik", - "Refresh history": "Uppdatera historik", - "No history": "Ingen historik", - "Import from browser": "Importera från webbläsare", - "Releases": "Lanseringar", - "Are you sure?": "Är du säker?", - "Cancel": "Avbryt", - "Yes, do it!": "Ja, gör det!", - "Choose method": "Välj metod", - "Sign in via %s": "Logga in via %s", - "New": "Ny", - "Publish": "Publicera", - "Extra": "Extra", - "Revision": "Revision", - "Slide Mode": "Slide Mode", - "Export": "Exportera", - "Import": "Importera", - "Clipboard": "Urklipp", - "Download": "Ladda ner", - "Raw HTML": "Rå HTML", - "Edit": "Redigera", - "View": "Visa", - "Both": "Båda", - "Help": "Hjälp", - "Upload Image": "Ladda upp bilder", - "Menu": "Meny", - "This page need refresh": "Den här sidan behöver laddas om", - "You have an incompatible client version.": "Du har en inkompatibel klientversion.", - "Refresh to update.": "Ladda om för att uppdatera.", - "New version available!": "Ny version tillgänglig!", - "See releases notes here": "Se releaseanteckningar här", - "Refresh to enjoy new features.": "Ladda om för att använda de nya funktionerna.", - "Your user state has changed.": "Din användarstatus har förändrats.", - "Refresh to load new user state.": "Ladda om för att ladda ny användarstatus.", - "Refresh": "Ladda om", - "Contacts": "Kontakter", - "Report an issue": "Rapportera ett fel", - "Send us email": "Skicka e-post till oss", - "Documents": "Dokument", - "Features": "Funktioner", - "YAML Metadata": "YAML Metadata", - "Slide Example": "Slideexempel", - "Cheatsheet": "Cheatsheet", - "Example": "Exempel", - "Syntax": "Syntax", - "Header": "Huvud", - "Unordered List": "Oordnad lists", - "Ordered List": "Ordnad lista", - "Todo List": "Todo-lista", - "Blockquote": "Blockcitat", - "Bold font": "Fet stil", - "Italics font": "Kursiv stil", - "Strikethrough": "Genomstrykning", - "Inserted text": "Insatt text", - "Marked text": "Markerad text", - "Link": "Länk", - "Image": "Bild", - "Code": "Kod", - "Externals": "Externa", - "This is a alert area.": "Det här är ett varnande område.", - "Revert": "Återgå", - "Import from clipboard": "Importera från urklipp", - "Paste your markdown or webpage here...": "Klipp in din markdown eller hemsida här...", - "Clear": "Rensa", - "This note is locked": "Anteckningen är låst", - "Sorry, only owner can edit this note.": "Ursäkta, men endast ägaren kan redigera den här anteckningen.", - "OK": "Okej", - "Reach the limit": "Nå gränsen", - "Sorry, you've reached the max length this note can be.": "Usräkta, men duhar nått maxlängden för vad en anteckning får vara.", - "Please reduce the content or divide it to more notes, thank you!": "Var vänlig förkorta innehållet eller dela upp det i flera anteckningar, tack!", - "Import from Gist": "Importera från Gist", - "Paste your gist url here...": "Klipp in din gist-url här...", - "Import from Snippet": "Importera från Snippet", - "Select From Available Projects": "Välj från tillgängliga projekt", - "Select From Available Snippets": "Välj från tillgängliga Snippets", - "OR": "ELLER", - "Export to Snippet": "Exportera till Snippet", - "Select Visibility Level": "Välj synlighetsnivå" -} + "Collaborative markdown notes": "Kollaborativa markdownanteckningar", + "Realtime collaborative markdown notes on all platforms.": "Kollaborativa markdownantackningar på alla plattformar.", + "Best way to write and share your knowledge in markdown.": "Bästa sättet att skriva och dela din kunskap i markdown.", + "Intro": "Intro", + "History": "Historia", + "New guest note": "Ny gästanteckning", + "Collaborate with URL": "Samarbeta med URL", + "Support charts and MathJax": "Stöd för diagram och MathJax", + "Support slide mode": "Stöd för slide mode", + "Sign In": "Logga in", + "Below is the history from browser": "Nedanför finns historia från webbläsaren", + "Welcome!": "Välkommen!", + "New note": "Ny anteckning", + "or": "eller", + "Sign Out": "Logga ut", + "Explore all features": "Upptäck alla funktioner", + "Select tags...": "Välj taggar...", + "Search keyword...": "Sök nyckelord...", + "Sort by title": "Sortera titlar", + "Title": "Titel", + "Sort by time": "Sortera kronologiskt", + "Time": "Tid", + "Export history": "Exporthistorik", + "Import history": "Importhistorik", + "Clear history": "Rensa historik", + "Refresh history": "Uppdatera historik", + "No history": "Ingen historik", + "Import from browser": "Importera från webbläsare", + "Releases": "Lanseringar", + "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", + "Yes, do it!": "Ja, gör det!", + "Choose method": "Välj metod", + "Sign in via %s": "Logga in via %s", + "New": "Ny", + "Publish": "Publicera", + "Extra": "Extra", + "Revision": "Revision", + "Slide Mode": "Slide Mode", + "Export": "Exportera", + "Import": "Importera", + "Clipboard": "Urklipp", + "Download": "Ladda ner", + "Raw HTML": "Rå HTML", + "Edit": "Redigera", + "View": "Visa", + "Both": "Båda", + "Help": "Hjälp", + "Upload Image": "Ladda upp bilder", + "Menu": "Meny", + "This page need refresh": "Den här sidan behöver laddas om", + "You have an incompatible client version.": "Du har en inkompatibel klientversion.", + "Refresh to update.": "Ladda om för att uppdatera.", + "New version available!": "Ny version tillgänglig!", + "See releases notes here": "Se releaseanteckningar här", + "Refresh to enjoy new features.": "Ladda om för att använda de nya funktionerna.", + "Your user state has changed.": "Din användarstatus har förändrats.", + "Refresh to load new user state.": "Ladda om för att ladda ny användarstatus.", + "Refresh": "Ladda om", + "Contacts": "Kontakter", + "Report an issue": "Rapportera ett fel", + "Meet us on %s": "Träffa oss på% s", + "Send us email": "Skicka e-post till oss", + "Documents": "Dokument", + "Features": "Funktioner", + "YAML Metadata": "YAML Metadata", + "Slide Example": "Slideexempel", + "Cheatsheet": "Cheatsheet", + "Example": "Exempel", + "Syntax": "Syntax", + "Header": "Huvud", + "Unordered List": "Oordnad lists", + "Ordered List": "Ordnad lista", + "Todo List": "Todo-lista", + "Blockquote": "Blockcitat", + "Bold font": "Fet stil", + "Italics font": "Kursiv stil", + "Strikethrough": "Genomstrykning", + "Inserted text": "Insatt text", + "Marked text": "Markerad text", + "Link": "Länk", + "Image": "Bild", + "Code": "Kod", + "Externals": "Externa", + "This is a alert area.": "Det här är ett varnande område.", + "Revert": "Återgå", + "Import from clipboard": "Importera från urklipp", + "Paste your markdown or webpage here...": "Klipp in din markdown eller hemsida här...", + "Clear": "Rensa", + "This note is locked": "Anteckningen är låst", + "Sorry, only owner can edit this note.": "Ursäkta, men endast ägaren kan redigera den här anteckningen.", + "OK": "Okej", + "Reach the limit": "Nå gränsen", + "Sorry, you've reached the max length this note can be.": "Usräkta, men duhar nått maxlängden för vad en anteckning får vara.", + "Please reduce the content or divide it to more notes, thank you!": "Var vänlig förkorta innehållet eller dela upp det i flera anteckningar, tack!", + "Import from Gist": "Importera från Gist", + "Paste your gist url here...": "Klipp in din gist-url här...", + "Import from Snippet": "Importera från Snippet", + "Select From Available Projects": "Välj från tillgängliga projekt", + "Select From Available Snippets": "Välj från tillgängliga Snippets", + "OR": "ELLER", + "Export to Snippet": "Exportera till Snippet", + "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" +} \ No newline at end of file diff --git a/locales/zh-CN.json b/locales/zh-CN.json index 93e1c86..0303b83 100644 --- a/locales/zh-CN.json +++ b/locales/zh-CN.json @@ -1,117 +1,121 @@ { "Collaborative markdown notes": "Markdown 协作笔记", - "Realtime collaborative markdown notes on all platforms.": "使用 Markdown 的跨平台即时协作笔记", - "Best way to write and share your knowledge in markdown.": "您使用 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": "使用网址协作", + "New guest note": "新建访客笔记", + "Collaborate with URL": "实时协作", "Support charts and MathJax": "支持图表与 MathJax", - "Support slide mode": "支持简报模式", + "Support slide mode": "支持幻灯模式", "Sign In": "登录", "Below is the history from browser": "以下为来自浏览器的历史", "Welcome!": "欢迎!", - "New note": "建立笔记", + "New note": "新建笔记", "or": "或", "Sign Out": "登出", "Explore all features": "探索所有功能", "Select tags...": "选择标签...", "Search keyword...": "搜索关键字...", - "Sort by title": "用标题排序", + "Sort by title": "按标题排序", "Title": "标题", - "Sort by time": "用时间排序", + "Sort by time": "按时间排序", "Time": "时间", "Export history": "导出历史", "Import history": "导入历史", "Clear history": "清空历史", "Refresh history": "刷新历史", - "No history": "没有历史", + "No history": "无历史记录", "Import from browser": "从浏览器导入", "Releases": "版本", - "Are you sure?": "你确定吗?", - "Do you really want to delete this note?": "确定要删除这个文件吗?", - "All users will lose their connection.": "所有用户将失去连接", + "Are you sure?": "您确定吗?", + "Do you really want to delete this note?": "您确定要删除这篇笔记吗?", + "All users will lose their connection.": "所有用户将失去连接。", "Cancel": "取消", - "Yes, do it!": "没错,就这样办!", + "Yes, do it!": "是的,就这样做!", "Choose method": "选择方式", "Sign in via %s": "通过 %s 登录", - "New": "新增", + "New": "新建", "Publish": "发表", - "Extra": "增益", + "Extra": "附加功能", "Revision": "修订版本", - "Slide Mode": "简报模式", + "Slide Mode": "幻灯模式", "Export": "导出", "Import": "导入", "Clipboard": "剪贴板", "Download": "下载", - "Raw HTML": "纯 HTML", + "Raw HTML": "原始 HTML", "Edit": "编辑", - "View": "检视", + "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": "联络方式", + "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 Metadata", - "Slide Example": "简报范例", - "Cheatsheet": "快速简表", + "Send us email": "给我们发送电子邮件", + "Documents": "文档", + "Features": "功能", + "YAML Metadata": "YAML 元数据", + "Slide Example": "幻灯范例", + "Cheatsheet": "速查表", "Example": "范例", "Syntax": "语法", "Header": "标题", - "Unordered List": "无序清单", - "Ordered List": "有序清单", - "Todo List": "待办事项", + "Unordered List": "无序列表", + "Ordered List": "有序列表", + "Todo List": "清单", "Blockquote": "引用", "Bold font": "粗体", "Italics font": "斜体", "Strikethrough": "删除线", - "Inserted text": "插入文字", - "Marked text": "标记文字", + "Inserted text": "下划线文字", + "Marked text": "高亮文字", "Link": "链接", "Image": "图片", "Code": "代码", - "Externals": "外部", - "This is a alert area.": "这是警告区块", + "Externals": "外部扩展", + "This is a alert area.": "这是一个警告区块。", "Revert": "还原", "Import from clipboard": "从剪贴板导入", - "Paste your markdown or webpage here...": "在这里贴上 Markdown 或是网页内容...", + "Paste your markdown or webpage here...": "在这里粘贴 Markdown 或网页内容...", "Clear": "清除", - "This note is locked": "此份笔记已被锁定", - "Sorry, only owner can edit this note.": "抱歉,只有拥有者可以编辑此笔记", + "This note is locked": "这篇笔记已被锁定", + "Sorry, only owner can edit this note.": "抱歉,只有所有者可以编辑这篇笔记。", "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!": "请减少内容或是将内容切成更多笔记,谢谢!", + "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 网址...", + "Paste your gist url here...": "在这里粘贴 Gist 网址...", "Import from Snippet": "从 Snippet 导入", "Select From Available Projects": "从可用的项目中选择", - "Select From Available Snippets": "从可用的 Snippets 中选择", - "OR": "或是", + "Select From Available Snippets": "从可用的 Snippet 中选择", + "OR": "或", "Export to Snippet": "导出到 Snippet", "Select Visibility Level": "选择可见层级", "Night Theme": "夜间主题", - "Follow us on %s and %s.": "在%s和%s上关注我们", - "Privacy": "隐私政策", + "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.": "我们将会删除你的帐户、你所拥有的笔记、以及你在别人笔记里的作者纪录。", + "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": "汇出使用者资料", - "Help us translating on %s": "来 %s 帮我们翻译", - "Source Code": "源码" + "Export user data": "导出用户数据", + "Help us translating on %s": "在 %s 上帮我们翻译", + "Source Code": "源代码", + "Register": "注册", + "Powered by %s": "由 %s 驱动", + "Help us translating": "帮助我们翻译", + "Join the community": "加入社区" } \ No newline at end of file diff --git a/locales/zh-TW.json b/locales/zh-TW.json index 40fd4ac..bbc83cf 100644 --- a/locales/zh-TW.json +++ b/locales/zh-TW.json @@ -114,6 +114,8 @@ "Export user data": "匯出使用者資料", "Help us translating on %s": "來 %s 幫我們翻譯", "Source Code": "原始碼", - "Powered by %s": "Powered by %s", - "Register": "註冊" -} \ No newline at end of file + "Register": "註冊", + "Powered by %s": "由 %s 強力驅動", + "Help us translating": "幫助我們改進翻譯", + "Join the community": "加入社群" +} diff --git a/package.json b/package.json index 173a2ac..0653c9e 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "diff-match-patch": "git+https://github.com/hackmdio/diff-match-patch.git", "ejs": "^2.5.5", "emojify.js": "~1.1.0", + "escape-html": "^1.0.3", "express": ">=4.14", "express-session": "^1.14.2", "file-saver": "^1.3.3", @@ -46,7 +47,7 @@ "formidable": "^1.0.17", "gist-embed": "~2.6.0", "graceful-fs": "^4.1.11", - "handlebars": "^4.0.13", + "handlebars": "^4.1.2", "helmet": "^3.13.0", "highlight.js": "~9.12.0", "i18n": "^0.8.3", @@ -57,7 +58,7 @@ "jquery-ui": "^1.12.1", "js-cookie": "^2.1.3", "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", "jsdom-nogyp": "^0.8.3", "keymaster": "^1.6.2", @@ -82,7 +83,7 @@ "mathjax": "~2.7.0", "mattermost": "^3.4.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", "minimist": "^1.2.0", "minio": "^6.0.0", diff --git a/public/js/extra.js b/public/js/extra.js index b80290d..011e214 100644 --- a/public/js/extra.js +++ b/public/js/extra.js @@ -15,6 +15,7 @@ import hljs from 'highlight.js' import PDFObject from 'pdfobject' import S from 'string' import { saveAs } from 'file-saver' +import escapeHTML from 'escape-html' require('./lib/common/login') require('../vendor/md-toc') @@ -323,7 +324,7 @@ export function finishView (view) { svg[0].setAttribute('preserveAspectRatio', 'xMidYMid meet') } catch (err) { $value.unwrap() - $value.parent().append('
' + err + '
') + $value.parent().append(`
${escapeHTML(err)}
`) console.warn(err) } }) @@ -347,7 +348,7 @@ export function finishView (view) { $value.children().unwrap().unwrap() } catch (err) { $value.unwrap() - $value.parent().append('
' + err + '
') + $value.parent().append(`
${escapeHTML(err)}
`) console.warn(err) } }) @@ -366,7 +367,7 @@ export function finishView (view) { $value.children().unwrap().unwrap() } catch (err) { $value.unwrap() - $value.parent().append('
' + err + '
') + $value.parent().append(`
${escapeHTML(err)}
`) console.warn(err) } }) @@ -388,7 +389,7 @@ export function finishView (view) { } $value.unwrap() - $value.parent().append('
' + errormessage + '
') + $value.parent().append(`
${escapeHTML(errormessage)}
`) console.warn(errormessage) } }) @@ -408,7 +409,7 @@ export function finishView (view) { svg[0].setAttribute('preserveAspectRatio', 'xMidYMid meet') } catch (err) { $value.unwrap() - $value.parent().append('
' + err + '
') + $value.parent().append(`
${escapeHTML(err)}
`) console.warn(err) } }) @@ -568,7 +569,7 @@ export function postProcess (code) { if (warning && warning.length > 0) { warning.text(md.metaError) } else { - warning = $('
' + md.metaError + '
') + warning = $(`
${escapeHTML(md.metaError)}
`) result.prepend(warning) } } diff --git a/public/js/history.js b/public/js/history.js index 6007bef..27b8cd2 100644 --- a/public/js/history.js +++ b/public/js/history.js @@ -4,6 +4,7 @@ import store from 'store' import S from 'string' import LZString from 'lz-string' +import url from 'wurl' import { checkNoteIdValid, @@ -23,9 +24,9 @@ window.migrateHistoryFromTempCallback = null migrateHistoryFromTemp() function migrateHistoryFromTemp () { - if (window.url('#tempid')) { + if (url('#tempid')) { $.get(`${serverurl}/temp`, { - tempid: window.url('#tempid') + tempid: url('#tempid') }) .done(data => { if (data && data.temp) { diff --git a/public/js/index.js b/public/js/index.js index c59c94d..d5345a8 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -17,6 +17,7 @@ import { saveAs } from 'file-saver' import randomColor from 'randomcolor' import store from 'store' import hljs from 'highlight.js' +import url from 'wurl' import _ from 'lodash' @@ -1373,12 +1374,12 @@ $('#gistImportModalConfirm').click(function () { if (!isValidURL(gisturl)) { showMessageModal(' Import from Gist', 'Not a valid URL :(', '', '', false) } else { - var hostname = window.url('hostname', gisturl) + var hostname = url('hostname', gisturl) if (hostname !== 'gist.github.com') { showMessageModal(' Import from Gist', 'Not a valid Gist URL :(', '', '', false) } else { 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) { if (data.files) { var contents = '' diff --git a/public/views/index/foot.ejs b/public/views/index/foot.ejs index 54e39e1..b4b2998 100644 --- a/public/views/index/foot.ejs +++ b/public/views/index/foot.ejs @@ -5,7 +5,6 @@ - <%- include ../build/cover-scripts %> <% } else { %> diff --git a/public/views/shared/help-modal.ejs b/public/views/shared/help-modal.ejs index ab9f6b7..eb5566a 100644 --- a/public/views/shared/help-modal.ejs +++ b/public/views/shared/help-modal.ejs @@ -15,11 +15,13 @@

<%= __('Contacts') %>

- <%= __('Report an issue') %> + <%= __('Join the community') %>
<%= __('Meet us on %s', 'Matrix') %>
- <%= __('Help us translating on %s', 'POEditor') %> + <%= __('Report an issue') %> +
+ <%= __('Help us translating') %>
diff --git a/webpack.common.js b/webpack.common.js index 9e1432b..f361570 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -195,13 +195,11 @@ module.exports = { 'bootstrap-validator', 'expose-loader?select2!select2', 'expose-loader?moment!moment', - 'script-loader!js-url', path.join(__dirname, 'public/js/cover.js') ], index: [ 'babel-polyfill', 'script-loader!jquery-ui-resizable', - 'script-loader!js-url', 'script-loader!Idle.Js', 'expose-loader?LZString!lz-string', 'script-loader!codemirror', @@ -248,7 +246,6 @@ module.exports = { 'expose-loader?jsyaml!js-yaml', 'script-loader!mermaid', 'expose-loader?moment!moment', - 'script-loader!js-url', 'script-loader!handlebars', 'expose-loader?hljs!highlight.js', 'expose-loader?emojify!emojify.js', diff --git a/yarn.lock b/yarn.lock index 614f596..c003b3c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -510,7 +510,7 @@ are-we-there-yet@~1.1.2: delegates "^1.0.0" readable-stream "^2.0.6" -argparse@^1.0.2, argparse@^1.0.7: +argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== @@ -3363,7 +3363,7 @@ es6-weak-map@^2.0.2: es6-iterator "^2.0.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" resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg= @@ -3521,11 +3521,6 @@ espree@^5.0.1: acorn-jsx "^5.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: version "3.1.3" 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-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" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== @@ -5616,14 +5611,6 @@ js-yaml@^3.13.0, js-yaml@^3.13.1: argparse "^1.0.7" 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: version "0.1.1" 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" tmp "0.0.33" -marked@~0.3.6: - version "0.3.19" - resolved "https://registry.yarnpkg.com/marked/-/marked-0.3.19.tgz#5d47f709c4c9fc3c216b6d46127280f40b39d790" - integrity sha512-ea2eGWOqNxPcXv8dyERdSr/6FmzvWwzjMxpfGB/sbMccXoct+xY+YukPD+QTUZwyvK7BZwcr4m21WBOW41pAkg== +marked@~0.6.2: + version "0.6.2" + resolved "https://registry.yarnpkg.com/marked/-/marked-0.6.2.tgz#c574be8b545a8b48641456ca1dbe0e37b6dccc1a" + integrity sha512-LqxwVH3P/rqKX4EKGz7+c2G9r98WeM/SW34ybhgNGhUQNKtf1GmmSkJ6cDGJ/t6tiyae49qRkpyTw2B9HOrgUA== math-interval-parser@^1.1.0: version "1.1.0" @@ -6543,13 +6530,12 @@ messageformat@^0.3.1: nopt "~3.0.6" watchr "~2.4.13" -meta-marked@^0.4.2: - version "0.4.2" - resolved "https://registry.yarnpkg.com/meta-marked/-/meta-marked-0.4.2.tgz#4a1fae344f53d7040aacabb723e2f432a37455f8" - integrity sha1-Sh+uNE9T1wQKrKu3I+L0MqN0Vfg= +"meta-marked@git+https://github.com/codimd/meta-marked#semver:^0.4.2": + version "0.4.4" + resolved "git+https://github.com/codimd/meta-marked#04fd9775b38566e41b71e3e63bd78717d3eb4445" dependencies: - js-yaml "~3.5.5" - marked "~0.3.6" + js-yaml "~3.13.1" + marked "~0.6.2" method-override@^2.3.7: version "2.3.10"