Email notifications kivi ads #107

Open
RabbIT09-n wants to merge 46 commits from email-notifications-kivi-ads into master
2 changed files with 19 additions and 19 deletions
Showing only changes of commit ba07b9311f - Show all commits

View File

@@ -57,12 +57,14 @@ var c = "";
function uploadFile(file) {
$("#status").html('Starting Upload...')
url = c
url = c;
console.log("RADIL" + file);
fetch(url, {
method: 'PUT',
body: file
})
.then(response => response.text())
.then (console.log())
.catch(error => $("#status").html(error)
)
.then(response => $("#status").html('File uploaded successfully: ' + filename));

View File

@@ -75,26 +75,24 @@ async function generateSignedUrl() {
//generateSignedUrl().catch(console.error);
app.get("/generateSignedURL", (req, res) => {
console.log("Started server function!");
async function generateSignedUrl() {
console.log("Started server function!");
const options = {
version: "v2",
action: "write",
expires: Date.now() + 86400000
};
const filename = req.query.filename;
const options = {
version: "v2",
action: "write",
expires: Date.now() + 86400000
};
const filename = req.query.filename;
console.log("Filename: ", filename);
console.log("Bucket name:", bucket.name);
console.log("Filename: ", filename);
console.log("Bucket name:", bucket.name);
const url = bucket.file(filename).getSignedUrl(options, function(err, url) {
if (err) {
console.error(err);
return;
}
return url;
});
const [url] = await bucket.file(filename).getSignedUrl(options);
console.log(`The signed url for ${filename} is ${url}.`);
res.send(url);
console.log(`The signed url for ${filename} is ${url}.`);
res.send(url);
}
generateSignedUrl().catch(console.error);
});