From 94f04d4a20cbbadb7d8ad835bc7ae3dc1c4256fd Mon Sep 17 00:00:00 2001 From: Devlin Junker Date: Mon, 16 Oct 2023 13:48:01 -0700 Subject: cleanup old cron stuff and make cron-warning.js part of build so it can be committed Signed-off-by: Devlin Junker --- src/main-cron-warning.js | 11 +++++++++++ src/main.js | 9 +-------- templates/part.content.warnings.php | 2 +- webpack.js | 6 ++++++ 4 files changed, 19 insertions(+), 9 deletions(-) create mode 100644 src/main-cron-warning.js diff --git a/src/main-cron-warning.js b/src/main-cron-warning.js new file mode 100644 index 000000000..298fa3b61 --- /dev/null +++ b/src/main-cron-warning.js @@ -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'), + }], +}) diff --git a/src/main.js b/src/main.js index c7314d17b..97e48b442 100644 --- a/src/main.js +++ b/src/main.js @@ -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 diff --git a/templates/part.content.warnings.php b/templates/part.content.warnings.php index db9b2f218..cc7890a87 100644 --- a/templates/part.content.warnings.php +++ b/templates/part.content.warnings.php @@ -1,6 +1,6 @@
diff --git a/webpack.js b/webpack.js index 25c295596..55e836ef5 100644 --- a/webpack.js +++ b/webpack.js @@ -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'], -- cgit v1.2.3