mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 03:59:21 +03:00
Updated Autolinker library (Closes #532)
This commit is contained in:
parent
45fc261b28
commit
f817a680a2
15 changed files with 3145 additions and 869 deletions
|
|
@ -17,8 +17,7 @@
|
|||
|
||||
this.sBase = '#/';
|
||||
this.sServer = './?';
|
||||
this.sSubQuery = '&s=/';
|
||||
this.sSubSubQuery = '&ss=/';
|
||||
|
||||
this.sVersion = Settings.settingsGet('Version');
|
||||
this.sSpecSuffix = Settings.settingsGet('AuthAccountHash') || '0';
|
||||
this.sWebPrefix = Settings.settingsGet('WebPath') || '';
|
||||
|
|
@ -26,6 +25,14 @@
|
|||
this.sStaticPrefix = this.sVersionPrefix + 'static/';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
Links.prototype.subQueryPrefix = function ()
|
||||
{
|
||||
return '&q[]=';
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
|
|
@ -48,7 +55,7 @@
|
|||
*/
|
||||
Links.prototype.attachmentDownload = function (sDownload)
|
||||
{
|
||||
return this.sServer + '/Raw/' + this.sSubQuery + this.sSpecSuffix + '/Download/' + this.sSubSubQuery + sDownload;
|
||||
return this.sServer + '/Raw/' + this.subQueryPrefix() + '/' + this.sSpecSuffix + '/Download/' + this.subQueryPrefix() + '/' + sDownload;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -57,7 +64,7 @@
|
|||
*/
|
||||
Links.prototype.attachmentPreview = function (sDownload)
|
||||
{
|
||||
return this.sServer + '/Raw/' + this.sSubQuery + this.sSpecSuffix + '/View/' + this.sSubSubQuery + sDownload;
|
||||
return this.sServer + '/Raw/' + this.subQueryPrefix() + '/' + this.sSpecSuffix + '/View/' + this.subQueryPrefix() + '/' + sDownload;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -66,7 +73,7 @@
|
|||
*/
|
||||
Links.prototype.attachmentThumbnailPreview = function (sDownload)
|
||||
{
|
||||
return this.sServer + '/Raw/' + this.sSubQuery + this.sSpecSuffix + '/ViewThumbnail/' + this.sSubSubQuery + sDownload;
|
||||
return this.sServer + '/Raw/' + this.subQueryPrefix() + '/' + this.sSpecSuffix + '/ViewThumbnail/' + this.subQueryPrefix() + '/' + sDownload;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -75,7 +82,7 @@
|
|||
*/
|
||||
Links.prototype.attachmentPreviewAsPlain = function (sDownload)
|
||||
{
|
||||
return this.sServer + '/Raw/' + this.sSubQuery + this.sSpecSuffix + '/ViewAsPlain/' + this.sSubSubQuery + sDownload;
|
||||
return this.sServer + '/Raw/' + this.subQueryPrefix() + '/' + this.sSpecSuffix + '/ViewAsPlain/' + this.subQueryPrefix() + '/' + sDownload;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -84,7 +91,7 @@
|
|||
*/
|
||||
Links.prototype.attachmentFramed = function (sDownload)
|
||||
{
|
||||
return this.sServer + '/Raw/' + this.sSubQuery + this.sSpecSuffix + '/FramedView/' + this.sSubSubQuery + sDownload;
|
||||
return this.sServer + '/Raw/' + this.subQueryPrefix() + '/' + this.sSpecSuffix + '/FramedView/' + this.subQueryPrefix() + '/' + sDownload;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -92,7 +99,7 @@
|
|||
*/
|
||||
Links.prototype.upload = function ()
|
||||
{
|
||||
return this.sServer + '/Upload/' + this.sSubQuery + this.sSpecSuffix + '/';
|
||||
return this.sServer + '/Upload/' + this.subQueryPrefix() + '/' + this.sSpecSuffix + '/';
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -100,7 +107,7 @@
|
|||
*/
|
||||
Links.prototype.uploadContacts = function ()
|
||||
{
|
||||
return this.sServer + '/UploadContacts/' + this.sSubQuery + this.sSpecSuffix + '/';
|
||||
return this.sServer + '/UploadContacts/' + this.subQueryPrefix() + '/' + this.sSpecSuffix + '/';
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -108,7 +115,7 @@
|
|||
*/
|
||||
Links.prototype.uploadBackground = function ()
|
||||
{
|
||||
return this.sServer + '/UploadBackground/' + this.sSubQuery + this.sSpecSuffix + '/';
|
||||
return this.sServer + '/UploadBackground/' + this.subQueryPrefix() + '/' + this.sSpecSuffix + '/';
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -116,7 +123,7 @@
|
|||
*/
|
||||
Links.prototype.append = function ()
|
||||
{
|
||||
return this.sServer + '/Append/' + this.sSubQuery + this.sSpecSuffix + '/';
|
||||
return this.sServer + '/Append/' + this.subQueryPrefix() + '/' + this.sSpecSuffix + '/';
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -125,7 +132,7 @@
|
|||
*/
|
||||
Links.prototype.change = function (sEmail)
|
||||
{
|
||||
return this.sServer + '/Change/' + this.sSubQuery + this.sSpecSuffix + '/' + Utils.encodeURIComponent(sEmail) + '/';
|
||||
return this.sServer + '/Change/' + this.subQueryPrefix() + '/' + this.sSpecSuffix + '/' + Utils.encodeURIComponent(sEmail) + '/';
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -134,7 +141,7 @@
|
|||
*/
|
||||
Links.prototype.ajax = function (sAdd)
|
||||
{
|
||||
return this.sServer + '/Ajax/' + this.sSubQuery + this.sSpecSuffix + '/' + sAdd;
|
||||
return this.sServer + '/Ajax/' + this.subQueryPrefix() + '/' + this.sSpecSuffix + '/' + sAdd;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -143,7 +150,7 @@
|
|||
*/
|
||||
Links.prototype.messageViewLink = function (sRequestHash)
|
||||
{
|
||||
return this.sServer + '/Raw/' + this.sSubQuery + this.sSpecSuffix + '/ViewAsPlain/' + this.sSubSubQuery + sRequestHash;
|
||||
return this.sServer + '/Raw/' + this.subQueryPrefix() + '/' + this.sSpecSuffix + '/ViewAsPlain/' + this.subQueryPrefix() + '/' + sRequestHash;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -152,7 +159,7 @@
|
|||
*/
|
||||
Links.prototype.messageDownloadLink = function (sRequestHash)
|
||||
{
|
||||
return this.sServer + '/Raw/' + this.sSubQuery + this.sSpecSuffix + '/Download/' + this.sSubSubQuery + sRequestHash;
|
||||
return this.sServer + '/Raw/' + this.subQueryPrefix() + '/' + this.sSpecSuffix + '/Download/' + this.subQueryPrefix() + '/' + sRequestHash;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -179,8 +186,8 @@
|
|||
*/
|
||||
Links.prototype.userBackground = function (sHash)
|
||||
{
|
||||
return this.sServer + '/Raw/' + this.sSubQuery + this.sSpecSuffix + '/UserBackground/' +
|
||||
this.sSubSubQuery + sHash;
|
||||
return this.sServer + '/Raw/' + this.subQueryPrefix() + '/' + this.sSpecSuffix +
|
||||
'/UserBackground/' + this.subQueryPrefix() + '/' + sHash;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -298,7 +305,7 @@
|
|||
*/
|
||||
Links.prototype.exportContactsVcf = function ()
|
||||
{
|
||||
return this.sServer + '/Raw/' + this.sSubQuery + this.sSpecSuffix + '/ContactsVcf/';
|
||||
return this.sServer + '/Raw/' + this.subQueryPrefix() + '/' + this.sSpecSuffix + '/ContactsVcf/';
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -306,7 +313,7 @@
|
|||
*/
|
||||
Links.prototype.exportContactsCsv = function ()
|
||||
{
|
||||
return this.sServer + '/Raw/' + this.sSubQuery + this.sSpecSuffix + '/ContactsCsv/';
|
||||
return this.sServer + '/Raw/' + this.subQueryPrefix() + '/' + this.sSpecSuffix + '/ContactsCsv/';
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -363,7 +370,7 @@
|
|||
*/
|
||||
Links.prototype.socialGoogle = function ()
|
||||
{
|
||||
return this.sServer + 'SocialGoogle' + ('' !== this.sSpecSuffix ? '/' + this.sSubQuery + this.sSpecSuffix + '/' : '');
|
||||
return this.sServer + 'SocialGoogle' + ('' !== this.sSpecSuffix ? '/' + this.subQueryPrefix() + '/' + this.sSpecSuffix + '/' : '');
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -371,7 +378,7 @@
|
|||
*/
|
||||
Links.prototype.socialTwitter = function ()
|
||||
{
|
||||
return this.sServer + 'SocialTwitter' + ('' !== this.sSpecSuffix ? '/' + this.sSubQuery + this.sSpecSuffix + '/' : '');
|
||||
return this.sServer + 'SocialTwitter' + ('' !== this.sSpecSuffix ? '/' + this.subQueryPrefix() + '/' + this.sSpecSuffix + '/' : '');
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -379,7 +386,7 @@
|
|||
*/
|
||||
Links.prototype.socialFacebook = function ()
|
||||
{
|
||||
return this.sServer + 'SocialFacebook' + ('' !== this.sSpecSuffix ? '/' + this.sSubQuery + this.sSpecSuffix + '/' : '');
|
||||
return this.sServer + 'SocialFacebook' + ('' !== this.sSpecSuffix ? '/' + this.subQueryPrefix() + '/' + this.sSpecSuffix + '/' : '');
|
||||
};
|
||||
|
||||
module.exports = new Links();
|
||||
|
|
|
|||
|
|
@ -1062,6 +1062,7 @@
|
|||
*/
|
||||
Utils.findEmailAndLinks = function (sHtml)
|
||||
{
|
||||
// return sHtml;
|
||||
sHtml = Autolinker.link(sHtml, {
|
||||
'newWindow': true,
|
||||
'stripPrefix': false,
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
// Utils = require('Common/Utils'),
|
||||
// Base64 = require('Common/Base64'),
|
||||
// Cache = require('Common/Cache'),
|
||||
// Links = require('Common/Links'),
|
||||
//
|
||||
// AppStore = require('Stores/User/App'),
|
||||
// SettingsStore = require('Stores/User/Settings'),
|
||||
|
|
@ -31,8 +32,6 @@
|
|||
|
||||
this.messageListSimpleHash = '';
|
||||
this.messageListSimpleCache = null;
|
||||
|
||||
this.sSubSubQuery = '&ss=/';
|
||||
}
|
||||
|
||||
_.extend(UserAjaxUserPromises.prototype, AbstractAjaxPromises.prototype);
|
||||
|
|
@ -123,7 +122,7 @@
|
|||
// {
|
||||
// return this.abort('Message')
|
||||
// .getRequest('Message', fTrigger,
|
||||
// this.sSubSubQuery + Base64.urlsafe_encode([
|
||||
// Links.subQueryPrefix() + '/' + Base64.urlsafe_encode([
|
||||
// sFolderFullNameRaw, iUid,
|
||||
// AppStore.projectHash(),
|
||||
// AppStore.threadsAllowed() && SettingsStore.useThreads() ? '1' : '0'
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
Base64 = require('Common/Base64'),
|
||||
|
||||
Cache = require('Common/Cache'),
|
||||
Links = require('Common/Links'),
|
||||
|
||||
Settings = require('Storage/Settings'),
|
||||
|
||||
|
|
@ -29,8 +30,6 @@
|
|||
AbstractAjaxRemote.call(this);
|
||||
|
||||
this.oRequests = {};
|
||||
|
||||
this.sSubSubQuery = '&ss=/';
|
||||
}
|
||||
|
||||
_.extend(RemoteUserAjax.prototype, AbstractAjaxRemote.prototype);
|
||||
|
|
@ -352,7 +351,7 @@
|
|||
{
|
||||
return this.defaultRequest(fCallback, 'MessageList', {},
|
||||
'' === sSearch ? Consts.Defaults.DefaultAjaxTimeout : Consts.Defaults.SearchAjaxTimeout,
|
||||
'MessageList/' + this.sSubSubQuery + Base64.urlsafe_encode([
|
||||
'MessageList/' + Links.subQueryPrefix() + '/' + Base64.urlsafe_encode([
|
||||
sFolderFullNameRaw,
|
||||
iOffset,
|
||||
iLimit,
|
||||
|
|
@ -402,7 +401,7 @@
|
|||
if (Cache.getFolderFromCacheList(sFolderFullNameRaw) && 0 < iUid)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'Message', {}, null,
|
||||
'Message/' + this.sSubSubQuery + Base64.urlsafe_encode([
|
||||
'Message/' + Links.subQueryPrefix() + '/' + Base64.urlsafe_encode([
|
||||
sFolderFullNameRaw,
|
||||
iUid,
|
||||
AppStore.projectHash(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue