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