aboutsummaryrefslogtreecommitdiffstats
path: root/src/stores
diff options
context:
space:
mode:
authorLibravatar Bennett <hello@vantezzen.io>2020-04-12 13:33:11 +0200
committerLibravatar GitHub <noreply@github.com>2020-04-12 12:33:11 +0100
commit9ab996a5f01ef88d72d8d5bb28fea518db8c88e6 (patch)
tree58cdb855c1074ce54d0d669910328d4ebb805d2a /src/stores
parentFix cache clearing not working in Windows 10 (#541) (#544) (diff)
downloadferdium-app-9ab996a5f01ef88d72d8d5bb28fea518db8c88e6.tar.gz
ferdium-app-9ab996a5f01ef88d72d8d5bb28fea518db8c88e6.tar.zst
ferdium-app-9ab996a5f01ef88d72d8d5bb28fea518db8c88e6.zip
Improve user scripts (#559)
* Add template to user.js creation * Add Userscript library * Add internalOpen function * Fix lint * Remove excess line break
Diffstat (limited to 'src/stores')
-rw-r--r--src/stores/ServicesStore.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js
index 54befee77..19e6f8299 100644
--- a/src/stores/ServicesStore.js
+++ b/src/stores/ServicesStore.js
@@ -351,7 +351,17 @@ export default class ServicesStore extends Store {
351 351
352 // Create and open file 352 // Create and open file
353 const filePath = path.join(directory, file); 353 const filePath = path.join(directory, file);
354 await fs.ensureFile(filePath); 354 if (file === 'user.js') {
355 if (!await fs.exists(filePath)) {
356 await fs.writeFile(filePath, `module.exports = (config, Ferdi) => {
357 // Write your scripts here
358 console.log("Hello, World!", config);
359}
360`);
361 }
362 } else {
363 await fs.ensureFile(filePath);
364 }
355 shell.showItemInFolder(filePath); 365 shell.showItemInFolder(filePath);
356 } 366 }
357 367