Skip to content

Commit 336cd02

Browse files
committed
Merge branch '0.34.2'
2 parents 201892f + afd1977 commit 336cd02

File tree

114 files changed

+3495
-951
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+3495
-951
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
[Publii](https://getpublii.com/) is a desktop-based CMS for Windows, Mac and Linux that makes creating static websites fast
1010
and hassle-free, even for beginners.
1111

12-
**Current version: 0.34.1 (build 11733)**
12+
**Current version: 0.35.0 (build 11899)**
1313

1414
## Why Publii?
1515
Unlike static-site generators that are often unwieldy and difficult to use, Publii provides an

app/back-end/app.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,19 @@ class App {
394394
}
395395

396396
if (!this.windowBounds) {
397-
const {width, height} = electron.screen.getPrimaryDisplay().workAreaSize;
397+
let screens = electron.screen.getAllDisplays();
398+
let width = screens[0].workAreaSize.width;
399+
let height = screens[0].workAreaSize.height;
400+
401+
for (let i = 0; i < screens.length; i++) {
402+
if (screens[i].width < width) {
403+
width = screens[i].width;
404+
}
405+
406+
if (screens[i].height < height) {
407+
height = screens[i].height;
408+
}
409+
}
398410

399411
this.windowBounds = {
400412
width: width,
@@ -439,6 +451,9 @@ class App {
439451
let windowParams = this.windowBounds;
440452
windowParams.minWidth = 1200;
441453
windowParams.minHeight = 700;
454+
windowParams.webPreferences = {
455+
nodeIntegration: true
456+
};
442457

443458
let displays = electron.screen.getAllDisplays();
444459
let externalDisplay = displays.find((display) => {

app/back-end/builddata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"version":"0.34.1","build":11733,"status":"Beta"}
1+
{"version":"0.35.0","build":11899,"status":"Beta"}

app/back-end/events/deploy.js

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ class DeployEvents {
88
let self = this;
99
this.app = appInstance;
1010
this.deploymentProcess = false;
11+
this.rendererProcess = false;
1112

1213
ipcMain.on('app-deploy-render', function (event, siteData) {
1314
if(siteData.site && siteData.theme) {
@@ -19,6 +20,23 @@ class DeployEvents {
1920
}
2021
});
2122

23+
ipcMain.on('app-deploy-render-abort', function(event, siteData) {
24+
if(self.rendererProcess) {
25+
try {
26+
self.rendererProcess.send({
27+
type: 'abort'
28+
});
29+
30+
self.rendererProcess = false;
31+
} catch(e) {
32+
console.log(e);
33+
self.rendererProcess = false;
34+
}
35+
}
36+
37+
event.sender.send('app-deploy-aborted', true);
38+
});
39+
2240
ipcMain.on('app-deploy-upload', function(event, siteData) {
2341
if(siteData.site) {
2442
self.deploySite(siteData.site, siteData.password, event.sender);
@@ -36,13 +54,10 @@ class DeployEvents {
3654
type: 'abort'
3755
});
3856

39-
setTimeout(() => {
40-
if (this.deploymentProcess) {
41-
this.deploymentProcess.kill();
42-
}
43-
}, 2000);
57+
self.deploymentProcess = false;
4458
} catch(e) {
45-
59+
console.log(e);
60+
self.deploymentProcess = false;
4661
}
4762
}
4863

@@ -59,7 +74,7 @@ class DeployEvents {
5974
}
6075

6176
renderSite(site, event) {
62-
let rendererProcess = childProcess.fork(__dirname + '/../workers/renderer/preview', {
77+
this.rendererProcess = childProcess.fork(__dirname + '/../workers/renderer/preview', {
6378
stdio: [
6479
null,
6580
fs.openSync(this.app.appDir + "/logs/rendering-deployment-process.log", "w"),
@@ -68,7 +83,7 @@ class DeployEvents {
6883
]
6984
});
7085

71-
rendererProcess.send({
86+
this.rendererProcess.send({
7287
type: 'dependencies',
7388
appDir: this.app.appDir,
7489
sitesDir: this.app.sitesDir,
@@ -80,7 +95,7 @@ class DeployEvents {
8095
previewLocation: this.app.appConfig.previewLocation
8196
});
8297

83-
rendererProcess.on('message', function(data) {
98+
this.rendererProcess.on('message', function(data) {
8499
if(data.type === 'app-rendering-results') {
85100
if(data.result === true) {
86101
event.sender.send('app-deploy-rendered', {

app/back-end/events/site.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ class SiteEvents {
323323
config.name = slug(config.name);
324324
let site = new Site(appInstance, config);
325325
let result = site.create(authorName);
326+
config.theme = 'simple';
326327
appInstance.sites[config.name] = config;
327328

328329
// Load newly created db

app/back-end/modules/deploy/github-pages.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class GithubPages {
2323
protocol: "https",
2424
host: "api.github.com",
2525
pathPrefix: "",
26-
timeout: 10000,
26+
timeout: 30000,
2727
headers: {
2828
"user-agent": "Publii"
2929
}
@@ -88,12 +88,12 @@ class GithubPages {
8888
countFiles(self.deployment.inputDir, async function (err, results) {
8989
let numberOfFiles = parseInt(results.files + results.dirs, 10);
9090

91-
if(numberOfFiles > 1000) {
91+
if(numberOfFiles > 4000) {
9292
process.send({
9393
type: 'web-contents',
9494
message: 'app-connection-error',
9595
value: {
96-
additionalMessage: 'Your website contains over 1000 items (' + numberOfFiles + ' files and directories). Currently our Github Pages implementation supports pages up to 1000 items'
96+
additionalMessage: 'Your website contains over 4000 items (' + numberOfFiles + ' files and directories). Currently our Github Pages implementation supports pages up to 4000 items'
9797
}
9898
});
9999

@@ -689,11 +689,12 @@ class GithubPages {
689689

690690
isNecessaryFile(filePath) {
691691
let filename = path.parse(filePath).base;
692-
let necessaryHiddenFiles = [
693-
'.CNAME'
692+
let unnecessaryFiles = [
693+
'.DS_Store',
694+
'thumbs.db'
694695
];
695696

696-
if(filename.substr(0,1) === '.' && necessaryHiddenFiles.indexOf(filename) === -1) {
697+
if(unnecessaryFiles.indexOf(filename) > -1) {
697698
return false;
698699
}
699700

app/back-end/modules/deploy/manual.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class ManualDeployment {
1616

1717
async initConnection() {
1818
this.deployment.setInput();
19+
this.deployment.prepareLocalFilesList();
1920

2021
switch(this.deployment.siteConfig.deployment.manual.output) {
2122
case 'catalog': this.returnCatalog(); break;

app/back-end/modules/deploy/sftp.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class SFTP {
1414
constructor(deploymentInstance = false) {
1515
this.deployment = deploymentInstance;
1616
this.connection = false;
17+
this.logTimer = false;
1718
}
1819

1920
async initConnection() {
@@ -51,6 +52,10 @@ class SFTP {
5152
connectionSettings.privateKey = fs.readFileSync(keyPath);
5253
}
5354

55+
this.logTimer = setInterval(() => {
56+
this.deployment.saveConnectionLog();
57+
}, 5000);
58+
5459
this.connection.connect(connectionSettings).then(() => {
5560
process.send({
5661
type: 'web-contents',
@@ -88,7 +93,7 @@ class SFTP {
8893

8994
self.downloadFilesList();
9095
}).catch(err => {
91-
console.log('ERR (1): ' + err);
96+
self.deployment.outputLog.push('ERR (1): ' + err);
9297
self.downloadFilesList();
9398
});
9499

@@ -136,7 +141,7 @@ class SFTP {
136141
self.deployment.compareFilesList(false);
137142
}
138143
}).catch(err => {
139-
console.log('ERR (2): ' + err + ' [<- files.publii.json]');
144+
self.deployment.outputLog.push('ERR (2): ' + err + ' [<- files.publii.json]');
140145
self.deployment.compareFilesList(false);
141146
});
142147
}
@@ -213,7 +218,7 @@ class SFTP {
213218
self.deployment.uploadFile();
214219
}).catch(err => {
215220
self.deployment.outputLog.push('- - -ERROR UPLOAD FILE - - -');
216-
self.deployment.outputLog.push(normalizePath(path.join(self.outputDir, fileToUpload.path)));
221+
self.deployment.outputLog.push(normalizePath(path.join(self.outputDir, input)));
217222
self.deployment.outputLog.push(err);
218223
self.deployment.outputLog.push('- - - - - - - - - - - - - - ');
219224
self.deployment.uploadFile();
@@ -260,7 +265,7 @@ class SFTP {
260265
message: 'app-uploading-progress',
261266
value: {
262267
progress: 8 + Math.floor(self.deployment.progressOfDeleting),
263-
operations: [self.deployment.currentOperationNumber ,self.deployment.operationsCounter]
268+
operations: [self.deployment.currentOperationNumber, self.deployment.operationsCounter]
264269
}
265270
});
266271

app/back-end/modules/import/wxr-parser.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class WxrParser {
5151
loadFile(filePath) {
5252
this.filePath = filePath;
5353
this.fileContent = fs.readFileSync(this.filePath, 'utf8');
54+
this.fileContent = this.fileContent.trim();
5455
this.parseFile();
5556
}
5657

@@ -369,9 +370,13 @@ class WxrParser {
369370
let postTags = '';
370371
let postTitle = typeof posts[i].title === 'string' ? posts[i].title : 'Untitled';
371372

372-
if(posts[i]['category'] && posts[i]['category'].length) {
373+
if(posts[i]['category'] && (posts[i]['category'].length || posts[i]['category'] instanceof Object)) {
373374
let tags = false;
374375

376+
if (!posts[i]['category'].length) {
377+
posts[i]['category'] = [posts[i]['category']];
378+
}
379+
375380
if(this.usedTaxonomy === 'tags') {
376381
tags = posts[i]['category'].filter(item => item.domain === 'post_tag');
377382
} else {

app/back-end/modules/render-html/contexts/feed.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ class RendererContextFeed extends RendererContext {
4545
let preparedText = post.text.split('#DOMAIN_NAME#').join(domainMediaPath);
4646
let contentMode = self.siteConfig.advanced.feed.showFullText ? 'fullText' : 'excerpt';
4747
let text = this.cleanUpText(preparedText);
48+
text = ContentHelper.setInternalLinks(text, self.renderer);
4849
let excerpt = ContentHelper.prepareExcerpt(this.themeConfig.config.excerptLength, preparedText);
50+
excerpt = ContentHelper.setInternalLinks(excerpt, self.renderer);
4951
let authorData = this.getAuthor('post', post.id);
5052

5153
if(contentMode !== 'fullText') {

0 commit comments

Comments
 (0)