diff --git a/CHANGELOG.md b/CHANGELOG.md index 56fae6b54..8103511f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,54 +1,126 @@ +# 4.11.0 + +## Goals + +Our main goal for this release was to update our Forms app to address feedback gathered in the research we conducted over the summer (survey and one-on-one interviews with volunteers). Many of these points were limited to forms itself, but some were closely related with some other concepts in the platform and prompted us to make some considerable changes throughout. + +## Update notes + +As of this release we are dropping support for Internet Explorer 11 we learned that even Microsoft stopped supporting it in their own Office 365 platform. This means that we can finally start using some newer browser features that are available in every other modern browser and simplify parts of our code, making it smaller and faster to load for everyone else. + +4.11 doesn't require any manual configuration if you're updating from 4.10, so this should be a fairly simple release. There is a new customization option that is described in the following features section, however, this is entirely optional. + +To update from 4.10.0 to 4.11.0: + +1. Stop your server +2. Get the latest code with git +3. Install the latest dependencies with `bower update` and `npm i` + * this release requires new client-side dependencies, so **don't forget this step** +4. Restart your server +5. Confirm that your instance is passing all the tests included on the `/checkup/` page (on whatever devices you intend to support) + +## Features + +* We've changed the platform's default display name from "Anonymous" to "Guest" and have also replaced existing mentions of "Unregistered" or "Non-registered" users with this terminology. + * The term "Anonymous" was only ever intended to convey the classical sense of the word ("without name or attribution") rather than the stricter modern sense "indistinguishable from a meaningfully large set of other individuals". To be clear, this is a change of terminology, not behaviour. To prevent your IP address from being revealed to the host server while using CryptPad the best option has always been, and continues to be [Tor browser](https://www.torproject.org/download/). + * Going forward, if you see "anonymize" in CryptPad (such as in forms), you can take it to mean that extra efforts are being taken to make protocol-level metadata indistinguishable from that of other users, while "Guest" means only that you haven't registered or have removed your display name. +* While we were reconsidering the notion of guest accounts we decided that it would be useful to be able to distinguish one guest from another. We decided to implement this by hooking into the existing system for displaying users' profile pictures by mapping a list of emojis to guests' randomly generated identifiers. + * We chose a list of emojis that we hoped nobody would find objectionable ('🙈 đŸĻ€ 🐞 đŸĻ‹ đŸŦ 🐋 đŸĸ đŸĻ‰ đŸĻ† 🐧 đŸĻĄ đŸĻ˜ đŸĻ¨ đŸĻĻ đŸĻĨ đŸŧ đŸģ đŸĻ đŸĻ“ 🐄 💮ī¸ 🐙ī¸ 🌸ī¸ đŸŒģī¸ 🐝ī¸ 🐐 đŸĻ™ đŸĻ’ 🐘 đŸĻ 🐁 🐹 🐰 đŸĻĢ đŸĻ” 🐨 🐱 đŸē đŸ‘ē 👹 đŸ‘Ŋ 👾 🤖'), but we realize that cultures and contexts differ widely. As such, we've made this configurable on a per-instance basis. A custom list of emojis can be set in `customize/application_config.js` as an array of single-emoji strings (`AppConfig.emojiAvatars = ['đŸĨĻ', '🧄', '🍄', 'đŸŒļī¸'];`) or as an empty array if you prefer not to display any emojis (`AppConfig.emojiAvatars = [];`). See [our admin docs](https://docs.cryptpad.fr/en/admin_guide/customization.html#application-config) for more info on customization. + * Users can edit their display name inline in the user list or on their settings page, in which case their avatar will be one or two letters from their name (their first two initials if their name contains at least one space, otherwise the first two letters of their name). + * Once these initial improvements had been made to the user list, the lack of support for emoji avatars in a number of places felt very conspicuous, so we've done our best to implement them consistently across every social aspect of the platform. Default emoji avatars are also displayed in comments in the rich text editor, in authorship data in our code/markdown editor, in tooltips when you hover over the marker for remote users' cursor location, in the "currently editing" indicator for Kanban cards, in the share and access menus, and in the "contacts" app. +* The file upload dialog now includes a preview of the media that you are about to upload (as long as it's something CryptPad is capable of displaying) as well as a text field for describing the media. Descriptive text is added to the file's encrypted metadata and is applied to rendered media as `alt` or `title` attributes wherever applicable. This coincides with a broader effort to improve keyboard navigation and add support for screen-readers. +* The link creation UI from 4.9.0 now highlights the URL input field as you type to indicate whether the current URL value is valid, rather than simply displaying an error when you submit. +* The 'Performance' tab of the admin panel has reused the bar chart UI we added for displaying the results of forms. +* We've written a small script to help us identify translated strings that are consistently duplicated across the four languages into which CryptPad has been fully translated (English, French, German, Japanese). We plan to use this to remove unnecessary strings in an upcoming release and make it easier to translate the platform into new languages. +* The "share" menu now makes its primary actions more clear, with explicit text ("copy link" instead of just "copy") on its main buttons, as well as icons that better match button UI on the rest of the platform. +* Finally, this release introduces our "v2" forms update with many usability enhancements: + * Forms can now include questions which are displayed based on the condition of participants' earlier answers. + * The participant view of forms no longer displays CryptPad's toolbar and popups and instead uses a full-page view. CryptPad's logo is included at the bottom of the page and acts as a link to the home page. + * Form authors can set a custom message to be displayed to participants once they have submitted a response. + * Some more advanced form settings are available for authors, and we've clarified the descriptions of existing options ("Anonymize responses", "Guest access", "Editing after submission"). + * Form authorship supports real-time editing more broadly than before: + * Changes are saved as you type, so you no longer need to manually save each question. + * Multiple authors can edit edit the same question concurrently without overwriting each other's work. + * We avoid redrawing active parts of the UI when other authors make a change, so remote actions won't interfere with your local date-picker, dropdown selections, etc. + * The UI is redrawn no more than once every 500ms for performance reasons. + * We do our best to preserve current scroll position when other users make changes so authors don't accidentally click on the wrong elements. + * Authors have easier access to basic functionality in the left sidebar that allows them to _preview_ a form, copy the participant link, and view existing responses with a single click. + * The form creation presents better default options (placeholders instead of pre-filled fields for text inputs) and offers intuitive controls, such as "enter" to create a new field, "esc" to clear an empty field, and "tab" to navigate with just the keyboard. + * The summary of existing responses is presented more intuitively: + * The tally of empty responses is now displayed at the top of each question's summary rather than the bottom. + * Bar charts are used throughout, wherever applicable. + * Options with no answers are still displayed with zero results in the summary rather than not being displayed at all. + * Options are displayed according to the order of their appearance in the original question, rather than according to the order in which participants chose them. + * Form authors can conveniently change a question's type wherever its content can be automatically converted to a related format (radio, checkbox, ranked choices). + * There are more options for form validation, such as required questions and new types of questions with automatic validation. Invalid answers are summarized at the bottom of the form. Clicking summaries jumps to the relevant question. + * CryptPad logo is included at the bottom of the participant page and links to the home page so that participants can create their own forms or learn more about how data is encrypted. + * We now pre-fill some options in our "simple scheduling poll" template, suggesting some basic options for the upcoming week and better indicating how the poll is intended to be used. + * Lastly, authors can assign color themes to their form for some basic visual customization. + +## Bug fixes + +* While implementing and testing the display of emojis as avatars for guests we found several instances (in teams, chat, and the contacts app) where the UI did not fall back to the default display name. +* We've clarified a comment in our example NGINX file which recommended that admins contact us if they are using CryptPad in a production environment. It now indicates that they should do so _if they require professional support_. +* We now handle an edge case in ICS import to calendars where DTEND was not defined. When a duration is specified we calculate the end of the event relative to the provided start time, and otherwise consider it a "full-day" event as per the ICS specification. +* Users can share links directly with contacts, but we noticed that the color of the previewed link was overridden by some styles from bootstrap, resulting in very low contrast. We now use a standard CryptPad color which is clearly legible in both light and dark mode. +* Finally, we've applied some stricter validation to the encrypted content of team invite links which could have previously resulted in type errors. + # 4.10.0 ## Goals +August is typically a quiet month for CryptPad's development team, as members of our team and many of our users take their (northern hemisphere) summer holidays. We took the opportunity to catch up on some regular maintentance and to review and some prototype branches of our code that had been ready for integration for some time. + +It seems that some browser developers thought to do the same thing, because we noticed some significant regressions in some APIs that we rely on. Some of our time went towards addressing the resulting bugs and restructuring some code to avoid future regressions for browser behaviour that seem likely to be changed again in the near future. ## Update notes +4.10.0 includes some minor changes to [the checkup page](https://docs.cryptpad.fr/fr/admin_guide/installation.html#diagnostics). Some admins have included screenshots of this page in bug reports or requests for support along with details of problems they suspect of being related. Because we've observed that the root of many issues is the browser (sometimes in addition to the server) we have decided to include details about the browser in this page's summary. + +Up until now the checkup page only tested observable behaviour of the server such as HTTP headers on particular resources, configuration parameters distributed to the client, and the availability of essential resources. This practice meant that a report for an instance should have been the same regardless of the device that was used to generate the report. In light of a serious regression in Chrome (and all its derivatives) we decided that objectiveness was less important than utility and introduced some tests which check whether the client running the diagnostics interprets the provided server configuration. Terrible browsers (ie. every browser that is available on iOS) will fail these tests every time because they don't implement the expected APIs, but we've tried to detect these cases and warn that they are expected. + +For the most part you (as an admin) will not need to do anything special for this release as a result. If you notice weird issues on particular browsers in the future, however, it might be helpful to view this page from the affected browser/device and include any information that is provided in bug reports. + +To update from 4.9.0 to 4.10.0: + +1. Stop your server +2. Get the latest code with git +3. Install the latest dependencies with `bower update` and `npm i` +4. Restart your server +5. Confirm that your instance is passing all the tests included on the `/checkup/` page (on whatever devices you intend to support) + ## Features -* screen real-estate - * kanban - * narrower 'add board' button - * 'Tools' menu to collapse the tag and view mode UI - * general - * main toolbar collapse -* remove unused files - * /common/noscriptfix.js -* more detailed inventory of dependencies - * see cryptpad/www/lib/changelog.md -* include vendor and appVersion in support ticket data -* log when trimming history -* rewrite some translation keys to use a single syntax for BR tags -* translations - * more linting - * standardized capitalization of "CryptPad" - * avoid raw injection of HTML strictly for adding line breaks - * remove some unnecessary cases of raw HTML injection -* checkup - * better styles - * improved formatting for returned values in failed tests - * display browser and OS for when people send us screenshots instead of URLs - * test for support of some features in the browser (inside the sandbox) -* mark password inputs as _new passwords_ so that browsers don't suggest you input and share your account password +As noted above, web standards and the browsers that implement them are constantly changing. Web applications like CryptPad which use new and advanced browser features are particularly prone to regressions even when we use browser features exactly as intended and advertized. The "Features" section of each release's notes typically highlights visible things, like clickable buttons or improvements to the interface. This point is included as a reminder that _regular maintenance is at least as important to an open-source software project_, even though it gets little attention and far less funding. The funding bodies that have generously supported our work typically award grants for research and the development of novel features, but we are sorely in need of increased support to allow us the flexibility to deal with unanticipated problems as they arise. If you are fortunate enough to have some disposable income and value the work that keeps CryptPad functional we would greatly appreciate a one-time or recurring donation to [our OpenCollative campaign](https://opencollective.com/cryptpad/contribute). + +* This release coincided the yearly seminar of [XWiki (our parent organization)](https://www.xwiki.com) which always features a day-long hackathon. This year our team was joined by [@aemi-dev](https://github.com/aemi-dev) who has been working as an intern within XWiki's product team. Together we worked on adding some data visualization to our recently introduced _Form_ app. The improvements include a timeline to visualize how many responses were submitted to the form during each day and bar charts for a variety of question types to complement the existing tally of results. There's still more work to be done in this direction, but we established some useful foundations during our relatively short session. +* Frequent users of small screens will be pleased to hear that CryptPad's app toolbar now includes a button to collapse the upper segment of the toolbar which includes CryptPad's logo, the current document's title, status indicator (saved, editing, disconnected, etc.), and the user administration menu. +* Likewise, Kanban users may note that the app's toolbar also features a "Tools" menu (like that in the markdown editor) which toggles display of the controls which filter board items by tag and select view state (detailed or brief). +* Password fields that are specific to files and documents now have the `autocomplete="new-password"` attribute applied to prevent browsers and integrated password managers from suggesting that users enter their account password. This lowers the risk that users will inadvertently reveal their account password in the future. Additionally, Firefox will now prompt users to use a high-entropy password instead. +* Our integrated support ticket functionality automatically includes some commonly needed information about the user's account and browser. As of this release this data will also include the browser's `vendor` and `appVersion`, which are useful hints about the host browser and OS (which we almost always have to ask about when the ticket is for a bug report). This data will also include the browser's current width and height, as some issues only occur at particular resolutions and can otherwise be difficult to reproduce. +* We reviewed a range of third-party dependencies that are included in our repository and updated `cryptpad/www/lib/changelog.md` to better indicate their exact version, source, and any CryptPad-specific modifications we've made to them. + * We found `less.js` had been duplicated, with one version (provided by bower) being used for custom styles in our slide editor while the rest of the platform used a custom version that fixed an apparent bug in the _reference import_ syntax. We've standardized on our custom version and removed the alternative from our `bower.json` file. + * We also identified a few files that were no longer in use and removed them. There's still more work to be done to document the exact versions and source of some dependencies, so we've made this process a part of our regular release checklist. +* During a manual review we noticed some inconsistencies between different translations of CryptPad and have automated these checks by adding them to a script which we use to review translations before each release. These have helped us standardize things like the capitalization of "CryptPad", the syntax for some basic markup like `
` tags, and the consistent use of both dialect-specific suffixes in English and punctuation rules in French. We have only added tests for languages in which members of our team are fluent, so if you maintain a translation in another language and can suggest additional qualities we could test we would welcome your suggestions. +* The improved consistency of our translations has also enabled us to construct some translated UI components programmatically without directly using their inline HTML. This provides an extra layer of security in the event that + 1. malicious code was included in a translation file + 2. our tests failed to identify the code before it was included in a release + 3. the release was deployed by an admin that had failed to take advantage of the sandboxing system that prevents the injection of scripts into the UI ## Bug fixes -* Sheet export - * most exports broken by Chrome 92, mostly fixed - * we discovered that CSV export was not working in any major browser, though it's unclear why. We've disabled CSV export in the meantime - * updated translation to stop referring to Microsoft since we support OpenDocument formats - * some new browser-specific checkup tests to make it easier to detect future regressions in the APIs -* drive bug fixes - * guard against a few possible type errors - * "burn this drive" button works again in Firefox -* clear login token - 1. when you delete your account - 2. when logging in -* use single version of less.js on the client -* abort subsequent actions when metadata fails to load during owned channel archival -* handle warnings when trimming history (not just errors) -* filter channel ids with invalid lengths when generating a list of all channels you use +* The Chrome development team made some changes related to the availability of the `SharedArrayBuffer` API in cross-site-isolated contexts such as that of our sandboxing system which resulted in it being disabled despite the fact that our usage conformed to a specification that should have been supported. We use this modern browser feature (where available) to convert spreadsheets between different formats in the browser itself, whereas other services (even those advertizing their use of encryption for documents) send users' content to their server for conversion. Since Chrome's engine is used as the basis for a wide variety of other browsers, this broke sheet export everywhere except Firefox (which correctly implements the specification). Luckily, we found a simple workaround to use the same underlying feature using an alternate syntax that they had failed to disable. This is only a short-term solution as we have no expectation that it will continue to work, so we are actively investigating making this conversion a trusted process that will be run outside of our sandboxing system. +* On the topic of spreadsheet conversion, we updated our translations of the warning that is displayed in our conversion UI when the required browser features are not available. Rather than referring to "Microsoft Office formats" we now refer to _"Office formats"_ since we offer support for ODS in addition to XLSX. +* We found that CSV export mysteriously stopped working as well (seemingly everywhere, not just Chrome and derivatives). We're still not sure why this is the case, but the option is disabled in the UI until we can find and fix the problem. +* The _drive_ app includes a button that lets guest users wipe their personal data from their browser's session. We noticed that this button did nothing after approximately 50% of page loads in Firefox, suggesting there was an unpredictable quality related to either how the button was being created or how "click handlers" were declared. We traced it back to the jQuery library and rewrote the handler to use "VanillaJS". We don't have the time or budget to dig into why it stopped working, so unless someone else can figure it out for us then you, dear reader, may never learn the answer to this mystery. +* While investigating the drive we also added some guards against some possible type errors. +* We noticed that the `loginToken` attribute was not correctly removed from clients' localStorage when they deleted their account. The value of this token is random and is of no use to attackers (especially when the token belongs to a deleted account), but it was a cause of some inconvenience to us when testing account deletion, as the mismatch between the token stored locally and in accounts (after login) required us to login in a second time before. We've updated the related code to: + 1. correctly delete the token when you delete an account from the settings page + 2. ensure that no such token is present when logging in +* Document ids with invalid lengths are excluded from accounts' lists of "pinned documents" (those which should not be deleted from the server). We recently implemented a similar fix, but found that this list could be constructed in more than one way depending on the context. +* We identified and fixed two problems with our "history trim" functionality (accessible via documents' "Properties" menu): + 1. In the extremely unlikely event that a user requested that the server trim the history of a document and its metadata failed to load, the server would respond to the user with an error but did not correctly abort from the subsequent process to trim the document's history. In theory this could have been used by non-owners to archive parts of the documents history, however, we have no reason to believe that this was possible in practice. In any case, the flaw has been corrected. + 2. Complex documents like spreadsheets that use more than one channel to store different types of content would trim their respective histories in parallel, however, in such cases any errors were returned to the calling function as a list of warnings rather than a singular error. This format was not handled by the UI, resulting in an apparent success in cases of a partial or complete failure for such document types. # 4.9.0 diff --git a/bower.json b/bower.json index efa70c1bb..81acde661 100644 --- a/bower.json +++ b/bower.json @@ -30,7 +30,7 @@ "secure-fabric.js": "secure-v1.7.9", "hyperjson": "~1.4.0", "chainpad-crypto": "^0.2.0", - "chainpad-listmap": "^0.10.0", + "chainpad-listmap": "^1.0.0", "chainpad": "^5.2.0", "file-saver": "1.3.1", "alertifyjs": "1.0.11", diff --git a/customize.dist/fonts/cptools/fonts/cptools.eot b/customize.dist/fonts/cptools/fonts/cptools.eot new file mode 100644 index 000000000..dbfc79bf7 Binary files /dev/null and b/customize.dist/fonts/cptools/fonts/cptools.eot differ diff --git a/customize.dist/fonts/cptools/fonts/cptools.svg b/customize.dist/fonts/cptools/fonts/cptools.svg index 12d2fe9d6..29461075f 100644 --- a/customize.dist/fonts/cptools/fonts/cptools.svg +++ b/customize.dist/fonts/cptools/fonts/cptools.svg @@ -7,28 +7,28 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - + + + + + @@ -38,4 +38,5 @@ + \ No newline at end of file diff --git a/customize.dist/fonts/cptools/fonts/cptools.ttf b/customize.dist/fonts/cptools/fonts/cptools.ttf index 788b7f881..41ae6ef37 100644 Binary files a/customize.dist/fonts/cptools/fonts/cptools.ttf and b/customize.dist/fonts/cptools/fonts/cptools.ttf differ diff --git a/customize.dist/fonts/cptools/fonts/cptools.woff b/customize.dist/fonts/cptools/fonts/cptools.woff index f2faf5aa2..dca533fcd 100644 Binary files a/customize.dist/fonts/cptools/fonts/cptools.woff and b/customize.dist/fonts/cptools/fonts/cptools.woff differ diff --git a/customize.dist/fonts/cptools/style.css b/customize.dist/fonts/cptools/style.css index 874b6068f..7b3227453 100644 --- a/customize.dist/fonts/cptools/style.css +++ b/customize.dist/fonts/cptools/style.css @@ -1,10 +1,10 @@ @font-face { font-family: 'cptools'; - src: url('fonts/cptools.eot?chd5a1'); - src: url('fonts/cptools.eot?chd5a1#iefix') format('embedded-opentype'), - url('fonts/cptools.ttf?chd5a1') format('truetype'), - url('fonts/cptools.woff?chd5a1') format('woff'), - url('fonts/cptools.svg?chd5a1#cptools') format('svg'); + src: url('fonts/cptools.eot?6tk5ck'); + src: url('fonts/cptools.eot?6tk5ck#iefix') format('embedded-opentype'), + url('fonts/cptools.ttf?6tk5ck') format('truetype'), + url('fonts/cptools.woff?6tk5ck') format('woff'), + url('fonts/cptools.svg?6tk5ck#cptools') format('svg'); font-weight: normal; font-style: normal; font-display: block; @@ -14,7 +14,7 @@ /* use !important to prevent issues with browser extensions that change fonts */ font-family: 'cptools' !important; display: inline-block; - speak: none; + speak: never; font-style: normal; font-weight: normal; font-variant: normal; @@ -26,6 +26,9 @@ -moz-osx-font-smoothing: grayscale; } +.cptools-form-conditional:before { + content: "\e900"; +} .cptools-form-poll:before { content: "\e910"; } @@ -57,65 +60,65 @@ content: "\e91d"; } .cptools-folder-no-color:before { - content: "\e900"; + content: "\e901"; } .cptools-whiteboard:before { - content: "\e901"; + content: "\e902"; } .cptools-new-template:before { - content: "\e902"; + content: "\e903"; } .cptools-shared-folder:before { - content: "\e903"; + content: "\e904"; } .cptools-file-upload:before { - content: "\e904"; + content: "\e905"; } .cptools-template:before { - content: "\e905"; + content: "\e906"; } .cptools-poll:before { - content: "\e906"; + content: "\e907"; } .cptools-slide:before { - content: "\e907"; + content: "\e908"; } .cptools-sheet:before { - content: "\e908"; + content: "\e909"; } .cptools-folder-open:before { - content: "\e909"; + content: "\e90a"; } .cptools-kanban:before { - content: "\e90a"; + content: "\e90b"; } .cptools-folder:before { - content: "\e90b"; + content: "\e90c"; } .cptools-shared-folder-open:before { - content: "\e90c"; + content: "\e90d"; } .cptools-code:before { - content: "\e90d"; + content: "\e90e"; } .cptools-richtext:before { - content: "\e90e"; + content: "\e90f"; } .cptools-file:before { - content: "\e90f"; + content: "\e911"; } .cptools-palette:before { - content: "\e911"; + content: "\e912"; } .cptools-folder-upload:before { - content: "\e912"; + content: "\e913"; } .cptools-add-bottom:before { - content: "\e913"; + content: "\e914"; } .cptools-add-top:before { - content: "\e914"; + content: "\e915"; } .cptools-destroy:before { - content: "\e915"; + content: "\e91f"; } diff --git a/customize.dist/login.js b/customize.dist/login.js index 5cab49934..1ba0eb470 100644 --- a/customize.dist/login.js +++ b/customize.dist/login.js @@ -1,6 +1,6 @@ define([ 'jquery', - '/bower_components/chainpad-listmap/chainpad-listmap.js', + 'chainpad-listmap', '/bower_components/chainpad-crypto/crypto.js', '/common/common-util.js', '/common/outer/network-config.js', diff --git a/customize.dist/pages.js b/customize.dist/pages.js index fa183f90c..7a520c3c0 100644 --- a/customize.dist/pages.js +++ b/customize.dist/pages.js @@ -105,7 +105,7 @@ define([ var imprintUrl = AppConfig.imprint && (typeof(AppConfig.imprint) === "boolean" ? '/imprint.html' : AppConfig.imprint); - Pages.versionString = "v4.10.0"; + Pages.versionString = "v4.11.0"; // used for the about menu diff --git a/customize.dist/src/less2/include/alertify.less b/customize.dist/src/less2/include/alertify.less index 96b8e7cde..5c829cec4 100644 --- a/customize.dist/src/less2/include/alertify.less +++ b/customize.dist/src/less2/include/alertify.less @@ -166,6 +166,9 @@ color: @cryptpad_text_col; text-decoration: underline; } + pre.cp-link-preview { + color: @cryptpad_text_col; + } .cp-info-menu-container { .logo-block { text-align: center; diff --git a/customize.dist/src/less2/include/avatar.less b/customize.dist/src/less2/include/avatar.less index 725c7748f..acaa13351 100644 --- a/customize.dist/src/less2/include/avatar.less +++ b/customize.dist/src/less2/include/avatar.less @@ -4,7 +4,11 @@ @width: 30px ) { @avatar-width: @width; - @avatar-font-size: @width / 1.2; + @avatar-font-size: @width / 1.8; + // scale animal avatar to be somewhat larger, because: + // 1. emojis are wider than most latin characters + // 2. they should occupy the width of two average characters + @avatar-font-size-animal: @avatar-font-size * (6/5); } .avatar_main(@width: 30px) { --LessLoader_require: LessLoader_currentFile(); @@ -40,7 +44,9 @@ color: @cp_avatar-fg; font-size: @avatar-font-size; font-size: var(--avatar-font-size); - text-transform: capitalize; + .animal { + font-size: @avatar-font-size-animal; + } } media-tag { min-height: @avatar-width; diff --git a/customize.dist/src/less2/include/charts.less b/customize.dist/src/less2/include/charts.less index 022a327cf..ea402094f 100644 --- a/customize.dist/src/less2/include/charts.less +++ b/customize.dist/src/less2/include/charts.less @@ -51,22 +51,55 @@ } } + .cp-charts-cell { + border: 1px solid @cp_form-border; + display: table-cell; + padding: 5px 10px; + background: @cp_form-bg2; + } - - &.bar { - th { - //width: 200px !important; - font-size: 10px; // XXX + .cp-form-results-type-radio { + .cp-form-results-type-multiradio-data { + display: flex; + flex-flow: column; } + .cp-form-results-type-radio-data { + display: table-row; + border: 1px solid @cp_form-border; + & > span { + .cp-charts-cell(); + } + } + } + .cp-charts.cp-bar-table, .cp-charts.cp-text-table { + display: table; + width: 100%; + .cp-charts-row { + display: table-row; + border: 1px solid @cp_form-border; + &.full { + display: flex; + flex-flow: column; + } - - - td { - margin-top: 0.25em; - background: @cryptpad_color_brand_fade !important; - color: @cryptpad_color_grey_100 !important; //text_col !important; - font-weight: bold; + & > span { + .cp-charts-cell(); + display: table-cell; + &.cp-value { + min-width: 200px; + } + &.cp-bar-container { + width: 99%; + padding: 0px; + position: relative; + .cp-bar { + position: absolute; + background: @cryptpad_color_brand; + height: 100%; + } + } + } } } } diff --git a/customize.dist/src/less2/include/colortheme-dark.less b/customize.dist/src/less2/include/colortheme-dark.less index 5c1649850..1c71d4f05 100644 --- a/customize.dist/src/less2/include/colortheme-dark.less +++ b/customize.dist/src/less2/include/colortheme-dark.less @@ -68,6 +68,25 @@ @cryptpad_color_yellow_fader: fade(#FFE69C, 15%); // not in light theme @cryptpad_color_lighter_blue: #d2e1f2; +@cp_palette: + #FFD4D4, + #FFDECA, + #FFE69C, + #DBFFB7, + #AFFDC2, + #C9FFFE, + #C8D6FF, + #E4CAFF; +@cp_palette-dark: + darken(desaturate(extract(@cp_palette, 1),60%), 60%), + darken(desaturate(extract(@cp_palette, 2),60%), 60%), + darken(desaturate(extract(@cp_palette, 3),55%), 60%), + darken(desaturate(extract(@cp_palette, 4),55%), 70%), + darken(desaturate(extract(@cp_palette, 5),60%), 65%), + darken(desaturate(extract(@cp_palette, 6),60%), 70%), + darken(desaturate(extract(@cp_palette, 7),60%), 60%), + darken(desaturate(extract(@cp_palette, 8),70%), 60%); + @cryptpad_color_link:@cryptpad_color_brand_300; // Premium plans colors @@ -353,15 +372,7 @@ @cp_kanban-add-hover: fade(@cryptpad_color_black, 10%); @cp_kanban-trash-bg: @cryptpad_color_warn_red; @cp_kanban-color0: @cryptpad_color_grey_600; -@cp_kanban-colors: - darken(desaturate(#FFD4D4,60%), 60%), - darken(desaturate(#FFDECA,60%), 60%), - darken(desaturate(#FFE69C,55%), 60%), - darken(desaturate(#DBFFB7,55%), 70%), - darken(desaturate(#AFFDC2,60%), 65%), - darken(desaturate(#C9FFFE,60%), 70%), - darken(desaturate(#C8D6FF,60%), 60%), - darken(desaturate(#E4CAFF,70%), 60%); +@cp_kanban-colors: @cp_palette-dark; // Notifications @cp_notif-hover: fade(@cryptpad_color_black, 10%); @@ -438,3 +449,5 @@ @cp_form-poll-maybe: @cryptpad_color_grey_700; @cp_form-poll-yes-color: @cryptpad_color_green; @cp_form-invalid: @cryptpad_color_light_red; +@cp_form-palette: @cp_palette-dark; +@cp_form-palette2: @cp_palette; diff --git a/customize.dist/src/less2/include/colortheme.less b/customize.dist/src/less2/include/colortheme.less index 18dcb1c0a..dd6115ea1 100644 --- a/customize.dist/src/less2/include/colortheme.less +++ b/customize.dist/src/less2/include/colortheme.less @@ -67,6 +67,25 @@ @cryptpad_color_yellow_fade: fade(#FFE69C, 50%); // different from dark @cryptpad_color_lighter_blue: #d2e1f2; +@cp_palette: + #FFD4D4, + #FFDECA, + #FFE69C, + #DBFFB7, + #AFFDC2, + #C9FFFE, + #C8D6FF, + #E4CAFF; +@cp_palette-dark: + darken(extract(@cp_palette, 1), 50%), + darken(extract(@cp_palette, 2), 51%), + darken(extract(@cp_palette, 3), 52%), + darken(extract(@cp_palette, 4), 61%), + darken(extract(@cp_palette, 5), 57%), + darken(extract(@cp_palette, 6), 65%), + darken(extract(@cp_palette, 7), 50%), + darken(extract(@cp_palette, 8), 50%); + @cryptpad_color_link: @cryptpad_color_brand; // Premium plans colors @@ -299,7 +318,7 @@ @cp_usergrid-selected-fg: @cryptpad_color_white; // Other -@cp_shadow-color: fade(@cryptpad_color_black, 40%); +@cp_shadow-color: fade(@cryptpad_color_black, 30%); // Apps @cp_app-bg: @cryptpad_color_grey_100; @@ -352,15 +371,7 @@ @cp_kanban-add-hover: fade(@cryptpad_color_black, 10%); @cp_kanban-trash-bg: @cryptpad_color_warn_red; @cp_kanban-color0: @cryptpad_color_grey_400; -@cp_kanban-colors: - #FFD4D4, - #FFDECA, - #FFE69C, - #DBFFB7, - #AFFDC2, - #C9FFFE, - #C8D6FF, - #E4CAFF; +@cp_kanban-colors: @cp_palette; // Notifications @cp_notif-hover: fade(@cryptpad_color_black, 10%); @@ -428,8 +439,8 @@ @cp_calendar-now-fg: @cryptpad_color_grey_200; // Forms -@cp_form-bg1: @cryptpad_color_grey_200; -@cp_form-bg2: @cryptpad_color_grey_100; +@cp_form-bg1: @cryptpad_color_grey_50; +@cp_form-bg2: @cryptpad_color_grey_200; @cp_form-border: @cryptpad_color_grey_200; @cp_form-poll-color: @cryptpad_color_grey_800; @cp_form-poll-no: fade(@cryptpad_color_light_red, 75%); @@ -437,3 +448,5 @@ @cp_form-poll-maybe: @cryptpad_color_grey_300; @cp_form-poll-yes-color: @cryptpad_color_green; @cp_form-invalid: @cryptpad_color_red; +@cp_form-palette: @cp_palette; +@cp_form-palette2: @cp_palette-dark; diff --git a/customize.dist/src/less2/include/creation.less b/customize.dist/src/less2/include/creation.less index f4f4d0193..b15863c57 100644 --- a/customize.dist/src/less2/include/creation.less +++ b/customize.dist/src/less2/include/creation.less @@ -364,9 +364,9 @@ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; - min-height: 20px; - height: 20px; - line-height: 20px; + min-height: 25px; + height: 25px; + line-height: 25px; max-width: 100%; } .fa, .cptools { diff --git a/customize.dist/src/less2/include/forms.less b/customize.dist/src/less2/include/forms.less index 4fb799e13..2eace9f29 100644 --- a/customize.dist/src/less2/include/forms.less +++ b/customize.dist/src/less2/include/forms.less @@ -112,8 +112,10 @@ border-radius: 0; transition: none; - .fa, .cptools { - margin-right: 5px; + i, .fa, .cptools { + &:not(.nomargin) { + margin-right: 5px; + } } .cptools { vertical-align: middle; diff --git a/customize.dist/src/less2/include/modals-ui-elements.less b/customize.dist/src/less2/include/modals-ui-elements.less index 7ec19a699..ffb6f95c9 100644 --- a/customize.dist/src/less2/include/modals-ui-elements.less +++ b/customize.dist/src/less2/include/modals-ui-elements.less @@ -273,4 +273,29 @@ } } } + #cp-upload-preview-container { + max-width: 100%; + max-height: 300px; + overflow: auto; + margin-bottom: 15px; + // FIXME these styles yield weird results for tall, thin images + // maybe img { object-fit: contain; } or scale-down are options + // but they have problems too + media-tag { + max-width: 100%; + iframe { + // pdfs don't take the full width unless we tell them to + width: 100%; + } + & > * { + max-width: 100%; + } + } + } + input#cp-app-drive-link-url { + &.cp-input-invalid { + border: 2px solid @cryptpad_color_red; + color: @cp_form-invalid; + } + } } diff --git a/customize.dist/src/less2/include/sidebar-layout.less b/customize.dist/src/less2/include/sidebar-layout.less index ef93eae4a..564067fb7 100644 --- a/customize.dist/src/less2/include/sidebar-layout.less +++ b/customize.dist/src/less2/include/sidebar-layout.less @@ -69,7 +69,6 @@ background: @cp_sidebar-right-bg; color: @cp_sidebar-right-fg; overflow: auto; - padding-bottom: 200px; // Following rules are only in settings .cp-sidebarlayout-element { diff --git a/customize.dist/src/less2/include/toolbar.less b/customize.dist/src/less2/include/toolbar.less index b0f9b5e42..6ccec507d 100644 --- a/customize.dist/src/less2/include/toolbar.less +++ b/customize.dist/src/less2/include/toolbar.less @@ -532,7 +532,13 @@ &> button { height: @toolbar_line-height; width: @toolbar_line-height; - span { font-size: unset; } + span { + .avatar_vars(36px); + font-size: @avatar-font-size; + .animal { + font-size: @avatar-font-size-animal; + } + } } &> button.cp-avatar.cp-avatar { media-tag { @@ -855,10 +861,14 @@ span { text-align: center; width: 100%; - font-size: 48px; + .avatar_vars(72px); + font-size: @avatar-font-size; display: inline-flex; justify-content: center; align-items: center; + .animal { + font-size: @avatar-font-size-animal; + } } &.cp-avatar { .avatar_main(64px); diff --git a/docs/example.nginx.conf b/docs/example.nginx.conf index 8bc47d9f8..14a3d4fc2 100644 --- a/docs/example.nginx.conf +++ b/docs/example.nginx.conf @@ -2,7 +2,7 @@ # to work with CryptPad. This example WILL NOT WORK AS IS. For best results, # compare the sections of this configuration file against a working CryptPad # installation (http server by the Nodejs process). If you are using CryptPad -# in production, contact sales@cryptpad.fr +# in production and require professional support please contact sales@cryptpad.fr server { listen 443 ssl http2; diff --git a/lib/env.js b/lib/env.js index 4db282d77..5ad0bbdac 100644 --- a/lib/env.js +++ b/lib/env.js @@ -123,7 +123,7 @@ module.exports.create = function (config) { maxWorkers: config.maxWorkers, disableIntegratedTasks: config.disableIntegratedTasks || false, - disableIntegratedEviction: typeof(config.disableIntegratedEviction) === 'undefined'? true: config.disableIntegratedEviction, // XXX 4.10.0 false, + disableIntegratedEviction: typeof(config.disableIntegratedEviction) === 'undefined'? true: config.disableIntegratedEviction, // XXX 4.11.0 false, lastEviction: +new Date(), evictionReport: {}, commandTimers: {}, diff --git a/package-lock.json b/package-lock.json index a3b92de86..c795956c9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "cryptpad", - "version": "4.10.0", + "version": "4.11.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1591,9 +1591,9 @@ } }, "jszip": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.6.0.tgz", - "integrity": "sha512-jgnQoG9LKnWO3mnVNBnfhkh0QknICd1FGSrXcgrl67zioyJ4wgx25o9ZqwNtrROSflGBCGYnJfjrIyRIby1OoQ==", + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.7.1.tgz", + "integrity": "sha512-ghL0tz1XG9ZEmRMcEN2vt7xabrDdqHHeykgARpmZ0BiIctWxM47Vt63ZO2dnp4QYt/xJVLLy5Zv1l/xRdh2byg==", "dev": true, "requires": { "lie": "~3.3.0", diff --git a/package.json b/package.json index a844167f5..26fbc968a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "cryptpad", "description": "realtime collaborative visual editor with zero knowlege server", - "version": "4.10.0", + "version": "4.11.0", "license": "AGPL-3.0+", "repository": { "type": "git", @@ -45,8 +45,8 @@ "lint:js": "jshint --config .jshintrc --exclude-path .jshintignore .", "lint:server": "jshint --config .jshintrc lib", "lint:less": "./node_modules/lesshint/bin/lesshint -c ./.lesshintrc ./customize.dist/src/less2/", - "lint:translations": "node ./scripts/lint-translations.js", - "unused-translations": "node ./scripts/unused-translations.js", + "lint:translations": "node ./scripts/translations/lint-translations.js", + "unused-translations": "node ./scripts/translations/unused-translations.js", "test": "node scripts/TestSelenium.js", "test-rpc": "cd scripts/tests && node test-rpc", "template": "cd customize.dist/src && for page in ../index.html ../privacy.html ../terms.html ../contact.html ../what-is-cryptpad.html ../features.html ../../www/login/index.html ../../www/register/index.html ../../www/user/index.html;do echo $page; cp template.html $page; done;", diff --git a/scripts/translations/find-duplicate-translations.js b/scripts/translations/find-duplicate-translations.js new file mode 100644 index 000000000..a6bc53613 --- /dev/null +++ b/scripts/translations/find-duplicate-translations.js @@ -0,0 +1,111 @@ +var Assert = require("assert"); +var Util = require("../../lib/common-util"); +var addIfAbsent = function (A, e) { + if (A.includes(e)) { return; } + A.push(e); +}; + +var findDuplicates = function (map) { + var keys = Object.keys(map); + + + var duplicates = {}; + var markDuplicate = function (value, key1, key2) { + //console.log("[%s] === [%s] (%s)", key1, key2, value); + if (!Array.isArray(duplicates[value])) { + duplicates[value] = []; + } + addIfAbsent(duplicates[value], key1); + addIfAbsent(duplicates[value], key2); + }; + + keys.forEach(function (key) { + var value = map[key]; + + //var duplicates = []; + keys.forEach(function (key2) { + if (key === key2) { return; } + var value2 = map[key2]; + if (value === value2) { + markDuplicate(value, key, key2); + } + }); + }); + + var temp = {}; + // sort keys and construct a new index using the first key in the sorted array + Object.keys(duplicates).forEach(function (key) { + var val = duplicates[key]; // should be an array + val.sort(); // default js sort + var new_key = val[0]; + temp[new_key] = val; + }); + + var canonical = {}; + Object.keys(temp).sort().forEach(function (key) { + canonical[key] = temp[key]; + }); + return canonical; +}; + +/* +var logDuplicates = function (duplicates) { + // indicate which strings are duplicated and could potentially be changed to use one key + Object.keys(duplicates).forEach(function (val) { + console.log('\"%s\" => %s', val, JSON.stringify(duplicates[val])); + }); +}; +*/ + +var FULL_LANGUAGES = { + EN: Util.clone(require("../../www/common/translations/messages.json")), + FR: Util.clone(require("../../www/common/translations/messages.fr.json")), + DE: Util.clone(require("../../www/common/translations/messages.de.json")), + JP: Util.clone(require("../../www/common/translations/messages.ja.json")), +}; + +var DUPLICATES = {}; + +Object.keys(FULL_LANGUAGES).forEach(function (code) { + DUPLICATES[code] = findDuplicates(FULL_LANGUAGES[code]); +}); + +var extraneousKeys = 0; + +// 1) check whether the same mapping exists across languages +// ie. English has "Open" (verb) and "Open" (adjective) +// while French has "Ouvrir" and "Ouvert(s)" +// such keys should not be simplified/deduplicated +Object.keys(DUPLICATES.EN).forEach(function (key) { + var reference = DUPLICATES.EN[key]; + if (!['FR', 'DE', 'JP'].every(function (code) { + try { + Assert.deepEqual(reference, DUPLICATES[code][key]); + } catch (err) { + return false; + } + return true; + })) { + return; + } + console.log("The key [%s] (\"%s\") is duplicated identically across all fully supported languages", key, FULL_LANGUAGES.EN[key]); + console.log("Values:", JSON.stringify(['EN', 'FR', 'DE', 'JP'].map(function (code) { + return FULL_LANGUAGES[code][key]; + }))); + console.log("Keys:", JSON.stringify(reference)); + console.log(); + extraneousKeys += reference.length - 1; + + //console.log("\n" + code + "\n==\n"); + //logDuplicates(map); +}); + +console.log("Total extraneous keys: %s", extraneousKeys); + + +// TODO +// find instances where +// one of the duplicated keys is not translated +// perhaps we could automatically use the translated one everywhere +// and improve the completeness of translations + diff --git a/scripts/lint-translations.js b/scripts/translations/lint-translations.js similarity index 92% rename from scripts/lint-translations.js rename to scripts/translations/lint-translations.js index bc18dd724..e02bca46a 100644 --- a/scripts/lint-translations.js +++ b/scripts/translations/lint-translations.js @@ -1,4 +1,4 @@ -var EN = require("../www/common/translations/messages.json"); +var EN = require("../../www/common/translations/messages.json"); var simpleTags = [ '
', @@ -68,7 +68,7 @@ var processLang = function (map, lang, primary) { if (typeof(s) !== 'string') { return; } var usesHTML; - s.replace(/<.*?>/g, function (html) { + s.replace(/<[\s\S]*?>/g, function (html) { if (simpleTags.indexOf(html) !== -1) { return; } announce(); usesHTML = true; @@ -118,7 +118,7 @@ processLang(EN, 'en', true); 'zh', ].forEach(function (lang) { try { - var map = require("../www/common/translations/messages." + lang + ".json"); + var map = require("../../www/common/translations/messages." + lang + ".json"); if (!Object.keys(map).length) { return; } processLang(map, lang); } catch (err) { diff --git a/scripts/unused-translations.js b/scripts/translations/unused-translations.js similarity index 98% rename from scripts/unused-translations.js rename to scripts/translations/unused-translations.js index 26156cd03..941835cba 100644 --- a/scripts/unused-translations.js +++ b/scripts/translations/unused-translations.js @@ -1,4 +1,4 @@ -var Messages = require("../www/common/translations/messages.json"); +var Messages = require("../../www/common/translations/messages.json"); var Exec = require("child_process").exec; var ignoreLines = function (source, pattern) { diff --git a/temp.md b/temp.md new file mode 100644 index 000000000..e69de29bb diff --git a/www/admin/app-admin.less b/www/admin/app-admin.less index 227792540..f66eb75f7 100644 --- a/www/admin/app-admin.less +++ b/www/admin/app-admin.less @@ -1,12 +1,14 @@ @import (reference) '../../customize/src/less2/include/framework.less'; @import (reference) '../../customize/src/less2/include/sidebar-layout.less'; @import (reference) '../../customize/src/less2/include/support.less'; +@import (reference) '../../customize/src/less2/include/charts.less'; &.cp-app-admin { .framework_min_main(); .sidebar-layout_main(); .support_main(); + .charts_main(); .cp-hidden { display: none !important; @@ -294,5 +296,27 @@ } } } + span.cp-bar.profiling-percentage { + text-align: center; + padding: 5px; + } + span.profiling-label { + position: absolute; + z-index: 1; + width: 100%; + text-align: center; + padding: 5px; + } + #profiling-chart { + .cp-bar-container { + max-width: 400px; + } + } + .width-constrained { + max-width: 800px; + } + .cp-charts-row.heading { + font-weight: bold; + } } diff --git a/www/admin/inner.js b/www/admin/inner.js index e8d567d41..63c516614 100644 --- a/www/admin/inner.js +++ b/www/admin/inner.js @@ -1673,34 +1673,51 @@ define([ var $div = makeBlock('performance-profiling'); // Msg.admin_performanceProfilingHint, .admin_performanceProfilingTitle var onRefresh = function () { - var body = h('tbody'); + var createBody = function () { + return h('div#profiling-chart.cp-charts.cp-bar-table', [ + h('span.cp-charts-row.heading', [ + h('span', Messages.admin_performanceKeyHeading), + h('span', Messages.admin_performanceTimeHeading), + h('span', Messages.admin_performancePercentHeading), + //h('span', ''), //Messages.admin_performancePercentHeading), + ]), + ]); + }; - var table = h('table#cp-performance-table', [ - h('thead', [ - h('th', Messages.admin_performanceKeyHeading), - h('th', Messages.admin_performanceTimeHeading), - h('th', Messages.admin_performancePercentHeading), - ]), - body, - ]); - var appendRow = function (key, time, percent) { - console.log("[%s] %ss running time (%s%)", key, time, percent); - body.appendChild(h('tr', [ key, time, percent ].map(function (x) { - return h('td', x); - }))); + var body = createBody(); + var appendRow = function (key, time, percent, scaled) { + //console.log("[%s] %ss running time (%s%)", key, time, percent); + body.appendChild(h('span.cp-charts-row', [ + h('span', key), + h('span', time), + //h('span', percent), + h('span.cp-bar-container', [ + h('span.cp-bar.profiling-percentage', { + style: 'width: ' + scaled + '%', + }, ' ' ), + h('span.profiling-label', percent + '%'), + ]), + ])); }; var process = function (_o) { + $('#profiling-chart').remove(); + body = createBody(); var o = _o[0]; var sorted = Object.keys(o).sort(function (a, b) { if (o[b] - o[a] <= 0) { return -1; } return 1; }); + + var values = sorted.map(function (k) { return o[k]; }); var total = 0; - sorted.forEach(function (k) { total += o[k]; }); + values.forEach(function (value) { total += value; }); + var max = Math.max.apply(null, values); + sorted.forEach(function (k) { var percent = Math.floor((o[k] / total) * 1000) / 10; - appendRow(k, o[k], percent); + appendRow(k, o[k], percent, (o[k] / max) * 100); }); + $div.append(h('div.width-constrained', body)); }; sFrameChan.query('Q_ADMIN_RPC', { @@ -1710,10 +1727,7 @@ define([ UI.warn(Messages.error); return void console.error(e, data); } - //console.info(data); - $div.find("table").remove(); process(data); - $div.append(table); }); }; diff --git a/www/calendar/export.js b/www/calendar/export.js index 64775762b..5967e2027 100644 --- a/www/calendar/export.js +++ b/www/calendar/export.js @@ -123,6 +123,7 @@ define([ var jcalData = ICAL.parse(content); vcalendar = new ICAL.Component(jcalData); } catch (e) { + console.error(e); return void cb(e); } @@ -147,6 +148,18 @@ define([ var isAllDay = false; var start = ev.getFirstPropertyValue('dtstart'); var end = ev.getFirstPropertyValue('dtend'); + var duration = ev.getFirstPropertyValue('duration'); + if (!end && !duration) { + if (start.isDate) { + end = start.clone(); + end.adjust(1); // Add one day + } else { + end = start.clone(); + } + } else if (!end) { + end = start.clone(); + end.addDuration(duration); + } if (start.isDate && end.isDate) { isAllDay = true; start = String(start); @@ -175,7 +188,7 @@ define([ hidden.push(al.toString()); } var trigger = al.getFirstPropertyValue('trigger'); - var minutes = -trigger.toSeconds() / 60; + var minutes = trigger ? (-trigger.toSeconds() / 60) : 0; if (reminders.indexOf(minutes) === -1) { reminders.push(minutes); } }); diff --git a/www/calendar/inner.js b/www/calendar/inner.js index 21cb12789..fbc910bdb 100644 --- a/www/calendar/inner.js +++ b/www/calendar/inner.js @@ -566,7 +566,7 @@ define([ attributes: { 'class': 'fa fa-trash-o', }, - content: h('span', Messages.kanban_delete), + content: h('span', Messages.poll_remove), action: function (e) { e.stopPropagation(); var cal = APP.calendars[id]; @@ -586,8 +586,9 @@ define([ }, function (err) { if (err) { console.error(err); - UI.warn(Messages.error); + return void UI.warn(Messages.error); } + renderCalendar(); }); }); } @@ -722,7 +723,7 @@ define([ if (!calendars.length) { return; } var team = privateData.teams[teamId]; var avatar = h('span.cp-avatar'); - common.displayAvatar($(avatar), team.avatar, team.displayName); + common.displayAvatar($(avatar), team.avatar, team.displayName || team.name); APP.$calendars.append(h('div.cp-calendar-team', [ avatar, h('span.cp-name', {title: team.name}, team.name) diff --git a/www/code/markers.js b/www/code/markers.js index b070e68fc..48e5a25fb 100644 --- a/www/code/markers.js +++ b/www/code/markers.js @@ -3,7 +3,9 @@ define([ '/common/sframe-common-codemirror.js', '/customize/messages.js', '/bower_components/chainpad/chainpad.dist.js', -], function (Util, SFCodeMirror, Messages, ChainPad) { + '/common/inner/common-mediatag.js', + '/common/common-interface.js', +], function (Util, SFCodeMirror, Messages, ChainPad, MT, UI) { var Markers = {}; /* TODO Known Issues @@ -38,7 +40,17 @@ define([ }); } uid = Number(uid); - var name = Util.fixHTML(author.name || Messages.anonymous); + var name = Util.fixHTML(UI.getDisplayName(author.name)); + var animal; + if ((!name || name === Messages.anonymous) && typeof(author.uid) === 'string') { + animal = MT.getPseudorandomAnimal(author.uid); + if (animal) { + name = animal + ' ' + Messages.anonymous; + } else { + name = Messages.anonymous; + } + } + var col = Util.hexToRGB(author.color); var rgba = 'rgba('+col[0]+','+col[1]+','+col[2]+','+Env.opacity+');'; return Env.editor.markText(from, to, { @@ -520,7 +532,8 @@ define([ Env.authormarks.authors[Env.myAuthorId] = { name: userData.name, curvePublic: userData.curvePublic, - color: userData.color + color: userData.color, + uid: userData.uid, }; if (!old || (old.name === userData.name && old.color === userData.color)) { return; } return true; diff --git a/www/common/application_config_internal.js b/www/common/application_config_internal.js index 3be979f17..4a58085ab 100644 --- a/www/common/application_config_internal.js +++ b/www/common/application_config_internal.js @@ -208,5 +208,7 @@ define(function() { // the driveless mode by changing the following value to "false" AppConfig.allowDrivelessMode = true; + AppConfig.emojiAvatars = '🙈 đŸĻ€ 🐞 đŸĻ‹ đŸŦ 🐋 đŸĸ đŸĻ‰ đŸĻ† 🐧 đŸĻĄ đŸĻ˜ đŸĻ¨ đŸĻĻ đŸĻĨ đŸŧ đŸģ đŸĻ đŸĻ“ 🐄 💮ī¸ 🐙ī¸ 🌸ī¸ đŸŒģī¸ 🐝ī¸ 🐐 đŸĻ™ đŸĻ’ 🐘 đŸĻ 🐁 🐹 🐰 đŸĻĢ đŸĻ” 🐨 🐱 đŸē đŸ‘ē 👹 đŸ‘Ŋ 👾 🤖'.split(/\s+/); + return AppConfig; }); diff --git a/www/common/boot2.js b/www/common/boot2.js index ada5b794c..d143da87d 100644 --- a/www/common/boot2.js +++ b/www/common/boot2.js @@ -34,6 +34,7 @@ try { define([ '/common/requireconfig.js' ], function (RequireConfig) { + require.config(RequireConfig()); // most of CryptPad breaks if you don't support isArray @@ -91,4 +92,10 @@ define([ } catch (e) { console.error(e); failStore(); } require([document.querySelector('script[data-bootload]').getAttribute('data-bootload')]); + if (typeof(Promise) !== 'function') { + setTimeout(function () { + var s = "Internet Explorer is not supported anymore, including by Microsoft.\n\nMost of CryptPad's collaborative functionality requires a modern browser to work.\n\nWe recommend Mozilla Firefox."; + window.alert(s); + }); + } }); diff --git a/www/common/common-interface.js b/www/common/common-interface.js index 71a1ed8af..5c2431efd 100644 --- a/www/common/common-interface.js +++ b/www/common/common-interface.js @@ -41,6 +41,10 @@ define([ return e; }; + UI.getDisplayName = function (name) { + return (typeof(name) === 'string'? name: "").trim() || Messages.anonymous; + }; + // FIXME almost everywhere this is used would also be // a good candidate for sframe-common's getMediatagFromHref UI.mediaTag = function (src, key) { diff --git a/www/common/common-messaging.js b/www/common/common-messaging.js index 65f05961e..4a3eb2a91 100644 --- a/www/common/common-messaging.js +++ b/www/common/common-messaging.js @@ -17,7 +17,8 @@ define([ edPublic: proxy.edPublic, curvePublic: proxy.curvePublic, notifications: Util.find(proxy, ['mailboxes', 'notifications', 'channel']), - avatar: proxy.profile && proxy.profile.avatar + avatar: proxy.profile && proxy.profile.avatar, + uid: proxy.uid, }; if (hash === false) { delete data.channel; } return data; diff --git a/www/common/common-thumbnail.js b/www/common/common-thumbnail.js index 01e89e5d1..e3b328dc1 100644 --- a/www/common/common-thumbnail.js +++ b/www/common/common-thumbnail.js @@ -196,7 +196,7 @@ define([ reader.readAsText(blob); }; Thumb.fromBlob = function (blob, _cb) { - var cb = Util.once(_cb); + var cb = Util.once(Util.mkAsync(_cb)); // The blob is already in memory, it should be super-fast to make a thumbnail // ==> 1s timeout setTimeout(function () { diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 81327844f..08e0bcf07 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -156,9 +156,11 @@ define([ var icons = Object.keys(users).map(function (key, i) { var data = users[key]; - var name = data.displayName || data.name || Messages.anonymous; - var avatar = h('span.cp-usergrid-avatar.cp-avatar'); - common.displayAvatar($(avatar), data.avatar, name); + var name = UI.getDisplayName(data.displayName || data.name); + var avatar = h('span.cp-usergrid-avatar.cp-avatar', { + 'aria-hidden': true, + }); + common.displayAvatar($(avatar), data.avatar, name, Util.noop, data.uid); var removeBtn, el; if (config.remove) { removeBtn = h('span.fa.fa-times'); @@ -649,7 +651,7 @@ define([ if (!AppConfig.enableTemplates) { return; } if (!common.isLoggedIn()) { return; } button = $('