Skip to content

Commit 8cb60c9

Browse files
committed
Merge branch 'v.0.45'
2 parents a2ce42f + d61037c commit 8cb60c9

Some content is hidden

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

75 files changed

+25353
-22920
lines changed

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v16.19.1
1+
v18.19.0

README.md

Lines changed: 2 additions & 2 deletions
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.44.4 (build 16557)**
12+
**Current version: 0.45.0 (build 16606)**
1313

1414
## Why Publii?
1515
Unlike static-site generators that are often unwieldy and difficult to use, Publii provides an
@@ -41,7 +41,7 @@ If you want to build newest version of Publii or contribute to the Publii code,
4141
## Getting Started
4242
You can learn more about getting started in our [User documentation](https://getpublii.com/docs/) or [Developer documentation](https://getpublii.com/dev/).
4343
If you have any questions or suggestions, or just need some help with using Publii, you can
44-
visit our [Community Hub](https://getpublii.com/forum) or follow us on [Twitter](https://twitter.com/GetPublii)
44+
visit our [Community Hub](https://github.com/GetPublii/Publii/discussions) or follow us on [Twitter](https://twitter.com/GetPublii)
4545

4646
### Learn More
4747

app/back-end/app.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44

55
// Necessary packages
66
const fs = require('fs-extra');
7+
const os = require('os');
78
const path = require('path');
8-
const { Database } = require('node-sqlite3-wasm');
9+
const Database = os.platform() === 'linux' ? require('node-sqlite3-wasm').Database : require('better-sqlite3');
910
const compare = require('node-version-compare');
1011
const normalizePath = require('normalize-path');
1112
const url = require('url');

app/back-end/builddata.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"version": "0.44.4",
3-
"build": 16557
4-
}
2+
"version": "0.45.0",
3+
"build": 16606
4+
}

app/back-end/events/deploy.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const fs = require('fs-extra');
22
const ipcMain = require('electron').ipcMain;
33
const Deployment = require('../modules/deploy/deployment.js');
44
const childProcess = require('child_process');
5+
const stripTags = require('striptags');
56

67
class DeployEvents {
78
constructor(appInstance) {
@@ -123,14 +124,14 @@ class DeployEvents {
123124
event.sender.send('app-deploy-render-error', {
124125
message: [{
125126
message: errorTitle,
126-
desc: errorDesc
127+
desc: stripTags(errorDesc)
127128
}]
128129
});
129130
}
130131
} else {
131132
event.sender.send(data.type, {
132133
progress: data.progress,
133-
message: data.message
134+
message: stripTags((data.message).toString())
134135
});
135136
}
136137
});
@@ -156,7 +157,8 @@ class DeployEvents {
156157
type: 'dependencies',
157158
appDir: this.app.appDir,
158159
sitesDir: this.app.sitesDir,
159-
siteConfig: deploymentConfig
160+
siteConfig: deploymentConfig,
161+
useFtpAlt: this.app.appConfig.experimentalFeatureAppAutoBeautifySourceCode
160162
});
161163

162164
this.deploymentProcess.on('message', function(data) {
@@ -174,9 +176,14 @@ class DeployEvents {
174176
});
175177
}
176178

177-
testConnection(deploymentConfig, siteName, uuid) {
178-
let deployment = new Deployment(this.app.app.getPath('logs'), this.app.sitesDir, deploymentConfig);
179-
deployment.testConnection(this.app, deploymentConfig, siteName, uuid);
179+
async testConnection(deploymentConfig, siteName, uuid) {
180+
let deployment = new Deployment(
181+
this.app.app.getPath('logs'),
182+
this.app.sitesDir,
183+
deploymentConfig,
184+
this.app.appConfig.experimentalFeatureAppFtpAlt
185+
);
186+
await deployment.testConnection(this.app, deploymentConfig, siteName, uuid);
180187
}
181188
}
182189

app/back-end/events/preview.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const shell = electron.shell;
55
const ipcMain = electron.ipcMain;
66
const childProcess = require('child_process');
77
const UtilsHelper = require('../helpers/utils.js');
8+
const stripTags = require('striptags');
89

910
class PreviewEvents {
1011
/**
@@ -90,7 +91,7 @@ class PreviewEvents {
9091
event.sender.send('app-preview-render-error', {
9192
message: [{
9293
message: errorTitle,
93-
desc: errorDesc
94+
desc: stripTags(errorDesc)
9495
}]
9596
});
9697
}
@@ -142,7 +143,7 @@ class PreviewEvents {
142143
} else {
143144
event.sender.send(data.type, {
144145
progress: data.progress,
145-
message: data.message
146+
message: stripTags((data.message).toString())
146147
});
147148
}
148149
});

app/back-end/events/site.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
const fs = require('fs-extra');
2+
const os = require('os');
23
const path = require('path');
34
const slug = require('./../helpers/slug');
45
const passwordSafeStorage = require('keytar');
56
const ipcMain = require('electron').ipcMain;
67
const Site = require('../site.js');
78
const Themes = require('../themes.js');
8-
const { Database } = require('node-sqlite3-wasm');
9+
const Database = os.platform() === 'linux' ? require('node-sqlite3-wasm').Database : require('better-sqlite3');
910
const DBUtils = require('../helpers/db.utils.js');
1011
const UtilsHelper = require('../helpers/utils.js');
1112
const normalizePath = require('normalize-path');

app/back-end/helpers/db.utils.js

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
const os = require('os');
2+
13
/*
24
* Other helper functions
35
*/
46
class DBUtils {
57
constructor (dbInstance) {
68
this.DB = dbInstance;
79
this.statement = '';
10+
this.useWASM = os.platform() === 'linux';
811
}
912

1013
prepare (sqlStatement) {
@@ -13,30 +16,54 @@ class DBUtils {
1316
}
1417

1518
get (paramsObject = null) {
16-
if (paramsObject) {
17-
paramsObject = this.transformParams(paramsObject);
18-
return this.DB.get(this.statement, paramsObject);
19+
if (this.useWASM) {
20+
if (paramsObject) {
21+
paramsObject = this.transformParams(paramsObject);
22+
return this.DB.get(this.statement, paramsObject);
23+
}
24+
25+
return this.DB.get(this.statement);
1926
}
2027

21-
return this.DB.get(this.statement);
28+
if (paramsObject !== null) {
29+
return this.DB.prepare(this.statement).get(paramsObject);
30+
}
31+
32+
return this.DB.prepare(this.statement).get();
2233
}
2334

2435
run (paramsObject = null) {
25-
if (paramsObject) {
26-
paramsObject = this.transformParams(paramsObject);
27-
return this.DB.run(this.statement, paramsObject);
36+
if (this.useWASM) {
37+
if (paramsObject) {
38+
paramsObject = this.transformParams(paramsObject);
39+
return this.DB.run(this.statement, paramsObject);
40+
}
41+
42+
return this.DB.run(this.statement);
2843
}
2944

30-
return this.DB.run(this.statement);
45+
if (paramsObject !== null) {
46+
return this.DB.prepare(this.statement).run(paramsObject);
47+
}
48+
49+
return this.DB.prepare(this.statement).run();
3150
}
3251

3352
all (paramsObject = null) {
34-
if (paramsObject) {
35-
paramsObject = this.transformParams(paramsObject);
36-
return this.DB.all(this.statement, paramsObject);
53+
if (this.useWASM) {
54+
if (paramsObject) {
55+
paramsObject = this.transformParams(paramsObject);
56+
return this.DB.all(this.statement, paramsObject);
57+
}
58+
59+
return this.DB.all(this.statement);
60+
}
61+
62+
if (paramsObject !== null) {
63+
return this.DB.prepare(this.statement).all(paramsObject);
3764
}
3865

39-
return this.DB.all(this.statement);
66+
return this.DB.prepare(this.statement).all();
4067
}
4168

4269
exec (sqlQueries) {

app/back-end/helpers/slug.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ function createSlug(textToSlugify, filenameMode = false, saveLowerChars = false)
5555
['ü', 'ue'],
5656
['Ü', 'UE'],
5757
['ß', 'ss'],
58-
['ẞ', 'SS']
58+
['ẞ', 'SS'],
59+
['«', ''],
60+
['»', ''],
61+
['$', '']
5962
] });
6063

6164
if(!filenameMode) {

app/back-end/helpers/specs/slug.spec.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,17 @@ describe('Slug creation', function() {
5252
assert.strictEqual('indexhtml', slug('index.html', false));
5353
assert.strictEqual('index.html', slug('index.html', true));
5454
});
55+
56+
it('should remove some special characters', function() {
57+
assert.strictEqual('title-with-and-arrows', slug('Title with « and » arrows'));
58+
assert.strictEqual('title-with-typoraphical-quotes-and-normal-quotes', slug('Title with „typoraphical quotes“ and "normal quotes"'));
59+
assert.strictEqual('title-with-brackets-in-different-forms', slug('Title (with) [brackets] {in} ⟨different forms⟩'));
60+
assert.strictEqual('title-with-different-types-of-dashes', slug('Title with different - types – of — dashes'));
61+
assert.strictEqual('title-with-many-apostrophes-many-many', slug('Title with many \' apostrophes \‘ many \’ many'));
62+
assert.strictEqual('title-with-dots-and-commas', slug('Title with dots . and commas,'));
63+
assert.strictEqual('and-another-characters', slug('And another characters ; : ? !'));
64+
assert.strictEqual('also-ellipsis', slug('Also ellipsis…'));
65+
assert.strictEqual('and-slashes', slug('And slashes \/ \\'));
66+
assert.strictEqual('and-other-chars', slug('And other chars * # $ @ ^ % ♥ ☆'));
67+
});
5568
});

0 commit comments

Comments
 (0)