mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-09-22 00:06:06 +08:00
fix(plugins): fix open tracking and link tracking URLs
This commit is contained in:
parent
e02b924efb
commit
0550b092b7
|
@ -29,7 +29,7 @@ export default class LinkTrackingComposerExtension extends ComposerExtension {
|
|||
// loop through all <a href> elements, replace with redirect links and save mappings
|
||||
draftBody.unquoted = draftBody.unquoted.replace(RegExpUtils.linkTagRegex(), (match, prefix, url, suffix, content, closingTag) => {
|
||||
const encoded = encodeURIComponent(url);
|
||||
const redirectUrl = `http://${PLUGIN_URL}/${draft.accountId}/${messageUid}/${links.length}?redirect=${encoded}`;
|
||||
const redirectUrl = `http://${PLUGIN_URL}/link/${draft.accountId}/${messageUid}/${links.length}?redirect=${encoded}`;
|
||||
links.push({url: url, click_count: 0, click_data: [], redirect_url: redirectUrl});
|
||||
return prefix + redirectUrl + suffix + content + closingTag;
|
||||
});
|
||||
|
|
|
@ -2,4 +2,4 @@ import plugin from '../package.json'
|
|||
|
||||
export const PLUGIN_NAME = plugin.title
|
||||
export const PLUGIN_ID = plugin.appId[NylasEnv.config.get("env")];
|
||||
export const PLUGIN_URL = "https://edgehill-staging.nylas.com/plugins";
|
||||
export const PLUGIN_URL = "https://edgehill-staging.nylas.com";
|
||||
|
|
|
@ -25,7 +25,7 @@ function afterDraftSend({draftClientId}) {
|
|||
|
||||
// post the uid and message id pair to the plugin server
|
||||
const data = {uid: uid, message_id: message.id};
|
||||
const serverUrl = `${PLUGIN_URL}/register-message`;
|
||||
const serverUrl = `${PLUGIN_URL}/plugins/register-message`;
|
||||
return post({
|
||||
url: serverUrl,
|
||||
body: JSON.stringify(data),
|
||||
|
|
|
@ -27,7 +27,7 @@ function afterDraftSend({draftClientId}) {
|
|||
|
||||
// post the uid and message id pair to the plugin server
|
||||
const data = {uid: uid, message_id: message.id, thread_id: 1};
|
||||
const serverUrl = `${PLUGIN_URL}/register-message`;
|
||||
const serverUrl = `${PLUGIN_URL}/plugins/register-message`;
|
||||
return post({
|
||||
url: serverUrl,
|
||||
body: JSON.stringify(data),
|
||||
|
|
|
@ -21,7 +21,7 @@ export default class OpenTrackingComposerExtension extends ComposerExtension {
|
|||
const uid = uuid.v4().replace(/-/g, "");
|
||||
|
||||
// insert a tracking pixel <img> into the message
|
||||
const serverUrl = `http://${PLUGIN_URL}/${draft.accountId}/${uid}`;
|
||||
const serverUrl = `http://${PLUGIN_URL}/open/${draft.accountId}/${uid}`;
|
||||
const img = `<img width="0" height="0" style="border:0; width:0; height:0;" src="${serverUrl}">`;
|
||||
const draftBody = new DraftBody(draft);
|
||||
draftBody.unquoted = draftBody.unquoted + "<br>" + img;
|
||||
|
|
|
@ -2,4 +2,4 @@ import plugin from '../package.json'
|
|||
|
||||
export const PLUGIN_NAME = plugin.title
|
||||
export const PLUGIN_ID = plugin.appId[NylasEnv.config.get("env")];
|
||||
export const PLUGIN_URL = "https://edgehill-staging.nylas.com/plugins";
|
||||
export const PLUGIN_URL = "https://edgehill-staging.nylas.com";
|
||||
|
|
Loading…
Reference in a new issue