diff --git a/ts/components/session/settings/SessionSettings.tsx b/ts/components/session/settings/SessionSettings.tsx index 05db39c86..06fb472f6 100644 --- a/ts/components/session/settings/SessionSettings.tsx +++ b/ts/components/session/settings/SessionSettings.tsx @@ -22,6 +22,7 @@ import { sessionPassword, updateConfirmModal } from '../../../state/ducks/modalD import { PasswordAction } from '../../dialog/SessionPasswordDialog'; import { SessionIconButton } from '../icon'; import { ToastUtils } from '../../../session/utils'; +import autoBind from 'auto-bind'; export enum SessionSettingCategory { Appearance = 'appearance', @@ -81,12 +82,9 @@ class SettingsViewInner extends React.Component { }; this.settingsViewRef = React.createRef(); - this.onPasswordUpdated = this.onPasswordUpdated.bind(this); - this.validatePasswordLock = this.validatePasswordLock.bind(this); + autoBind(this); void this.hasPassword(); - - this.onKeyUp = this.onKeyUp.bind(this); } public componentDidMount() { diff --git a/ts/fileserver/FileServerApiV2.ts b/ts/fileserver/FileServerApiV2.ts index d8c921cc7..c842603f8 100644 --- a/ts/fileserver/FileServerApiV2.ts +++ b/ts/fileserver/FileServerApiV2.ts @@ -2,10 +2,6 @@ import { OpenGroupV2Request } from '../opengroup/opengroupV2/ApiUtil'; import { sendApiV2Request } from '../opengroup/opengroupV2/OpenGroupAPIV2'; import { parseStatusCodeFromOnionRequest } from '../opengroup/opengroupV2/OpenGroupAPIV2Parser'; -// tslint:disable-next-line: no-http-string -export const oldFileServerV2URL = 'http://88.99.175.227'; -export const oldFileServerV2PubKey = - '7cb31905b55cd5580c686911debf672577b3fb0bff81df4ce2d5c4cb3a7aaa69'; // tslint:disable-next-line: no-http-string export const fileServerV2URL = 'http://filev2.getsession.org'; @@ -18,7 +14,6 @@ export type FileServerV2Request = { // queryParams are used for post or get, but not the same way queryParams?: Record; headers?: Record; - isOldV2server?: boolean; // to remove in a few days }; const FILES_ENDPOINT = 'files'; @@ -73,8 +68,7 @@ export const uploadFileToFsV2 = async ( * @returns the data as an Uint8Array or null */ export const downloadFileFromFSv2 = async ( - fileIdOrCompleteUrl: string, - isOldV2server: boolean + fileIdOrCompleteUrl: string ): Promise => { let fileId = fileIdOrCompleteUrl; if (!fileIdOrCompleteUrl) { @@ -82,19 +76,15 @@ export const downloadFileFromFSv2 = async ( return null; } - const oldCompleteUrlPrefix = `${oldFileServerV2URL}/${FILES_ENDPOINT}/`; const newCompleteUrlPrefix = `${fileServerV2URL}/${FILES_ENDPOINT}/`; if (fileIdOrCompleteUrl.startsWith(newCompleteUrlPrefix)) { fileId = fileId.substr(newCompleteUrlPrefix.length); - } else if (fileIdOrCompleteUrl.startsWith(oldCompleteUrlPrefix)) { - fileId = fileId.substr(oldCompleteUrlPrefix.length); } const request: FileServerV2Request = { method: 'GET', endpoint: `${FILES_ENDPOINT}/${fileId}`, - isOldV2server, }; const result = await sendApiV2Request(request); @@ -132,11 +122,7 @@ export const buildUrl = (request: FileServerV2Request | OpenGroupV2Request): URL if (isOpenGroupV2Request(request)) { rawURL = `${request.server}/${request.endpoint}`; } else { - if (request.isOldV2server) { - rawURL = `${oldFileServerV2URL}/${request.endpoint}`; - } else { - rawURL = `${fileServerV2URL}/${request.endpoint}`; - } + rawURL = `${fileServerV2URL}/${request.endpoint}`; } if (request.method === 'GET') { diff --git a/ts/opengroup/opengroupV2/OpenGroupAPIV2.ts b/ts/opengroup/opengroupV2/OpenGroupAPIV2.ts index bc31cf2df..3beba553a 100644 --- a/ts/opengroup/opengroupV2/OpenGroupAPIV2.ts +++ b/ts/opengroup/opengroupV2/OpenGroupAPIV2.ts @@ -59,7 +59,7 @@ const getDestinationPubKey = async ( } } else { // this is a fileServer call - return request.isOldV2server ? FSv2.oldFileServerV2PubKey : FSv2.fileServerV2PubKey; + return FSv2.fileServerV2PubKey; } }; diff --git a/ts/receiver/attachments.ts b/ts/receiver/attachments.ts index b782bdc69..496839757 100644 --- a/ts/receiver/attachments.ts +++ b/ts/receiver/attachments.ts @@ -17,19 +17,18 @@ export async function downloadAttachment(attachment: any) { const serverUrl = asURL.origin; // is it an attachment hosted on the file server v2 ? - const defaultFsOldV2 = _.startsWith(serverUrl, FSv2.oldFileServerV2URL); const defaultFsV2 = _.startsWith(serverUrl, FSv2.fileServerV2URL); let res: ArrayBuffer | null = null; - if (defaultFsV2 || defaultFsOldV2) { + if (defaultFsV2) { let attachmentId = attachment.id; if (!attachmentId) { // try to get the fileId from the end of the URL attachmentId = attachment.url; } window?.log?.info('Download v2 file server attachment', attachmentId); - res = await FSv2.downloadFileFromFSv2(attachmentId, defaultFsOldV2); + res = await FSv2.downloadFileFromFSv2(attachmentId); } else { window.log.warn( `downloadAttachment attachment is neither opengroup attachment nor fsv2... Dropping it ${asURL.href}` diff --git a/ts/receiver/configMessage.ts b/ts/receiver/configMessage.ts index 63590efcc..2a862865a 100644 --- a/ts/receiver/configMessage.ts +++ b/ts/receiver/configMessage.ts @@ -119,9 +119,9 @@ async function handleGroupsAndContactsFromConfigMessage( toHex(c.publicKey), ConversationTypeEnum.PRIVATE ); - const profile = { + const profile: SignalService.DataMessage.ILokiProfile = { displayName: c.name, - profilePictre: c.profilePicture, + profilePicture: c.profilePicture, }; // updateProfile will do a commit for us contactConvo.set('active_at', _.toNumber(envelope.timestamp)); diff --git a/tsconfig.json b/tsconfig.json index c12ee0e45..10af61338 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -43,8 +43,8 @@ // "preserveSymlinks": true, // Do not resolve the real path of symlinks. // Source Map Options - // "sourceRoot": "./", // Specify the location where debugger should locate TypeScript files instead of source locations. - // "mapRoot": "./", // Specify the location where debugger should locate map files instead of generated locations. + // "sourceRoot": "./", // Specify the location where debugge should locate TypeScript files instead of source locations. + // "mapRoot": "./", // Specify the location where debugge should locate map files instead of generated locations. // "inlineSourceMap": true, // Emit a single file with source maps instead of having a separate file. // "inlineSources": true, // Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set.