cleanup old cron stuff and make cron-warning.js part of build so it can be committed

Signed-off-by: Devlin Junker <devlin.junker@gmail.com>
This commit is contained in:
Devlin Junker 2023-10-16 13:48:01 -07:00 committed by Benjamin Brahmer
parent 9cab23574f
commit 94f04d4a20
4 changed files with 19 additions and 9 deletions

11
src/main-cron-warning.js Normal file
View File

@ -0,0 +1,11 @@
// Send error to Vuex State for displaying in Vue Application
window.store.commit('SET_ERROR', {
toString: () => t('news', 'Ajax or webcron mode detected! Your feeds will not be updated!'),
links: [{
url: 'https://docs.nextcloud.org/server/latest/admin_manual/configuration_server/background_jobs_configuration.html#cron',
text: t('news', 'How to set up the operating system cron'),
}, {
url: 'https://github.com/nextcloud/news-updater',
text: t('news', 'Install and set up a faster parallel updater that uses the News app\'s update API'),
}],
})

View File

@ -45,12 +45,5 @@ export default new Vue({
render: (h) => h(App),
})
/**
* Closes warning messages generated by PHP code
*/
function closeCronWarning() {
document.getElementById('cron-warning').style.display = 'none'
}
// document.getElementById('close-cron-warning').onclick = closeCronWarning
// Make store accessible for setting cron warning (also for plugins in the future)
window.store = store

View File

@ -1,6 +1,6 @@
<?php if ($_['warnings']['improperlyConfiguredCron']) {
script('news', 'test')
script('news', 'nextcloud-news-cron-warning')
?>
<div></div>
<?php }; ?>

View File

@ -8,6 +8,12 @@ webpackConfig.entry['admin-settings'] = path.join(
'main-admin.js',
)
webpackConfig.entry['cron-warning'] = path.join(
__dirname,
'src',
'main-cron-warning.js',
)
webpackConfig = merge(webpackConfig, {
resolve: {
extensions: ['.ts'],