Commit Graph

17 Commits

Author SHA1 Message Date
Daniel Gasienica
e0cc3d8fab Implement attachment process version
Instead of keeping track of last normalization (processing) date, we now keep track of
an internal processing version that will help us understand what kind of processing has
already been completed for a given attachment. This will let us retroactively upgrade
existing attachments.

As we add more processing steps, we can build a processing pipeline that can convert any
attachment processing version into a higher one, e.g. 4 -> 5 -> 6 -> 7.
2018-02-15 15:15:00 -05:00
Daniel Gasienica
ebcb70258a Whitelist browser environment for ESLint 2018-02-15 15:14:59 -05:00
Daniel Gasienica
3eaace6f3a Use MIME module 2018-02-15 15:14:59 -05:00
Daniel Gasienica
ba2cf7770e 🎨 Fix lint errors 2018-02-15 15:14:59 -05:00
Daniel Gasienica
65acc86e85 Add ES2015+ files to JSHint ignored list 2018-02-15 15:14:59 -05:00
Daniel Gasienica
213400e4b2 Add MIME type module 2018-02-15 15:14:59 -05:00
Daniel Gasienica
37a726e4fb Return proper Error from blobArrayToBuffer 2018-02-15 15:14:59 -05:00
Daniel Gasienica
164752db56 🎨 Fix ESLint errors 2018-02-15 15:14:59 -05:00
Daniel Gasienica
d498dd79a0 Update Attachment type field definitions 2018-02-15 15:14:59 -05:00
Daniel Gasienica
141155a153 Move blueimp-canvas-to-blob from Bower to npm 2018-02-15 15:14:59 -05:00
Daniel Gasienica
032c0ced46 Return Error object for autoOrientImage failures 2018-02-15 15:14:59 -05:00
Daniel Gasienica
ff04bad851 Add options for autoOrientImage output type / quality 2018-02-15 15:14:59 -05:00
Daniel Gasienica
87745b5586 Add Attachment type
Defines various functions on attachments, e.g. normalization (auto-orient JPEGs, etc.)
2018-02-15 15:14:59 -05:00
Daniel Gasienica
b5ba96f1e6 Use snake_case for module names
Prevents problems across case-sensitive and case-insensitive file systems.

We can work around this in the future using a lint rule such as
`eslint-plugin-require-path-exists`.
See discussion:
https://github.com/signalapp/Signal-Desktop/pull/2040#discussion_r167365931
2018-02-15 15:14:59 -05:00
Daniel Gasienica
d07433e3cf Make autoOrientImage module standalone 2018-02-15 15:14:59 -05:00
Daniel Gasienica
4431854923 Add autoOrientImage module
This module exposes `loadImage` with a `Promise` based interface and pre-
populates `orientation: true` option to auto-orient input. Returns data URL
as string.

The module uses a named export as refactoring references of modules with
`default` (`module.exports`) export references can be error-prone.
See: https://basarat.gitbooks.io/typescript/docs/tips/defaultIsBad.html
2018-02-15 15:14:59 -05:00
Daniel Gasienica
be5cbc9d2b Move ESLint environment configuration into .eslintrc (#2051) 2018-02-15 15:12:20 -05:00