mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-28 19:49:20 +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);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
* @returns {string}
|
||||
|
|
@ -105,34 +69,6 @@ export function serverRequest(type) {
|
|||
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
|
||||
* @returns {string}
|
||||
|
|
@ -141,30 +77,6 @@ export function change(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
|
||||
* @returns {string}
|
||||
|
|
@ -182,20 +94,6 @@ export function langLink(lang, isAdmin) {
|
|||
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
|
||||
* @returns {string}
|
||||
|
|
@ -301,13 +199,11 @@ export function mailBox(folder, page = 1, search = '', threadUid = '') {
|
|||
}
|
||||
|
||||
if (1 < page) {
|
||||
result = result.replace(/[/]+$/, '');
|
||||
result += '/p' + page;
|
||||
result = result.replace(/[/]+$/, '') + '/p' + page;
|
||||
}
|
||||
|
||||
if (search) {
|
||||
result = result.replace(/[/]+$/, '');
|
||||
result += '/' + encodeURI(search);
|
||||
result = result.replace(/[/]+$/, '') + '/' + encodeURI(search);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -3,10 +3,7 @@ import ko from 'ko';
|
|||
import { File, FileType } from 'Common/File';
|
||||
import {
|
||||
attachmentDownload,
|
||||
attachmentPreview,
|
||||
attachmentFramed,
|
||||
attachmentPreviewAsPlain,
|
||||
attachmentThumbnailPreview
|
||||
serverRequestRaw
|
||||
} from 'Common/Links';
|
||||
|
||||
import { AbstractModel } from 'Knoin/AbstractModel';
|
||||
|
|
@ -140,14 +137,14 @@ export class AttachmentModel extends AbstractModel {
|
|||
* @returns {string}
|
||||
*/
|
||||
linkPreview() {
|
||||
return attachmentPreview(this.download);
|
||||
return serverRequestRaw('View', this.download);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
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 + ')' : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
linkFramed() {
|
||||
return attachmentFramed(this.download);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
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 { isArray } from 'Common/Utils';
|
||||
|
||||
import { messageViewLink, messageDownloadLink } from 'Common/Links';
|
||||
import { serverRequestRaw } from 'Common/Links';
|
||||
|
||||
import FolderStore from 'Stores/User/Folder';
|
||||
|
||||
|
|
@ -315,14 +315,14 @@ export class MessageModel extends AbstractModel {
|
|||
* @returns {string}
|
||||
*/
|
||||
viewLink() {
|
||||
return messageViewLink(this.requestHash);
|
||||
return serverRequestRaw('ViewAsPlain', this.requestHash);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
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 SettingsStore from 'Stores/User/Settings';
|
||||
//import FolderStore from 'Stores/User/Folder';
|
||||
|
||||
import { AbstractFetchRemote } from 'Remote/AbstractFetch';
|
||||
|
||||
|
|
@ -770,6 +771,7 @@ class RemoteUserFetch extends AbstractFetchRemote {
|
|||
this.defaultRequest(fCallback, 'ClearUserBackground');
|
||||
}
|
||||
|
||||
// FolderStore.foldersLoading
|
||||
foldersReload(fTrigger) {
|
||||
return this.abort('Folders')
|
||||
.postRequest('Folders', fTrigger)
|
||||
|
|
@ -780,6 +782,7 @@ class RemoteUserFetch extends AbstractFetchRemote {
|
|||
});
|
||||
}
|
||||
|
||||
// FolderStore.foldersLoading
|
||||
foldersReloadWithTimeout(fTrigger) {
|
||||
this.setTrigger(fTrigger, true);
|
||||
|
||||
|
|
@ -787,12 +790,14 @@ class RemoteUserFetch extends AbstractFetchRemote {
|
|||
this.foldersTimeout = setTimeout(() => this.foldersReload(fTrigger), 500);
|
||||
}
|
||||
|
||||
// FolderStore.foldersDeleting
|
||||
folderDelete(sFolderFullNameRaw, fTrigger) {
|
||||
return this.postRequest('FolderDelete', fTrigger, {
|
||||
Folder: sFolderFullNameRaw
|
||||
});
|
||||
}
|
||||
|
||||
// FolderStore.foldersCreating
|
||||
folderCreate(sNewFolderName, sParentName, fTrigger) {
|
||||
return this.postRequest('FolderCreate', fTrigger, {
|
||||
Folder: sNewFolderName,
|
||||
|
|
@ -800,6 +805,7 @@ class RemoteUserFetch extends AbstractFetchRemote {
|
|||
});
|
||||
}
|
||||
|
||||
// FolderStore.foldersRenaming
|
||||
folderRename(sPrevFolderFullNameRaw, sNewFolderName, fTrigger) {
|
||||
return this.postRequest('FolderRename', fTrigger, {
|
||||
Folder: sPrevFolderFullNameRaw,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import ko from 'ko';
|
|||
|
||||
import { SaveSettingsStep, UploadErrorCode, Capa } from 'Common/Enums';
|
||||
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 { doc, $htmlCL } from 'Common/Globals';
|
||||
|
||||
|
|
@ -81,7 +81,7 @@ export class ThemesUserSettings {
|
|||
initUploader() {
|
||||
if (this.background.uploaderButton() && this.capaUserBackground()) {
|
||||
const oJua = new Jua({
|
||||
action: uploadBackground(),
|
||||
action: serverRequest('UploadBackground'),
|
||||
name: 'uploader',
|
||||
queueSize: 1,
|
||||
multipleSizeLimit: 1,
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import { delegateRunOnDestroy } from 'Common/UtilsUser';
|
|||
import { encodeHtml, HtmlEditor } from 'Common/Html';
|
||||
|
||||
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 { timestampToString } from 'Common/Momentor';
|
||||
import { MessageFlagsCache, setFolderHash } from 'Common/Cache';
|
||||
|
|
@ -1202,7 +1202,7 @@ class ComposePopupView extends AbstractViewPopup {
|
|||
const uploadCache = {},
|
||||
attachmentSizeLimit = pInt(Settings.get('AttachmentLimit')),
|
||||
oJua = new Jua({
|
||||
action: upload(),
|
||||
action: serverRequest('Upload'),
|
||||
name: 'uploader',
|
||||
queueSize: 2,
|
||||
multipleSizeLimit: 50,
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import { pInt } from 'Common/Utils';
|
|||
import { delegateRunOnDestroy, computedPaginatorHelper } from 'Common/UtilsUser';
|
||||
|
||||
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 SettingsStore from 'Stores/User/Settings';
|
||||
|
|
@ -352,17 +352,17 @@ class ContactsPopupView extends AbstractViewPopup {
|
|||
}
|
||||
|
||||
exportVcf() {
|
||||
rl.app.download(exportContactsVcf());
|
||||
rl.app.download(serverRequestRaw('ContactsVcf'));
|
||||
}
|
||||
|
||||
exportCsv() {
|
||||
rl.app.download(exportContactsCsv());
|
||||
rl.app.download(serverRequestRaw('ContactsCsv'));
|
||||
}
|
||||
|
||||
initUploader() {
|
||||
if (this.importUploaderButton()) {
|
||||
const j = new Jua({
|
||||
action: uploadContacts(),
|
||||
action: serverRequest('UploadContacts'),
|
||||
name: 'uploader',
|
||||
queueSize: 1,
|
||||
multipleSizeLimit: 1,
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import { doc, leftPanelDisabled, moveAction, Settings } from 'Common/Globals';
|
|||
import { computedPaginatorHelper } from 'Common/UtilsUser';
|
||||
import { File } from 'Common/File';
|
||||
|
||||
import { mailBox, append } from 'Common/Links';
|
||||
import { mailBox, serverRequest } from 'Common/Links';
|
||||
import { Selector } from 'Common/Selector';
|
||||
|
||||
import { i18n, initOnStartOrLangChange } from 'Common/Translator';
|
||||
|
|
@ -907,7 +907,7 @@ class MessageListMailBoxUserView extends AbstractViewRight {
|
|||
}
|
||||
|
||||
const oJua = new Jua({
|
||||
action: append(),
|
||||
action: serverRequest('Append'),
|
||||
name: 'AppendFile',
|
||||
queueSize: 1,
|
||||
multipleSizeLimit: 1,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue