mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-04 06:57:03 +03:00
Cleanup links
This commit is contained in:
parent
6a92912a3d
commit
32c3f1f059
8 changed files with 25 additions and 133 deletions
|
|
@ -61,42 +61,6 @@ export function attachmentDownload(download, customSpecSuffix) {
|
||||||
return serverRequestRaw('Download', download, customSpecSuffix);
|
return serverRequestRaw('Download', download, customSpecSuffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} download
|
|
||||||
* @param {string=} customSpecSuffix
|
|
||||||
* @returns {string}
|
|
||||||
*/
|
|
||||||
export function attachmentPreview(download, customSpecSuffix) {
|
|
||||||
return serverRequestRaw('View', download, customSpecSuffix);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} download
|
|
||||||
* @param {string=} customSpecSuffix
|
|
||||||
* @returns {string}
|
|
||||||
*/
|
|
||||||
export function attachmentThumbnailPreview(download, customSpecSuffix) {
|
|
||||||
return serverRequestRaw('ViewThumbnail', download, customSpecSuffix);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} download
|
|
||||||
* @param {string=} customSpecSuffix
|
|
||||||
* @returns {string}
|
|
||||||
*/
|
|
||||||
export function attachmentPreviewAsPlain(download, customSpecSuffix) {
|
|
||||||
return serverRequestRaw('ViewAsPlain', download, customSpecSuffix);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} download
|
|
||||||
* @param {string=} customSpecSuffix
|
|
||||||
* @returns {string}
|
|
||||||
*/
|
|
||||||
export function attachmentFramed(download, customSpecSuffix) {
|
|
||||||
return serverRequestRaw('FramedView', download, customSpecSuffix);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} type
|
* @param {string} type
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
|
|
@ -105,34 +69,6 @@ export function serverRequest(type) {
|
||||||
return SERVER_PREFIX + '/' + type + '/' + SUB_QUERY_PREFIX + '/' + getHash() + '/';
|
return SERVER_PREFIX + '/' + type + '/' + SUB_QUERY_PREFIX + '/' + getHash() + '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @returns {string}
|
|
||||||
*/
|
|
||||||
export function upload() {
|
|
||||||
return serverRequest('Upload');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @returns {string}
|
|
||||||
*/
|
|
||||||
export function uploadContacts() {
|
|
||||||
return serverRequest('UploadContacts');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @returns {string}
|
|
||||||
*/
|
|
||||||
export function uploadBackground() {
|
|
||||||
return serverRequest('UploadBackground');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @returns {string}
|
|
||||||
*/
|
|
||||||
export function append() {
|
|
||||||
return serverRequest('Append');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} email
|
* @param {string} email
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
|
|
@ -141,30 +77,6 @@ export function change(email) {
|
||||||
return serverRequest('Change') + encodeURIComponent(email) + '/';
|
return serverRequest('Change') + encodeURIComponent(email) + '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} requestHash
|
|
||||||
* @returns {string}
|
|
||||||
*/
|
|
||||||
export function messageViewLink(requestHash) {
|
|
||||||
return serverRequestRaw('ViewAsPlain', requestHash);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} requestHash
|
|
||||||
* @returns {string}
|
|
||||||
*/
|
|
||||||
export function messageDownloadLink(requestHash) {
|
|
||||||
return serverRequestRaw('Download', requestHash);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} hash
|
|
||||||
* @returns {string}
|
|
||||||
*/
|
|
||||||
export function publicLink(hash) {
|
|
||||||
return SERVER_PREFIX + '/Raw/0/Public/' + hash + '/';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} hash
|
* @param {string} hash
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
|
|
@ -182,20 +94,6 @@ export function langLink(lang, isAdmin) {
|
||||||
return SERVER_PREFIX + '/Lang/0/' + (isAdmin ? 'Admin' : 'App') + '/' + encodeURI(lang) + '/' + VERSION + '/';
|
return SERVER_PREFIX + '/Lang/0/' + (isAdmin ? 'Admin' : 'App') + '/' + encodeURI(lang) + '/' + VERSION + '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @returns {string}
|
|
||||||
*/
|
|
||||||
export function exportContactsVcf() {
|
|
||||||
return serverRequestRaw('ContactsVcf');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @returns {string}
|
|
||||||
*/
|
|
||||||
export function exportContactsCsv() {
|
|
||||||
return serverRequestRaw('ContactsCsv');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} path
|
* @param {string} path
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
|
|
@ -301,13 +199,11 @@ export function mailBox(folder, page = 1, search = '', threadUid = '') {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (1 < page) {
|
if (1 < page) {
|
||||||
result = result.replace(/[/]+$/, '');
|
result = result.replace(/[/]+$/, '') + '/p' + page;
|
||||||
result += '/p' + page;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (search) {
|
if (search) {
|
||||||
result = result.replace(/[/]+$/, '');
|
result = result.replace(/[/]+$/, '') + '/' + encodeURI(search);
|
||||||
result += '/' + encodeURI(search);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,7 @@ import ko from 'ko';
|
||||||
import { File, FileType } from 'Common/File';
|
import { File, FileType } from 'Common/File';
|
||||||
import {
|
import {
|
||||||
attachmentDownload,
|
attachmentDownload,
|
||||||
attachmentPreview,
|
serverRequestRaw
|
||||||
attachmentFramed,
|
|
||||||
attachmentPreviewAsPlain,
|
|
||||||
attachmentThumbnailPreview
|
|
||||||
} from 'Common/Links';
|
} from 'Common/Links';
|
||||||
|
|
||||||
import { AbstractModel } from 'Knoin/AbstractModel';
|
import { AbstractModel } from 'Knoin/AbstractModel';
|
||||||
|
|
@ -140,14 +137,14 @@ export class AttachmentModel extends AbstractModel {
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
linkPreview() {
|
linkPreview() {
|
||||||
return attachmentPreview(this.download);
|
return serverRequestRaw('View', this.download);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
linkThumbnail() {
|
linkThumbnail() {
|
||||||
return this.hasThumbnail() ? attachmentThumbnailPreview(this.download) : '';
|
return this.hasThumbnail() ? serverRequestRaw('ViewThumbnail', this.download) : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -158,18 +155,11 @@ export class AttachmentModel extends AbstractModel {
|
||||||
return link ? 'background:url(' + link + ')' : '';
|
return link ? 'background:url(' + link + ')' : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @returns {string}
|
|
||||||
*/
|
|
||||||
linkFramed() {
|
|
||||||
return attachmentFramed(this.download);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
linkPreviewAsPlain() {
|
linkPreviewAsPlain() {
|
||||||
return attachmentPreviewAsPlain(this.download);
|
return serverRequestRaw('ViewAsPlain', this.download);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import { i18n } from 'Common/Translator';
|
||||||
import { encodeHtml } from 'Common/Html';
|
import { encodeHtml } from 'Common/Html';
|
||||||
import { isArray } from 'Common/Utils';
|
import { isArray } from 'Common/Utils';
|
||||||
|
|
||||||
import { messageViewLink, messageDownloadLink } from 'Common/Links';
|
import { serverRequestRaw } from 'Common/Links';
|
||||||
|
|
||||||
import FolderStore from 'Stores/User/Folder';
|
import FolderStore from 'Stores/User/Folder';
|
||||||
|
|
||||||
|
|
@ -315,14 +315,14 @@ export class MessageModel extends AbstractModel {
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
viewLink() {
|
viewLink() {
|
||||||
return messageViewLink(this.requestHash);
|
return serverRequestRaw('ViewAsPlain', this.requestHash);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
downloadLink() {
|
downloadLink() {
|
||||||
return messageDownloadLink(this.requestHash);
|
return serverRequestRaw('Download', this.requestHash);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import { SUB_QUERY_PREFIX } from 'Common/Links';
|
||||||
|
|
||||||
import AppStore from 'Stores/User/App';
|
import AppStore from 'Stores/User/App';
|
||||||
import SettingsStore from 'Stores/User/Settings';
|
import SettingsStore from 'Stores/User/Settings';
|
||||||
|
//import FolderStore from 'Stores/User/Folder';
|
||||||
|
|
||||||
import { AbstractFetchRemote } from 'Remote/AbstractFetch';
|
import { AbstractFetchRemote } from 'Remote/AbstractFetch';
|
||||||
|
|
||||||
|
|
@ -770,6 +771,7 @@ class RemoteUserFetch extends AbstractFetchRemote {
|
||||||
this.defaultRequest(fCallback, 'ClearUserBackground');
|
this.defaultRequest(fCallback, 'ClearUserBackground');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FolderStore.foldersLoading
|
||||||
foldersReload(fTrigger) {
|
foldersReload(fTrigger) {
|
||||||
return this.abort('Folders')
|
return this.abort('Folders')
|
||||||
.postRequest('Folders', fTrigger)
|
.postRequest('Folders', fTrigger)
|
||||||
|
|
@ -780,6 +782,7 @@ class RemoteUserFetch extends AbstractFetchRemote {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FolderStore.foldersLoading
|
||||||
foldersReloadWithTimeout(fTrigger) {
|
foldersReloadWithTimeout(fTrigger) {
|
||||||
this.setTrigger(fTrigger, true);
|
this.setTrigger(fTrigger, true);
|
||||||
|
|
||||||
|
|
@ -787,12 +790,14 @@ class RemoteUserFetch extends AbstractFetchRemote {
|
||||||
this.foldersTimeout = setTimeout(() => this.foldersReload(fTrigger), 500);
|
this.foldersTimeout = setTimeout(() => this.foldersReload(fTrigger), 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FolderStore.foldersDeleting
|
||||||
folderDelete(sFolderFullNameRaw, fTrigger) {
|
folderDelete(sFolderFullNameRaw, fTrigger) {
|
||||||
return this.postRequest('FolderDelete', fTrigger, {
|
return this.postRequest('FolderDelete', fTrigger, {
|
||||||
Folder: sFolderFullNameRaw
|
Folder: sFolderFullNameRaw
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FolderStore.foldersCreating
|
||||||
folderCreate(sNewFolderName, sParentName, fTrigger) {
|
folderCreate(sNewFolderName, sParentName, fTrigger) {
|
||||||
return this.postRequest('FolderCreate', fTrigger, {
|
return this.postRequest('FolderCreate', fTrigger, {
|
||||||
Folder: sNewFolderName,
|
Folder: sNewFolderName,
|
||||||
|
|
@ -800,6 +805,7 @@ class RemoteUserFetch extends AbstractFetchRemote {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FolderStore.foldersRenaming
|
||||||
folderRename(sPrevFolderFullNameRaw, sNewFolderName, fTrigger) {
|
folderRename(sPrevFolderFullNameRaw, sNewFolderName, fTrigger) {
|
||||||
return this.postRequest('FolderRename', fTrigger, {
|
return this.postRequest('FolderRename', fTrigger, {
|
||||||
Folder: sPrevFolderFullNameRaw,
|
Folder: sPrevFolderFullNameRaw,
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import ko from 'ko';
|
||||||
|
|
||||||
import { SaveSettingsStep, UploadErrorCode, Capa } from 'Common/Enums';
|
import { SaveSettingsStep, UploadErrorCode, Capa } from 'Common/Enums';
|
||||||
import { changeTheme, convertThemeName } from 'Common/Utils';
|
import { changeTheme, convertThemeName } from 'Common/Utils';
|
||||||
import { userBackground, themePreviewLink, uploadBackground } from 'Common/Links';
|
import { userBackground, themePreviewLink, serverRequest } from 'Common/Links';
|
||||||
import { i18n } from 'Common/Translator';
|
import { i18n } from 'Common/Translator';
|
||||||
import { doc, $htmlCL } from 'Common/Globals';
|
import { doc, $htmlCL } from 'Common/Globals';
|
||||||
|
|
||||||
|
|
@ -81,7 +81,7 @@ export class ThemesUserSettings {
|
||||||
initUploader() {
|
initUploader() {
|
||||||
if (this.background.uploaderButton() && this.capaUserBackground()) {
|
if (this.background.uploaderButton() && this.capaUserBackground()) {
|
||||||
const oJua = new Jua({
|
const oJua = new Jua({
|
||||||
action: uploadBackground(),
|
action: serverRequest('UploadBackground'),
|
||||||
name: 'uploader',
|
name: 'uploader',
|
||||||
queueSize: 1,
|
queueSize: 1,
|
||||||
multipleSizeLimit: 1,
|
multipleSizeLimit: 1,
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ import { delegateRunOnDestroy } from 'Common/UtilsUser';
|
||||||
import { encodeHtml, HtmlEditor } from 'Common/Html';
|
import { encodeHtml, HtmlEditor } from 'Common/Html';
|
||||||
|
|
||||||
import { UNUSED_OPTION_VALUE } from 'Common/Consts';
|
import { UNUSED_OPTION_VALUE } from 'Common/Consts';
|
||||||
import { upload } from 'Common/Links';
|
import { serverRequest } from 'Common/Links';
|
||||||
import { i18n, getNotification, getUploadErrorDescByCode } from 'Common/Translator';
|
import { i18n, getNotification, getUploadErrorDescByCode } from 'Common/Translator';
|
||||||
import { timestampToString } from 'Common/Momentor';
|
import { timestampToString } from 'Common/Momentor';
|
||||||
import { MessageFlagsCache, setFolderHash } from 'Common/Cache';
|
import { MessageFlagsCache, setFolderHash } from 'Common/Cache';
|
||||||
|
|
@ -1202,7 +1202,7 @@ class ComposePopupView extends AbstractViewPopup {
|
||||||
const uploadCache = {},
|
const uploadCache = {},
|
||||||
attachmentSizeLimit = pInt(Settings.get('AttachmentLimit')),
|
attachmentSizeLimit = pInt(Settings.get('AttachmentLimit')),
|
||||||
oJua = new Jua({
|
oJua = new Jua({
|
||||||
action: upload(),
|
action: serverRequest('Upload'),
|
||||||
name: 'uploader',
|
name: 'uploader',
|
||||||
queueSize: 2,
|
queueSize: 2,
|
||||||
multipleSizeLimit: 50,
|
multipleSizeLimit: 50,
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ import { pInt } from 'Common/Utils';
|
||||||
import { delegateRunOnDestroy, computedPaginatorHelper } from 'Common/UtilsUser';
|
import { delegateRunOnDestroy, computedPaginatorHelper } from 'Common/UtilsUser';
|
||||||
|
|
||||||
import { Selector } from 'Common/Selector';
|
import { Selector } from 'Common/Selector';
|
||||||
import { exportContactsVcf, exportContactsCsv, uploadContacts } from 'Common/Links';
|
import { serverRequestRaw, serverRequest } from 'Common/Links';
|
||||||
import { i18n, getNotification } from 'Common/Translator';
|
import { i18n, getNotification } from 'Common/Translator';
|
||||||
|
|
||||||
import SettingsStore from 'Stores/User/Settings';
|
import SettingsStore from 'Stores/User/Settings';
|
||||||
|
|
@ -352,17 +352,17 @@ class ContactsPopupView extends AbstractViewPopup {
|
||||||
}
|
}
|
||||||
|
|
||||||
exportVcf() {
|
exportVcf() {
|
||||||
rl.app.download(exportContactsVcf());
|
rl.app.download(serverRequestRaw('ContactsVcf'));
|
||||||
}
|
}
|
||||||
|
|
||||||
exportCsv() {
|
exportCsv() {
|
||||||
rl.app.download(exportContactsCsv());
|
rl.app.download(serverRequestRaw('ContactsCsv'));
|
||||||
}
|
}
|
||||||
|
|
||||||
initUploader() {
|
initUploader() {
|
||||||
if (this.importUploaderButton()) {
|
if (this.importUploaderButton()) {
|
||||||
const j = new Jua({
|
const j = new Jua({
|
||||||
action: uploadContacts(),
|
action: serverRequest('UploadContacts'),
|
||||||
name: 'uploader',
|
name: 'uploader',
|
||||||
queueSize: 1,
|
queueSize: 1,
|
||||||
multipleSizeLimit: 1,
|
multipleSizeLimit: 1,
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ import { doc, leftPanelDisabled, moveAction, Settings } from 'Common/Globals';
|
||||||
import { computedPaginatorHelper } from 'Common/UtilsUser';
|
import { computedPaginatorHelper } from 'Common/UtilsUser';
|
||||||
import { File } from 'Common/File';
|
import { File } from 'Common/File';
|
||||||
|
|
||||||
import { mailBox, append } from 'Common/Links';
|
import { mailBox, serverRequest } from 'Common/Links';
|
||||||
import { Selector } from 'Common/Selector';
|
import { Selector } from 'Common/Selector';
|
||||||
|
|
||||||
import { i18n, initOnStartOrLangChange } from 'Common/Translator';
|
import { i18n, initOnStartOrLangChange } from 'Common/Translator';
|
||||||
|
|
@ -907,7 +907,7 @@ class MessageListMailBoxUserView extends AbstractViewRight {
|
||||||
}
|
}
|
||||||
|
|
||||||
const oJua = new Jua({
|
const oJua = new Jua({
|
||||||
action: append(),
|
action: serverRequest('Append'),
|
||||||
name: 'AppendFile',
|
name: 'AppendFile',
|
||||||
queueSize: 1,
|
queueSize: 1,
|
||||||
multipleSizeLimit: 1,
|
multipleSizeLimit: 1,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue