Compare commits
7 Commits
d4e1423cf7
...
55fd5d3f09
Author | SHA1 | Date |
---|---|---|
Audric Ackermann | 55fd5d3f09 | |
Audric Ackermann | 97dbe5b652 | |
Audric Ackermann | ee8ec7b0f8 | |
Audric Ackermann | d0cf3169e8 | |
Audric Ackermann | 9c4eee8a15 | |
Audric Ackermann | 29185c1aa8 | |
Audric Ackermann | 1b73112294 |
|
@ -8,6 +8,10 @@ runs:
|
|||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Cache Desktop node_modules
|
||||
id: cache-desktop-modules
|
||||
uses: actions/cache@v3
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"name": "session-desktop",
|
||||
"productName": "Session",
|
||||
"description": "Private messaging from your desktop",
|
||||
"version": "1.11.4",
|
||||
"version": "1.11.5",
|
||||
"license": "GPL-3.0",
|
||||
"author": {
|
||||
"name": "Oxen Labs",
|
||||
|
@ -77,7 +77,7 @@
|
|||
"auto-bind": "^4.0.0",
|
||||
"backbone": "1.3.3",
|
||||
"blob-util": "2.0.2",
|
||||
"blueimp-load-image": "5.14.0",
|
||||
"blueimp-load-image": "^5.16.0",
|
||||
"buffer-crc32": "0.2.13",
|
||||
"bunyan": "^1.8.15",
|
||||
"bytebuffer": "^5.0.1",
|
||||
|
@ -138,7 +138,7 @@
|
|||
"@commitlint/types": "^17.4.4",
|
||||
"@electron/notarize": "^2.1.0",
|
||||
"@types/backbone": "1.4.2",
|
||||
"@types/blueimp-load-image": "5.14.4",
|
||||
"@types/blueimp-load-image": "^5.16.2",
|
||||
"@types/buffer-crc32": "^0.2.0",
|
||||
"@types/bunyan": "^1.8.8",
|
||||
"@types/bytebuffer": "^5.0.41",
|
||||
|
|
|
@ -5,34 +5,34 @@ import { v4 as uuidv4 } from 'uuid';
|
|||
|
||||
import { MessageUtils, ToastUtils, UserUtils } from '..';
|
||||
import { SignalService } from '../../../protobuf';
|
||||
import { openConversationWithMessages } from '../../../state/ducks/conversations';
|
||||
import {
|
||||
CallStatusEnum,
|
||||
answerCall,
|
||||
callConnected,
|
||||
callReconnecting,
|
||||
CallStatusEnum,
|
||||
endCall,
|
||||
incomingCall,
|
||||
setFullScreenCall,
|
||||
startingCallWith,
|
||||
} from '../../../state/ducks/call';
|
||||
import { openConversationWithMessages } from '../../../state/ducks/conversations';
|
||||
import { getConversationController } from '../../conversations';
|
||||
import { CallMessage } from '../../messages/outgoing/controlMessage/CallMessage';
|
||||
import { ed25519Str } from '../../onions/onionPath';
|
||||
import { PubKey } from '../../types';
|
||||
|
||||
import { getIsRinging } from '../RingingManager';
|
||||
import { getBlackSilenceMediaStream } from './Silence';
|
||||
import { getMessageQueue } from '../..';
|
||||
import { MessageSender } from '../../sending';
|
||||
import { DURATION } from '../../constants';
|
||||
import { Data } from '../../../data/data';
|
||||
import { getCallMediaPermissionsSettings } from '../../../components/settings/SessionSettings';
|
||||
import { PnServer } from '../../apis/push_notification_api';
|
||||
import { Data } from '../../../data/data';
|
||||
import { approveConvoAndSendResponse } from '../../../interactions/conversationInteractions';
|
||||
import { READ_MESSAGE_STATE } from '../../../models/conversationAttributes';
|
||||
import { PnServer } from '../../apis/push_notification_api';
|
||||
import { GetNetworkTime } from '../../apis/snode_api/getNetworkTime';
|
||||
import { SnodeNamespaces } from '../../apis/snode_api/namespaces';
|
||||
import { READ_MESSAGE_STATE } from '../../../models/conversationAttributes';
|
||||
import { DURATION } from '../../constants';
|
||||
import { MessageSender } from '../../sending';
|
||||
import { getIsRinging } from '../RingingManager';
|
||||
import { getBlackSilenceMediaStream } from './Silence';
|
||||
|
||||
export type InputItem = { deviceId: string; label: string };
|
||||
|
||||
|
@ -137,16 +137,17 @@ const iceServersFullArray = [
|
|||
username: 'session202111',
|
||||
credential: '053c268164bc7bd7',
|
||||
},
|
||||
{
|
||||
urls: 'turn:fenrir.getsession.org',
|
||||
username: 'session202111',
|
||||
credential: '053c268164bc7bd7',
|
||||
},
|
||||
{
|
||||
urls: 'turn:frigg.getsession.org',
|
||||
username: 'session202111',
|
||||
credential: '053c268164bc7bd7',
|
||||
},
|
||||
// excluding those two (fenrir & frigg) as they are TCP only for now
|
||||
// {
|
||||
// urls: 'turn:fenrir.getsession.org',
|
||||
// username: 'session202111',
|
||||
// credential: '053c268164bc7bd7',
|
||||
// },
|
||||
// {
|
||||
// urls: 'turn:frigg.getsession.org',
|
||||
// username: 'session202111',
|
||||
// credential: '053c268164bc7bd7',
|
||||
// },
|
||||
{
|
||||
urls: 'turn:angus.getsession.org',
|
||||
username: 'session202111',
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import imageType from 'image-type';
|
||||
|
||||
import { arrayBufferToBlob } from 'blob-util';
|
||||
import loadImage, { LoadImageOptions } from 'blueimp-load-image';
|
||||
import loadImage from 'blueimp-load-image';
|
||||
import { StagedAttachmentType } from '../components/conversation/composition/CompositionBox';
|
||||
import { SignalService } from '../protobuf';
|
||||
import { getDecryptedMediaUrl } from '../session/crypto/DecryptedAttachmentsManager';
|
||||
|
@ -189,28 +189,32 @@ export async function autoScale<T extends { contentType: string; blob: Blob }>(
|
|||
throw new Error(`GIF is too large, required size is ${maxSize}`);
|
||||
}
|
||||
|
||||
const loadImgOpts: LoadImageOptions = {
|
||||
maxWidth: makeSquare ? maxMeasurements?.maxSide : maxWidth,
|
||||
maxHeight: makeSquare ? maxMeasurements?.maxSide : maxHeight,
|
||||
crop: !!makeSquare,
|
||||
orientation: 1,
|
||||
aspectRatio: makeSquare ? 1 : undefined,
|
||||
canvas: true,
|
||||
imageSmoothingQuality: 'medium',
|
||||
};
|
||||
|
||||
perfStart(`loadimage-*${blob.size}`);
|
||||
const canvas = await loadImage(blob, loadImgOpts);
|
||||
const canvasLoad = await loadImage(blob, {});
|
||||
const canvasScaled = loadImage.scale(
|
||||
canvasLoad.image, // img or canvas element
|
||||
{
|
||||
maxWidth: makeSquare ? maxMeasurements?.maxSide : maxWidth,
|
||||
maxHeight: makeSquare ? maxMeasurements?.maxSide : maxHeight,
|
||||
crop: !!makeSquare,
|
||||
cover: !!makeSquare,
|
||||
orientation: 1,
|
||||
// aspectRatio: makeSquare ? 1 : undefined,
|
||||
canvas: true,
|
||||
imageSmoothingQuality: 'medium',
|
||||
meta: false,
|
||||
}
|
||||
);
|
||||
perfEnd(`loadimage-*${blob.size}`, `loadimage-*${blob.size}`);
|
||||
if (!canvas || !canvas.originalWidth || !canvas.originalHeight) {
|
||||
if (!canvasScaled || !canvasScaled.width || !canvasScaled.height) {
|
||||
throw new Error('failed to scale image');
|
||||
}
|
||||
|
||||
let readAndResizedBlob = blob;
|
||||
|
||||
if (
|
||||
canvas.originalWidth <= maxWidth &&
|
||||
canvas.originalHeight <= maxHeight &&
|
||||
canvasScaled.width <= maxWidth &&
|
||||
canvasScaled.height <= maxHeight &&
|
||||
blob.size <= maxSize &&
|
||||
!makeSquare
|
||||
) {
|
||||
|
@ -218,15 +222,15 @@ export async function autoScale<T extends { contentType: string; blob: Blob }>(
|
|||
// so we have to return those measures as the loaded file has now those measures.
|
||||
return {
|
||||
...attachment,
|
||||
width: canvas.image.width,
|
||||
height: canvas.image.height,
|
||||
width: canvasScaled.width,
|
||||
height: canvasScaled.height,
|
||||
blob,
|
||||
};
|
||||
}
|
||||
if (DEBUG_ATTACHMENTS_SCALE) {
|
||||
window.log.debug('canvas.originalWidth', {
|
||||
canvasOriginalWidth: canvas.originalWidth,
|
||||
canvasOriginalHeight: canvas.originalHeight,
|
||||
window.log.info('canvasOri.originalWidth', {
|
||||
canvasOriginalWidth: canvasScaled.width,
|
||||
canvasOriginalHeight: canvasScaled.height,
|
||||
maxWidth,
|
||||
maxHeight,
|
||||
blobsize: blob.size,
|
||||
|
@ -240,10 +244,10 @@ export async function autoScale<T extends { contentType: string; blob: Blob }>(
|
|||
do {
|
||||
i -= 1;
|
||||
if (DEBUG_ATTACHMENTS_SCALE) {
|
||||
// window.log.info(`autoscale iteration: [${i}] for:`, attachment);
|
||||
window.log.info(`autoscale iteration: [${i}] for:`, JSON.stringify(readAndResizedBlob.size));
|
||||
}
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
const tempBlob = await canvasToBlob(canvas.image as HTMLCanvasElement, 'image/jpeg', quality);
|
||||
const tempBlob = await canvasToBlob(canvasScaled, 'image/jpeg', quality);
|
||||
|
||||
if (!tempBlob) {
|
||||
throw new Error('Failed to get blob during canvasToBlob.');
|
||||
|
@ -265,8 +269,8 @@ export async function autoScale<T extends { contentType: string; blob: Blob }>(
|
|||
contentType: attachment.contentType,
|
||||
blob: readAndResizedBlob,
|
||||
|
||||
width: canvas.image.width,
|
||||
height: canvas.image.height,
|
||||
width: canvasScaled.width,
|
||||
height: canvasScaled.height,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue