浏览代码

Upgrade autolinker, sdp

Danilo Bargen 6 年之前
父节点
当前提交
1d9a8267ef
共有 9 个文件被更改,包括 13 次插入60 次删除
  1. 0 1
      dist/package.sh
  2. 0 1
      index.html
  3. 0 1
      karma.conf.js
  4. 6 6
      package-lock.json
  5. 2 2
      package.json
  6. 4 0
      src/filters.ts
  7. 0 47
      src/types/autolinker.d.ts
  8. 1 1
      tests/filters.js
  9. 0 1
      tests/testsuite.html

+ 0 - 1
dist/package.sh

@@ -69,7 +69,6 @@ targets=(
     angular-material/angular-material.min.css
     croppie/croppie.min.js
     croppie/croppie.css
-    autolinker/dist/Autolinker.min.js
     @uirouter/angularjs/release/angular-ui-router.min.js
     messageformat/messageformat.min.js
     angular-translate/dist/angular-translate.min.js

+ 0 - 1
index.html

@@ -128,7 +128,6 @@
     <script src="node_modules/@saltyrtc/task-webrtc/dist/saltyrtc-task-webrtc.es5.js?v=[[VERSION]]"></script>
     <script src="node_modules/@saltyrtc/task-relayed-data/dist/saltyrtc-task-relayed-data.es5.js?v=[[VERSION]]"></script>
     <script src="node_modules/croppie/croppie.min.js?v=[[VERSION]]"></script>
-    <script src="node_modules/autolinker/dist/Autolinker.min.js?v=[[VERSION]]"></script>
 
     <!-- App -->
     <script src="dist/app.js?v=[[VERSION]]"></script>

+ 0 - 1
karma.conf.js

@@ -10,7 +10,6 @@ module.exports = function(config) {
             'node_modules/angular-animate/angular-animate.min.js',
             'node_modules/angular-material/angular-material.min.js',
             'node_modules/@saltyrtc/chunked-dc/dist/chunked-dc.es5.js',
-            'node_modules/autolinker/dist/Autolinker.min.js',
             'dist/app.js',
             'dist/ts-tests.js',
             'tests/filters.js',

+ 6 - 6
package-lock.json

@@ -1223,9 +1223,9 @@
       "dev": true
     },
     "autolinker": {
-      "version": "1.6.2",
-      "resolved": "https://registry.npmjs.org/autolinker/-/autolinker-1.6.2.tgz",
-      "integrity": "sha512-IKLGtYFb3jzGTtgCpb4bm//1sXmmmgmr0msKshhYoc7EsWmLCFvuyxLcEIfcZ5gbCgZGXrnXkOkcBblOFEnlog=="
+      "version": "2.2.1",
+      "resolved": "https://registry.npmjs.org/autolinker/-/autolinker-2.2.1.tgz",
+      "integrity": "sha512-X38t+F+NE5t4MefPXqzaMjzHmGk0NAgNwQLBS9tQ46kEvY/KaGd4jt5P3M+4SpMp3gwfRmOSEhbtMNJLgRmXbQ=="
     },
     "aws-sign2": {
       "version": "0.7.0",
@@ -7233,9 +7233,9 @@
       }
     },
     "sdp": {
-      "version": "2.7.4",
-      "resolved": "https://registry.npmjs.org/sdp/-/sdp-2.7.4.tgz",
-      "integrity": "sha512-0+wTfgvUUEGcvvFoHIC0aiGbx6gzwAUm8FkKt5Oqqkjf9mEEDLgwnoDKX7MYTGXrNNwzikVbutJ+OVNAGmJBQw=="
+      "version": "2.9.0",
+      "resolved": "https://registry.npmjs.org/sdp/-/sdp-2.9.0.tgz",
+      "integrity": "sha512-XAVZQO4qsfzVTHorF49zCpkdxiGmPNjA8ps8RcJGtGP3QJ/A8I9/SVg/QnkAFDMXIyGbHZBBFwYBw6WdnhT96w=="
     },
     "selenium-webdriver": {
       "version": "4.0.0-alpha.1",

+ 2 - 2
package.json

@@ -56,7 +56,7 @@
     "angular-sanitize": "^1.7.5",
     "angular-translate": "~2.18",
     "angularjs-scroll-glue": "~2.1.0",
-    "autolinker": "~1.6.2",
+    "autolinker": "~2.2.1",
     "babelify": "~10.0.0",
     "browserify": "^16.2.3",
     "browserify-header": "^1.0.0",
@@ -65,7 +65,7 @@
     "messageformat": "^2.0.5",
     "msgpack-lite": "~0.1.26",
     "node-sass": "^4.11.0",
-    "sdp": "~2.7.0",
+    "sdp": "~2.9.0",
     "ts-events": "^3.1.5",
     "tsify": "^4.0.1",
     "tweetnacl": "^1.0.0",

+ 4 - 0
src/filters.ts

@@ -15,6 +15,8 @@
  * along with Threema Web. If not, see <http://www.gnu.org/licenses/>.
  */
 
+import Autolinker from 'autolinker';
+
 import {bufferToUrl, escapeRegExp, filter, hasValue, logAdapter} from './helpers';
 import {markify} from './markup_parser';
 import {MimeService} from './services/mime';
@@ -76,6 +78,8 @@ angular.module('3ema.filters', [])
         newWindow: true,
         // Don't strip protocol prefix
         stripPrefix: false,
+        // Don't strip trailing slashes
+        stripTrailingSlash: false,
         // Don't truncate links
         truncate: 99999,
         // Add class name to linked links

+ 0 - 47
src/types/autolinker.d.ts

@@ -1,47 +0,0 @@
-// Type definitions for autolinker v0.24.0
-// Project: https://github.com/gregjacobs/Autolinker.js
-// Definitions by: Leon Yu <https://github.com/leonyu>
-// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-
-declare namespace __Autolinker {
-  interface ConfigOptions {
-    className?: string;
-    email?: boolean;
-    hashtag?: boolean | string;
-    newWindow?: boolean;
-    phone?: boolean;
-    replaceFn?: (match: any) => string;
-    stripPrefix?: boolean;
-    stripTrailingSlash?: boolean;
-    truncate?: number | { length?: number; location?: string; };
-    mention?: 'twitter' | 'instagram' | false;
-    decodePercentEncoding?: boolean;
-    urls?: boolean | { schemeMatches: boolean; wwwMatches: boolean; tldMatches: boolean; };
-  }
-
-  interface Autolinker {
-    getTagBuilder(): any;
-    /**
-     * Automatically links URLs, Email addresses, Phone numbers, Twitter handles, and Hashtags found in the given chunk of HTML. Does not link URLs found within HTML tags.
-     */
-    link(textOrHtml: string): string;
-    /**
-     * Parses the input textOrHtml looking for URLs, email addresses, phone numbers, username handles, and hashtags (depending on the configuration of the Autolinker instance), and returns an array of Autolinker.match.Match objects describing those matches.
-     */
-    parse(textOrHtml: string): any[];
-  }
-
-  interface Static {
-    new(cfg?: ConfigOptions): Autolinker;
-    /**
-     * Automatically links URLs, Email addresses, Phone Numbers, Twitter handles, and Hashtags found in the given chunk of HTML. Does not link URLs found within HTML tags.
-     */
-    link(textOrHtml: string, options?: ConfigOptions): string
-  }
-}
-
-declare var Autolinker: __Autolinker.Static;
-
-declare module "autolinker" {
-  export = Autolinker;
-}

+ 1 - 1
tests/filters.js

@@ -258,7 +258,7 @@ describe('Filters', function() {
 
         it('links http urls', () => {
             expect(process('hello https://threema.ch/!'))
-                .toEqual('hello <a href="https://threema.ch/" class="autolinked autolinked-url" target="_blank" rel="noopener noreferrer">https://threema.ch</a>!');
+                .toEqual('hello <a href="https://threema.ch/" class="autolinked autolinked-url" target="_blank" rel="noopener noreferrer">https://threema.ch/</a>!');
         });
 
         it('links e-mails', () => {

+ 0 - 1
tests/testsuite.html

@@ -17,7 +17,6 @@
         <script src="../node_modules/angular-material/angular-material.min.js"></script>
         <script src="../node_modules/angular-animate/angular-animate.min.js"></script>
         <script src="../node_modules/angular-aria/angular-aria.min.js"></script>
-        <script src="../node_modules/autolinker/dist/Autolinker.min.js"></script>
 
         <script src="../node_modules/@saltyrtc/chunked-dc/dist/chunked-dc.es5.js"></script>