mirror of
				https://github.com/smartfrigde/armcord.git
				synced 2024-08-14 23:56:58 +00:00 
			
		
		
		
	Plugin Loading
This commit is contained in:
		
							parent
							
								
									8cdd7e15b7
								
							
						
					
					
						commit
						22f8ea1123
					
				
					 6 changed files with 25 additions and 3 deletions
				
			
		
							
								
								
									
										4
									
								
								main.js
									
										
									
									
									
								
							
							
						
						
									
										4
									
								
								main.js
									
										
									
									
									
								
							|  | @ -101,9 +101,7 @@ function createWindow() { | |||
| // Some APIs can only be used after this event occurs.
 | ||||
| app.whenReady().then(() => { | ||||
|   createWindow(); | ||||
|   session.defaultSession.loadExtension( | ||||
|     `${require("electron").app.getAppPath()}/goosemod/` | ||||
|   ); | ||||
|   require("./utils/plugin.js"); | ||||
|   session | ||||
|     .fromPartition("some-partition") | ||||
|     .setPermissionRequestHandler((webContents, permission, callback) => { | ||||
|  |  | |||
							
								
								
									
										23
									
								
								utils/plugin.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								utils/plugin.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,23 @@ | |||
| const fs = require("fs"); | ||||
| const { app, session, remote } = require("electron"); | ||||
| const pluginFolder = __dirname + "/plugins/"; | ||||
| app.whenReady().then(() => { | ||||
| fs.readdirSync(pluginFolder).forEach((file) => { | ||||
|   console.log(file); | ||||
|   try { | ||||
|     const manifest = fs.readFileSync( | ||||
|       `${__dirname}/plugins/${file}/manifest.json`, | ||||
|       "utf8" | ||||
|     ); | ||||
|     var pluginFile = JSON.parse(manifest); | ||||
|     console.log(pluginFile); | ||||
|     session.defaultSession.loadExtension(`${__dirname}/plugins/${file}/`); | ||||
|     console.log( | ||||
|       `%cLoaded ${pluginFile.name} made by ${pluginFile.author}`, | ||||
|       "color:red" | ||||
|     ); | ||||
|   } catch (err) { | ||||
|     console.error(err); | ||||
|   } | ||||
| }); | ||||
| }); | ||||
|  | @ -1,6 +1,7 @@ | |||
| { | ||||
|     "name": "GooseMod", | ||||
| 	"version": "1.0", | ||||
|     "author": "AAGaming00", | ||||
|     "description": "Loads GooseMod, a discord client modification", | ||||
|     "background": { | ||||
|         "scripts": [ | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue