removed old fileserver support

This commit is contained in:
Audric Ackermann 2021-10-20 14:18:57 +11:00
parent 906e9f5644
commit 5c7615d205
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4
6 changed files with 11 additions and 28 deletions

View File

@ -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<SettingsViewProps, State> {
};
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() {

View File

@ -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<string, any>;
headers?: Record<string, string>;
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<ArrayBuffer | null> => {
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') {

View File

@ -59,7 +59,7 @@ const getDestinationPubKey = async (
}
} else {
// this is a fileServer call
return request.isOldV2server ? FSv2.oldFileServerV2PubKey : FSv2.fileServerV2PubKey;
return FSv2.fileServerV2PubKey;
}
};

View File

@ -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}`

View File

@ -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));

View File

@ -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.