diff --git a/index.html b/index.html
index a25aec1..124e59e 100644
--- a/index.html
+++ b/index.html
@@ -9,21 +9,7 @@
GD Video Player
-
-
-
-
-
-
-
diff --git a/main.js b/main.js
index 2d962b3..ae6f228 100644
--- a/main.js
+++ b/main.js
@@ -2,8 +2,6 @@
const { app, BrowserWindow } = require('electron')
const path = require('path')
-app.allowRendererProcessReuse = true
-
function createWindow() {
// Create the browser window.
const mainWindow = new BrowserWindow({
@@ -13,8 +11,10 @@ function createWindow() {
maximizable: true,
resizable: false,
webPreferences: {
- webviewTag: true,
- nodeIntegration: true,
+ contextIsolation: true,
+ sandbox: true,
+ nodeIntegration: false,
+ webviewTag: false,
preload: path.join(__dirname, 'preload.js')
}
})
diff --git a/package.json b/package.json
index 5bae6e7..7b8659f 100644
--- a/package.json
+++ b/package.json
@@ -10,10 +10,10 @@
"dist": "electron-builder"
},
"devDependencies": {
- "asar": "^2.1.0",
- "electron": "^13.6.6",
- "electron-builder": "^22.4.0",
- "electron-packager": "^14.2.1"
+ "asar": "^3.2.0",
+ "electron": "^43.0.0",
+ "electron-builder": "^26.15.3",
+ "electron-packager": "^17.1.2"
},
"dependencies": {},
"license": "MIT",
diff --git a/preload.js b/preload.js
index f9a6265..b140986 100644
--- a/preload.js
+++ b/preload.js
@@ -1,2 +1,12 @@
-// All of the Node.js APIs are available in the preload process.
-// It has the same sandbox as a Chrome extension.
\ No newline at end of file
+const { contextBridge, ipcRenderer } = require('electron')
+
+const VALID_SIZES = ['small', 'medium', 'large']
+
+contextBridge.exposeInMainWorld('gdPlayer', {
+ resizeWindow: (size) => {
+ if (!VALID_SIZES.includes(size)) return
+ ipcRenderer.send(`resize-window-${size}`)
+ },
+ maximize: () => ipcRenderer.send('maximize'),
+ toggleAlwaysOnTop: () => ipcRenderer.send('always-on-top')
+})
diff --git a/renderer.js b/renderer.js
index 995ce89..5113484 100644
--- a/renderer.js
+++ b/renderer.js
@@ -1,17 +1,25 @@
$(function() {
$('#load_button').click(function() {
- url = $('#url').val()
- id = null
+ const url = $('#url').val()
+ let id = null
- // 입력된 값에서 ID 추출
- if (url.match(/^https:\/\/drive\.google\.com\/open\?id\=(.*)/g)) {
- id = url.split('=')[1]
+ // 입력된 값에서 ID 추출 (기존 open?id=... 링크와 현재 file/d/ID/view 링크 모두 지원)
+ try {
+ const parsed = new URL(url)
+ const fileMatch = parsed.pathname.match(/^\/file\/d\/([^/]+)/)
+ if (fileMatch) {
+ id = fileMatch[1]
+ } else if (parsed.pathname === '/open' && parsed.searchParams.has('id')) {
+ id = parsed.searchParams.get('id')
+ }
+ } catch (e) {
+ id = null
}
// ID를 찾으면 작업 처리
if (id) {
// 플레이어 삽입 스크립트
- player = '