mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
refactor(core): Make AJAX cron script work without jQuery
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
parent
8ec53608b0
commit
4d6a21a379
5 changed files with 20 additions and 15 deletions
|
|
@ -54,7 +54,7 @@ class BeforeTemplateRenderedListener implements IEventListener {
|
|||
|
||||
// If installed and background job is set to ajax, add dedicated script
|
||||
if ($this->config->getAppValue('core', 'backgroundjobs_mode', 'ajax') == 'ajax') {
|
||||
Util::addScript('core', 'backgroundjobs');
|
||||
Util::addScript('core', 'ajax-cron');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +0,0 @@
|
|||
/**
|
||||
* SPDX-FileCopyrightText: 2012 Jakob Sack owncloud@jakobsack.de
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
// start worker once page has loaded
|
||||
window.addEventListener('DOMContentLoaded', function(){
|
||||
$.get( OC.getRootPath()+'/cron.php' );
|
||||
|
||||
$('.section .icon-info').tooltip({
|
||||
placement: 'right'
|
||||
});
|
||||
});
|
||||
|
|
@ -14,7 +14,6 @@ window.addEventListener('DOMContentLoaded', function () {
|
|||
$('#remote_address').focus();
|
||||
});
|
||||
|
||||
|
||||
$(document).mouseup(function(e) {
|
||||
var toggle = $('#body-public').find('.header-right .menutoggle');
|
||||
var container = toggle.next('.popovermenu');
|
||||
|
|
|
|||
18
core/src/ajax-cron.ts
Normal file
18
core/src/ajax-cron.ts
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
/**
|
||||
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { getRootUrl } from '@nextcloud/router'
|
||||
import logger from './logger'
|
||||
|
||||
window.addEventListener('DOMContentLoaded', async () => {
|
||||
// When the page is loaded send GET to the cron endpoint to trigger background jobs
|
||||
try {
|
||||
logger.debug('Running web cron')
|
||||
await window.fetch(`${getRootUrl()}/cron.php`)
|
||||
logger.debug('Web cron successfull')
|
||||
} catch (e) {
|
||||
logger.debug('Running web cron failed', { error: e })
|
||||
}
|
||||
})
|
||||
|
|
@ -11,6 +11,7 @@ module.exports = {
|
|||
init: path.join(__dirname, 'apps/comments/src', 'init.ts'),
|
||||
},
|
||||
core: {
|
||||
'ajax-cron': path.join(__dirname, 'core/src', 'ajax-cron.ts'),
|
||||
files_client: path.join(__dirname, 'core/src', 'files/client.js'),
|
||||
files_fileinfo: path.join(__dirname, 'core/src', 'files/fileinfo.js'),
|
||||
install: path.join(__dirname, 'core/src', 'install.js'),
|
||||
|
|
|
|||
Loading…
Reference in a new issue