mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-02 08:13:34 +03:00
c99016fd2f
refs https://github.com/TryGhost/Team/issues/2936 We want to make sure that downloads complete in a reasonable number of time, and the simplest way to do that is to cap the size of the file.
55 lines
1.4 KiB
JavaScript
55 lines
1.4 KiB
JavaScript
import Component from '@glimmer/component';
|
|
import ghostPaths from 'ghost-admin/utils/ghost-paths';
|
|
import {action} from '@ember/object';
|
|
import {inject as service} from '@ember/service';
|
|
import {task} from 'ember-concurrency';
|
|
|
|
export default class Analytics extends Component {
|
|
@service settings;
|
|
@service feature;
|
|
@service utils;
|
|
|
|
@action
|
|
toggleEmailTrackOpens(event) {
|
|
if (event) {
|
|
event.preventDefault();
|
|
}
|
|
this.settings.emailTrackOpens = !this.settings.emailTrackOpens;
|
|
}
|
|
|
|
@task
|
|
*exportPostsTask() {
|
|
let exportUrl = ghostPaths().url.api('posts/export');
|
|
let downloadParams = new URLSearchParams();
|
|
downloadParams.set('limit', 1000);
|
|
|
|
yield this.utils.fetchAndDownloadFile(`${exportUrl}?${downloadParams.toString()}`);
|
|
|
|
return true;
|
|
}
|
|
|
|
@action
|
|
toggleEmailTrackClicks(event) {
|
|
if (event) {
|
|
event.preventDefault();
|
|
}
|
|
this.settings.emailTrackClicks = !this.settings.emailTrackClicks;
|
|
}
|
|
|
|
@action
|
|
toggleMembersTrackSources(event) {
|
|
if (event) {
|
|
event.preventDefault();
|
|
}
|
|
this.settings.membersTrackSources = !this.settings.membersTrackSources;
|
|
}
|
|
|
|
@action
|
|
toggleOutboundLinkTagging(event) {
|
|
if (event) {
|
|
event.preventDefault();
|
|
}
|
|
this.settings.outboundLinkTagging = !this.settings.outboundLinkTagging;
|
|
}
|
|
}
|