Commit Graph

38 Commits

Author SHA1 Message Date
Pavel Djundik
881b3eda19 Run format after updating to prettier 2.0 2020-03-21 22:55:36 +02:00
Pavel Djundik
1b2894bf99 Fix increasing test timeout on github actions 2020-02-09 14:21:45 +02:00
Pavel Djundik
d2932ccea8 Correctly track user toggle of previews 2019-12-23 12:26:57 +02:00
Pavel Djundik
769585e72d Collapse prefetch errors by default 2019-12-23 12:15:23 +02:00
Pavel Djundik
72a954b865 Add preview for text/plain urls 2019-12-19 15:12:02 +02:00
Pavel Djundik
8b7fb33627 Increase test timeout due to unpredictable I/O on CI services 2019-11-27 20:25:29 +02:00
Raqbit
95cc9a47fb Add file size to link preview 2019-11-07 16:58:28 +01:00
Pavel Djundik
390a0b8e83 Let OS generate a port in link prefetch tests 2019-10-04 14:19:04 +03:00
Alistair McKinlay
133e7bf710 Format js/vue with prettier 2019-07-19 11:27:40 +01:00
Pavel Djundik
54a4085b68 Store ip and language in a separate object in user file 2019-07-16 13:00:29 +03:00
Pavel Djundik
11bd2dfa4c Increase delay between links to remove random test failure 2018-07-06 12:29:21 +03:00
Pavel Djundik
0d48c596c8 Fix multiple <title> tags being concatenated 2018-06-11 11:32:32 +03:00
Pavel Djundik
4e2523060b De-duplicate link fetching to one request at once 2018-06-11 10:38:03 +03:00
Ben Harris
d2987d037c use http for protocol-less URLs 2018-06-09 13:46:46 -04:00
Pavel Djundik
97dfdbf7c0 Default to https: for urls with no scheme 2018-05-23 16:50:59 +03:00
Pavel Djundik
d4fa6bbcb0 Use WHATWG URL parser in link prefetcher 2018-05-23 16:31:02 +03:00
Pavel Djundik
629ae8bfa4 Fix protocol-aware urls, add better link validation in previews 2018-05-23 16:31:02 +03:00
Jérémie Astori
1daad45f11
Use the new logo for favicons, notifications badges, and homescreen app icons 2018-04-28 12:14:41 -04:00
Pavel Djundik
ca96d09a23 Send Accept header
Closes #2277
2018-03-23 20:17:03 +02:00
Pavel Djundik
351a203acd Fix some URLs not being sent as-is to the client 2018-03-13 22:08:19 +02:00
Jérémie Astori
5e6e27d73f
Ignore order of preview results in unicode link tests 2018-03-08 21:01:57 -05:00
Pavel Djundik
f475cc39ef Normalize unicode URLs in link prefetcher
Fixes #1644
2018-03-08 19:43:39 +02:00
William Boman
acb6179b30 relay client's preferred language in link preview requests
Closes #1440.
2018-02-21 10:35:33 +01:00
Jérémie Astori
c2243ed7b4
Remove dead code in tests, and fix a link test
I used `npm run coverage` while *not* excluding the test folder to detect dead code in our test folder, it is actually pretty useful to do so (as a one-shot, not to do that in our config).
Only remaining unreached path is L40 in `test/plugins/auth/ldap.js`, but it does seem to me that it might be useful in case of failures, so I preferred to leave it there.
2017-12-09 18:56:05 -05:00
Jérémie Astori
624b3ebc18
Mark slow tests as such to reduce noise on test report 2017-11-27 18:47:19 -05:00
Jérémie Astori
1dc92d8934
Enforce dangling commas with ESLint
¯\_(ツ)_/¯
2017-11-15 01:35:15 -05:00
Pavel Djundik
66ea26f4bd Resolve relative URIs in link previewer
Also adds support for image_src links
2017-08-13 13:06:01 +03:00
Jérémie Astori
157289258a
Keep track of preview visibility on the server so it persists at page reload 2017-07-26 18:16:50 -04:00
Jérémie Astori
900d41bf47
Re-use .previews to order incoming previews instead of extra links 2017-07-21 01:51:51 -04:00
Jérémie Astori
a13c08a45b
Enforce correct order for previews on server-side prefectch rather than at client parsing
This has the benefit of not adding `.preview` divs everywhere, anytime we use `parse()`, and also to un-tie the position of the preview blocks from the result of the helper. This means that templates that call `parse` and have some extra markup after that are not constrained anymore.

This is effectively an alternative, better way to fix https://github.com/thelounge/lounge/issues/1343, but the initial fix that was put in place (https://github.com/thelounge/lounge/pull/1347) is still relevant, for example to make sure a preview stays hidden (and does not add extra margin/padding/etc.) if the link does not prefetch.
2017-07-21 01:06:42 -04:00
Pavel Djundik
f35a2809a7 Store preview images on disk for privacy, security and caching 2017-07-18 11:37:16 +03:00
Jérémie Astori
64ebe0f437
Support multiple previews per message
- Load up to 5 previews per message (to avoid abuse)
- Do not load multiple times the same URL
- Prepare preview containers per message instead of appending (to maintain correct order)
- Store an array of previews instead of a single preview in `Msg` objects
- Consolidate preview rendering for new messages and upon refresh/load history (when rendering entire channels)
- Update `parse` tests to reflect previous point
- Add test for multiple URLs
- Switch preview tests from `assert` API to `expect` API
2017-07-08 04:34:12 -04:00
Pavel Djundik
14b2ad7938 Refactor link previews 2017-07-03 00:41:18 +03:00
Pavel Djundik
f6dd616d5e Update to eslint 4 and enforce extra rules 2017-06-19 09:58:29 +03:00
Pavel Djundik
62d4cd8fe8 Use correct channel when pushing link prefetch messages
Fixes #781
2016-12-09 23:00:33 +02:00
Jérémie Astori
caa46042bf Enforce strict mode across all JS files with ESLint
Several ES6 additions are only available in strict mode. Example:
> SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode

Strict mode was also enabled in a few of our files already, and it is a good thing to have anyway.
2016-10-09 15:14:02 -04:00
William Boman
8fdfd70c7e Comply with ESLint 2015-10-26 03:01:47 +01:00
Riku Rouvila
a9026ac8a5 add basic environment for unit testing with mocha 2014-11-17 22:14:28 +02:00