Strapi restarts server after pdf file upload | Want to bypass that so script is not interrupted - file-upload

I am building a strapi app that creates a pdf and in which I want to send an email to the user after that, with the pdf attached.
The issue is that the moment the pdf is saved in the upload/files directory the server reloads. Being so, the script is interrupted and the email is never sent.
What I want is that the server doesn't restart at the upload, the script continues and so the email is sent.
I am using strapi v3 and the upload plugin.
I already tried to use the watchIgnoreFiles pointing to the upload/files directory in the admin.js, but the strapi server still restarts. (https://forum.strapi.io/t/change-file-without-triggering-a-reload-of-strapi/4026/8). But I am in doubt if this is the right way, since I am not changing a file, but creating a new one, which is content and not a system file. My admin.js file is as follows:
module.exports = ({ env }) => ({ admin: { autoOpen: false, watchIgnoreFiles: [ './extensions/upload/files/', '**/extensions/upload/files/' ] } })
Thank you for your help.

Related

Multiple GTM containers in vue THROWS Error in production

I am able to add multiple ids in the id array and it loads well and properly adds the script on local
However, when the code makes it to production, it throws invalid errors because the IDs are getting concatenated(probably due to minified files, not sure). How can I fix this?
Pictures of local and deployed version are attached
Google tag manager on prodution
Google tag manager on my local machine
Here's is my config code using vue-gtm
Vue.use(VueGtm, {
id: ['GTM-M4X2575', 'GTM-T98TL4V'],
enabled: true,
debug: true
});
Am I missing anything?

Jenkins attaching local image in email

I am facing a problem in following scenario.
i have configured am email to be send after the job is succeed in Jenkins. In that email i am attaching local image to send it over email to other users, using html
The problem i am facing here is once the mail is in my outlook inbox i can download and see the embedded image on my machine but when i open the same email on different user's machine its not displaying image its showing "X" mark.
Please help to resolve the issue.
OK , so assuming you are using a declarative pipeline (because im not sure if you are using pipeline or regular job), you can add this code to your post stage :
post {
always {
echo 'I have finished'
archiveArtifacts 'yourfile.html or any extension'
emailext attachLog: true,
attachmentsPattern: '*.html',
body: 'Smoke Test.\n\nPlease see attachment for Report and build Logs', subject: 'DO NOT REPLY: JENKINS Build Server Notification [${BUILD_STATUS}]${JOB_NAME} Build #${BUILD_NUMBER}', to: 'example#example.com'
}
if you attachment (in my case is yourfile.html) is in your root directory then *.html is good to pick it up, otherwise pass the absolute path to your attachment.
Note : that its better always to archive the artifacts or the files you are trying to use later in the build or in other builds.
Also, make sure you have email extension plugin: Email extension plugin

PouchDB using remoteDB and not local DB instance by default in online mode not not in offline mode

I have attachments saved in a CouchDB database server-side that I want to replicate on a client-side app using PouchDB.
In my app.js file where I handle my application logic, this is at the top:
import PouchDB from 'pouchdb'
var remoteDB = new PouchDB('http://dev04:5984/documentation')
var db = new PouchDB('documentation')
remoteDB.replicate.to(db).on('complete', function () {
// yay, we're done!
}).on('error', function (err) {
// boo, something went wrong!
});
When I turn off access to port 5984 in my firewall, my file can no longer be retrieved and I lose access to my index.html file.
What I am expecting is for all contents of the database 'documentaion' to be copied to my local browser storage -- including pdfs and such -- so that when I turn off port 5984 and then hit refresh, I should still have access to the contents. What am I doing wrong? (see edit -- I figured out that the db is actually replicating, but the local instance isn't being preferred)
EDIT:
I've determined that the database is actually being replicated, but the local storage is only 'preferred' when the browser is in offline mode. So when I refresh while in online mode, with port 5984 blocked, the page is not found. But when I do the same in offline mode (once the contents have been cached already, of course), then the contents can be retrieved.
It would not be an ideal solution to ask my users to always work in offline mode. Is there some way to make the local PouchDB instance the default, even in online mode?
I write to the local db first and "sync" that to a remote db if it's available.
And I use app.cache to provide offline functionality and configure the app to run "offline first".
I read last week that Apple has finally implemented Service Workers in Safari so I'll be looking into implementing that as well now.

Pass URL with Notifying

I am wondering if it possible to configure the remote notify option to pass a URL.
I see there is a function for onErrorRemoteDisableDenial. I tried to modify it, but it seems to disables the app. Even if i put code to continue, the next call to the backend does not work.
But what we are looking for is giving the user the option to update via URL, or just continue with the app version they currently have.
Using Worklight 6.1
There is a way to customize both Remote Disable and Remote Notify, but the downloadLink (the link that you've set in Worklight Console) is available only when setting Remote Disable, not Remote Notify. Only the message (the text set in Worklight Console) will be available.
You can customize the Remote Notify flow by using the following in main.js (outside of any function):
wl_remoteDisableChallengeHandler.handleChallenge = function(message,downloadLink) {
WL.SimpleDialog.show(
"New Version",
message,
[
{text: "Download", handler: function() {
// Maybe use WL.App.openURL(downloadLink) to go to the app store
}},
{text: "Close", handler: function() {
// Continue with the app
}}
]);
};
wl_remoteDisableChallengeHandler.handleChallenge overrides the default Remote Notify code path. wl_remoteDisableChallengeHandler.handleFailure will override the default Remote Disable code path (and this is another way to customize Remote Disable).
Edit: per the findings in the comments, in order to get both the message and downloadLink, you will first need to temporary set Remote Disable and then change to Remote Notify, this is a workaround because Remote Notify by default is not meant to also pass the downloadLink to the default provided dialog.
Note: Remote Notify is meant to be displayed only once per a message's life cycle, so after it was displayed - it will not be displayed again until a the message is set again in the console.
A way to get the code to work on each application launch is to clear the application's HTML local storage (at some point while the app is running), where a "flag" is stored to tell the application not to display the message again (I forgot its name, but you could print the contents of the local storage and debug that).
Sounds like a nice feature request: https://developer.ibm.com/mobilefirstplatform/help

Unable to configure SabreDAV to test Webdav and CardDAV

Steps I followed:
Downloaded the Sabredav zip file - unzipped it.
Downloaded apache webserver 2.2 and PHP 5.3
Then followed the instructions mentioned in the 'get Started' section on Sabredav website.
Created 'data and public' fiels (located them in /sabredav/vendor/)
Created the server.php file (located it in /sabredav/vendor/)
Now tried to open the server.php file in browser -
Here it opens using the file protocol..
Fails to open in expected - 'http ://mydomain/sabredav/server.php
Can anybody please help me on this ?
Thanks
In server.php, use the browser plugin tu see files in Public folder.
Your server must be like this:
include 'SabreDAV/vendor/autoload.php';
use
Sabre\DAV;
$rootDirectory = new DAV\FS\Directory('public');
// The server object is responsible for making sense out of the WebDAV protocol
$server = new DAV\Server($rootDirectory);
// If your server is not on your webroot, make sure the following line has the correct information
$server->setBaseUri('/server.php'); // if its in some kind of home directory
// The lock manager is reponsible for making sure users don't overwrite each others changes. Change 'data' to a different
// directory, if you're storing your data somewhere else.
$lockBackend = new DAV\Locks\Backend\File('data/locks');
$lockPlugin = new DAV\Locks\Plugin($lockBackend);
$server->addPlugin($lockPlugin);
$server->addPlugin(new \Sabre\DAV\Browser\GuessContentType());
$plugin = new \Sabre\DAV\Browser\Plugin();
$server->addPlugin($plugin);
// All we need to do now, is to fire up the server
$server->exec();