Skip to content

Commit

Permalink
Merge branch 'v.0.42.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
dziudek committed Apr 17, 2023
2 parents ddb2618 + a70de10 commit a12d71d
Show file tree
Hide file tree
Showing 36 changed files with 722 additions and 452 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
[Publii](https://getpublii.com/) is a desktop-based CMS for Windows, Mac and Linux that makes creating static websites fast
and hassle-free, even for beginners.

**Current version: 0.42.0 (build 16217)**
**Current version: 0.42.1 (build 16233)**

## Why Publii?
Unlike static-site generators that are often unwieldy and difficult to use, Publii provides an
Expand Down
2 changes: 1 addition & 1 deletion app/back-end/builddata.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"0.42.0","build":16217}
{"version":"0.42.1","build":16233}
186 changes: 117 additions & 69 deletions app/back-end/modules/deploy/sftp.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,31 +161,40 @@ class SFTP {

this.connection.put(
normalizePath(path.join(self.deployment.inputDir, 'files.publii.json')),
normalizePath(path.join(self.deployment.outputDir, 'files.publii.json'))
).then(function(result) {
console.log(`[${ new Date().toUTCString() }] -> files.publii.json`);
self.connection.end();
normalizePath(path.join(self.deployment.outputDir, 'files.publii.json')),
).then(() => {
this.connection.chmod(normalizePath(path.join(this.deployment.outputDir, 'files.publii.json')), 0o644).then(() => {
console.log(`[${ new Date().toUTCString() }] -> files.publii.json`);
this.connection.end();

process.send({
type: 'web-contents',
message: 'app-uploading-progress',
value: {
progress: 100,
operations: false
}
});
process.send({
type: 'web-contents',
message: 'app-uploading-progress',
value: {
progress: 100,
operations: false
}
});

process.send({
type: 'sender',
message: 'app-deploy-uploaded',
value: {
status: true
}
});
process.send({
type: 'sender',
message: 'app-deploy-uploaded',
value: {
status: true
}
});

setTimeout(function () {
process.kill(process.pid, 'SIGTERM');
}, 1000);
setTimeout(function () {
process.kill(process.pid, 'SIGTERM');
}, 1000);
}).catch(err => {
this.connection.end();
console.log(`[${ new Date().toUTCString() }] ${err}`);

setTimeout(function () {
process.kill(process.pid, 'SIGTERM');
}, 1000);
});
}).catch(err => {
this.connection.end();
console.log(`[${ new Date().toUTCString() }] ${err}`);
Expand All @@ -197,64 +206,93 @@ class SFTP {
}

uploadFile(input, output) {
let self = this;
this.connection.put(input, output).then(() => {
this.connection.chmod(output, 0o644).then(() => {
this.deployment.currentOperationNumber++;
console.log(`[${ new Date().toUTCString() }] UPL ${input} -> ${output}`);
this.deployment.progressOfUploading += this.deployment.progressPerFile;

this.connection.put(input, output).then(function (result) {
self.deployment.currentOperationNumber++;
console.log(`[${ new Date().toUTCString() }] UPL ${input} -> ${output}`);
self.deployment.progressOfUploading += self.deployment.progressPerFile;
process.send({
type: 'web-contents',
message: 'app-uploading-progress',
value: {
progress: 8 + Math.floor(this.deployment.progressOfUploading),
operations: [
this.deployment.currentOperationNumber,
this.deployment.operationsCounter
]
}
});

process.send({
type: 'web-contents',
message: 'app-uploading-progress',
value: {
progress: 8 + Math.floor(self.deployment.progressOfUploading),
operations: [self.deployment.currentOperationNumber, self.deployment.operationsCounter]
}
this.deployment.uploadFile();
}).catch(err => {
console.log(`[${ new Date().toUTCString() }] ERROR UPLOAD FILE: ${normalizePath(input)}`);
console.log(`[${ new Date().toUTCString() }] ${err}`);
this.deployment.uploadFile();
});

self.deployment.uploadFile();
}).catch(err => {
console.log(`[${ new Date().toUTCString() }] ERROR UPLOAD FILE: ${normalizePath(input)}`);
console.log(`[${ new Date().toUTCString() }] ${err}`);
self.deployment.uploadFile();
this.deployment.uploadFile();
});
}

uploadDirectory(input, output) {
let self = this;
this.connection.mkdir(output, true).then(() => {
this.connection.chmod(output, 0o755).then(() => {
this.deployment.currentOperationNumber++;
console.log(`[${ new Date().toUTCString() }] UPL ${input} -> ${output}`);
this.deployment.progressOfUploading += this.deployment.progressPerFile;

this.connection.mkdir(output, true).then(function (result) {
self.deployment.currentOperationNumber++;
console.log(`[${ new Date().toUTCString() }] UPL ${input} -> ${output}`);
self.deployment.progressOfUploading += self.deployment.progressPerFile;
process.send({
type: 'web-contents',
message: 'app-uploading-progress',
value: {
progress: 8 + Math.floor(this.deployment.progressOfUploading),
operations: [this.deployment.currentOperationNumber, this.deployment.operationsCounter]
}
});

process.send({
type: 'web-contents',
message: 'app-uploading-progress',
value: {
progress: 8 + Math.floor(self.deployment.progressOfUploading),
operations: [self.deployment.currentOperationNumber, self.deployment.operationsCounter]
}
this.deployment.uploadFile();
}).catch(err => {
this.deployment.currentOperationNumber++;
console.log(`[${ new Date().toUTCString() }] ERROR UPLOAD DIR: ${output}`);
console.log(`[${ new Date().toUTCString() }] ${err}`);

this.deployment.progressOfUploading += this.deployment.progressPerFile;
process.send({
type: 'web-contents',
message: 'app-uploading-progress',
value: {
progress: 8 + Math.floor(this.deployment.progressOfUploading),
operations: [
this.deployment.currentOperationNumber,
this.deployment.operationsCounter
]
}
});

this.deployment.uploadFile();
});

self.deployment.uploadFile();
}).catch(err => {
self.deployment.currentOperationNumber++;
this.deployment.currentOperationNumber++;
console.log(`[${ new Date().toUTCString() }] ERROR UPLOAD DIR: ${output}`);
console.log(`[${ new Date().toUTCString() }] ${err}`);

self.deployment.progressOfUploading += self.deployment.progressPerFile;
this.deployment.progressOfUploading += this.deployment.progressPerFile;
process.send({
type: 'web-contents',
message: 'app-uploading-progress',
value: {
progress: 8 + Math.floor(self.deployment.progressOfUploading),
operations: [self.deployment.currentOperationNumber, self.deployment.operationsCounter]
progress: 8 + Math.floor(this.deployment.progressOfUploading),
operations: [
this.deployment.currentOperationNumber,
this.deployment.operationsCounter
]
}
});

self.deployment.uploadFile();
this.deployment.uploadFile();
});
}

Expand Down Expand Up @@ -355,24 +393,34 @@ class SFTP {
client.put(
testFilePath,
normalizePath(path.join(deploymentConfig.path, 'publii.test'))
).then(result => {
client.delete(
normalizePath(path.join(deploymentConfig.path, 'publii.test'))
).then(result => {
app.mainWindow.webContents.send('app-deploy-test-success');

if (fs.existsSync(testFilePath)) {
fs.unlinkSync(testFilePath);
}

client.end().catch(err => console.log('SFTP session end error'));
).then(() => {
client.chmod(normalizePath(path.join(deploymentConfig.path, 'publii.test')), 0o644).then(() => {
client.delete(
normalizePath(path.join(deploymentConfig.path, 'publii.test'))
).then(() => {
app.mainWindow.webContents.send('app-deploy-test-success');

if (fs.existsSync(testFilePath)) {
fs.unlinkSync(testFilePath);
}

client.end().catch(err => console.log('SFTP session end error'));
}).catch(() => {
app.mainWindow.webContents.send('app-deploy-test-write-error');

if (fs.existsSync(testFilePath)) {
fs.unlinkSync(testFilePath);
}

client.end().catch(err => console.log('SFTP session end error'));
});
}).catch(err => {
app.mainWindow.webContents.send('app-deploy-test-write-error');

if (fs.existsSync(testFilePath)) {
fs.unlinkSync(testFilePath);
}

client.end().catch(err => console.log('SFTP session end error'));
});
}).catch(err => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ function pageURLHelper(rendererInstance, Handlebars) {
// Connect the URL parts
path = path.join('/');

if(!rendererInstance.previewMode) {
// Add trailing slash only if adding index.html is disabled and there is no preview mode active
if (!rendererInstance.previewMode && !rendererInstance.siteConfig.advanced.urls.addIndex) {
path += '/';
}

Expand Down
2 changes: 1 addition & 1 deletion app/default-files/default-languages/pl/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
"quoteAuthor": "Autor cytatu",
"quoteText": "Tekst cytatu",
"readMore": "Czytaj więcej",
"readMoreBlockName": "Czytajwięcej",
"readMoreBlockName": "Czytaj więcej",
"selectFiles": "Wybierz pliki",
"separator": "Separator",
"shortcuts": "Skróty",
Expand Down
Loading

0 comments on commit a12d71d

Please sign in to comment.