diff --git a/css/style.css b/css/style.css new file mode 100644 index 0000000..0b83a89 --- /dev/null +++ b/css/style.css @@ -0,0 +1,13 @@ +@media (prefers-color-scheme: dark) { + body { + background: rgb(18, 18, 18); + color: rgb(240, 240, 240); + } +} + +@media (prefers-color-scheme: light) { + body { + background: rgb(240, 240, 240); + color: rgb(18, 18, 18); + } +} diff --git a/pages/index.html b/pages/index.html index 69d8e82..f80e177 100644 --- a/pages/index.html +++ b/pages/index.html @@ -10,6 +10,9 @@ http-equiv="X-Content-Security-Policy" content="default-src 'self'; script-src 'self'" /> + + + Discord Video Sharing diff --git a/src/main.ts b/src/main.ts index cbdd499..a89e82f 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,29 +1,34 @@ import { BrowserWindow, app, ipcMain } from "electron"; import path = require("path"); -/* import ffmpegPath = require("ffmpeg-static"); */ +import ffmpegPath = require("ffmpeg-static"); const createWindow = () => { const win = new BrowserWindow({ - width: 800, - height: 600, + width: 1280, + height: 720, webPreferences: { preload: path.join(__dirname, "preload.js"), }, }); win.loadFile(path.join(path.resolve(__dirname, ".."), "pages", "index.html")); + win.webContents.openDevTools(); // debug }; app.whenReady().then(() => { - ipcMain.handle("ping", () => "pong"); + ipcMain.handle("ffmpeg", () => ffmpegPath); createWindow(); app.on("activate", () => { - if (BrowserWindow.getAllWindows().length === 0) createWindow(); + if (BrowserWindow.getAllWindows().length === 0) { + createWindow(); + } }); }); app.on("window-all-closed", () => { - if (process.platform !== "darwin") app.quit(); + if (process.platform !== "darwin") { + app.quit(); + } }); diff --git a/src/preload.ts b/src/preload.ts index 6b04f68..b97ee56 100644 --- a/src/preload.ts +++ b/src/preload.ts @@ -1,8 +1,5 @@ import { contextBridge, ipcRenderer } from "electron"; -contextBridge.exposeInMainWorld("versions", { - node: () => process.versions.node, - chrome: () => process.versions.chrome, - electron: () => process.versions.electron, - ping: () => ipcRenderer.invoke("ping"), +contextBridge.exposeInMainWorld("internals", { + ffmpeg: () => ipcRenderer.invoke("ffmpeg"), }); diff --git a/src/scripts/renderer.ts b/src/scripts/renderer.ts index 336c2c7..388809e 100644 --- a/src/scripts/renderer.ts +++ b/src/scripts/renderer.ts @@ -1,13 +1,11 @@ -/* Preload variables */ -var versions: any; +/* Context bridge */ +let internals: { + ffmpeg: () => Promise; +}; -const information = document.getElementById("info"); - -information.innerText = `Cette application utilise Chrome (v${versions.chrome()}), Node.js (v${versions.node()}), et Electron (v${versions.electron()})`; - -const func = async () => { - const response = await versions.ping(); +const get_ffmpeg = async () => { + const response = await internals.ffmpeg(); console.log(response); }; -func(); +get_ffmpeg(); diff --git a/tsconfig.json b/tsconfig.json index 495a33c..4e12aea 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,5 +9,5 @@ "*": ["node_modules/*"] } }, - "include": ["src/**/*"] + "include": ["src/**/*.ts"] }