Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
O
Oyun Parkı-pardusacikhack
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Nyx
Oyun Parkı-pardusacikhack
Commits
7ff53935
Kaydet (Commit)
7ff53935
authored
May 05, 2021
tarafından
Eda Altuntaş
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Deep Linking yerine IPC teknolojisine geçildi
üst
0705aa40
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
59 additions
and
39 deletions
+59
-39
background.js
src/background.js
+18
-3
index.js
src/deeplink/index.js
+0
-32
index.js
src/ipc/index.js
+29
-0
preload.js
src/preload.js
+3
-0
Containers.vue
src/views/Containers.vue
+6
-4
vue.config.js
vue.config.js
+3
-0
No files found.
src/background.js
Dosyayı görüntüle @
7ff53935
...
...
@@ -3,8 +3,10 @@
import
{
app
,
protocol
,
BrowserWindow
}
from
"electron"
;
import
{
createProtocol
}
from
"vue-cli-plugin-electron-builder/lib"
;
import
installExtension
,
{
VUEJS_DEVTOOLS
}
from
"electron-devtools-installer"
;
const
path
=
require
(
"path"
);
const
isDevelopment
=
process
.
env
.
NODE_ENV
!==
"production"
;
let
mainWindow
;
// Scheme must be registered before the app is ready
protocol
.
registerSchemesAsPrivileged
([
{
scheme
:
"app"
,
privileges
:
{
secure
:
true
,
standard
:
true
}
}
...
...
@@ -18,10 +20,11 @@ async function createWindow() {
webPreferences
:
{
// Use pluginOptions.nodeIntegration, leave this alone
// See nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration for more info
nodeIntegration
:
process
.
env
.
ELECTRON_NODE_INTEGRATION
nodeIntegration
:
process
.
env
.
ELECTRON_NODE_INTEGRATION
,
preload
:
path
.
join
(
__dirname
,
"preload.js"
)
}
});
mainWindow
=
win
;
if
(
process
.
env
.
WEBPACK_DEV_SERVER_URL
)
{
// Load the url of the dev server if in development mode
await
win
.
loadURL
(
process
.
env
.
WEBPACK_DEV_SERVER_URL
);
...
...
@@ -31,7 +34,6 @@ async function createWindow() {
// Load the index.html when not in development
win
.
loadURL
(
"app://./index.html"
);
}
require
(
"./deeplink"
)(
app
,
win
,
isDevelopment
);
}
// Quit when all windows are closed.
...
...
@@ -49,6 +51,19 @@ app.on("activate", () => {
if
(
BrowserWindow
.
getAllWindows
().
length
===
0
)
createWindow
();
});
const
gotTheLock
=
app
.
requestSingleInstanceLock
();
if
(
!
gotTheLock
)
{
app
.
quit
();
}
else
{
app
.
on
(
"second-instance"
,
()
=>
{
if
(
mainWindow
)
{
if
(
mainWindow
.
isMinimized
())
mainWindow
.
restore
();
mainWindow
.
focus
();
}
});
require
(
"./ipc"
)();
}
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
...
...
src/deeplink/index.js
deleted
100644 → 0
Dosyayı görüntüle @
0705aa40
import
{
Deeplink
}
from
"electron-deeplink"
;
const
{
exec
}
=
require
(
"child_process"
);
const
handler
=
(
app
,
mainWindow
,
isDevelopment
)
=>
{
const
deeplink
=
new
Deeplink
({
app
,
mainWindow
,
protocol
:
isDevelopment
?
"oyunparki-dev"
:
"oyunparki"
});
deeplink
.
on
(
"received"
,
link
=>
{
link
=
link
.
split
(
"://"
)[
1
].
split
(
"/"
);
const
func
=
link
[
0
],
container
=
link
[
1
];
if
([
"viewer"
,
"terminal"
].
indexOf
(
func
)
===
-
1
)
{
return
;
}
if
(
func
===
"terminal"
)
{
if
(
process
.
platform
===
"win32"
)
{
exec
(
`start cmd.exe /c docker exec -it
${
container
}
sh`
);
}
else
{
exec
(
`docker exec -it
${
container
}
sh`
);
}
}
console
.
log
(
func
);
console
.
log
(
container
);
});
};
module
.
exports
=
handler
;
src/ipc/index.js
0 → 100644
Dosyayı görüntüle @
7ff53935
const
{
ipcMain
}
=
require
(
"electron"
);
const
{
exec
}
=
require
(
"child_process"
);
const
handler
=
()
=>
{
ipcMain
.
on
(
"terminal"
,
(
_
,
data
)
=>
{
if
(
process
.
platform
===
"win32"
)
{
exec
(
"start"
,
[
"cmd"
,
"/c"
,
"docker"
,
"exec"
,
"-it"
,
data
,
"sh"
]);
}
else
{
exec
(
"exo-open"
,
[
"--launch"
,
"TerminalEmulator"
,
"docker"
,
"exec"
,
"-it"
,
data
,
"sh"
]);
}
});
ipcMain
.
on
(
"viewer"
,
(
_
,
data
)
=>
{
if
(
process
.
platform
===
"win32"
)
{
exec
(
"virt-viewer"
,
[
`spice://localhost:
${
data
}
`
]);
}
else
{
exec
(
"remote-viewer"
,
[
`spice://localhost:
${
data
}
`
]);
}
});
};
module
.
exports
=
handler
;
src/preload.js
0 → 100644
Dosyayı görüntüle @
7ff53935
import
{
ipcRenderer
}
from
"electron"
;
window
.
ipcRenderer
=
ipcRenderer
;
src/views/Containers.vue
Dosyayı görüntüle @
7ff53935
...
...
@@ -44,9 +44,8 @@
}"
>
<a
v-bind:href=
"
`$
{$protocol}://viewer/${container.Ports[0].PublicPort}`
"
href=
"#"
v-on:click=
"() => f('viewer', container.Ports[0].PublicPort)"
v-if=
"container.Ports[0]"
>
<icon
...
...
@@ -56,7 +55,7 @@
v-bind:class=
"$style['icon-border']"
/>
</a>
<a
v-bind:href=
"`$
{$protocol}://terminal/${container.Id}`
">
<a
href=
"#"
v-on:click=
"() => f('terminal', container.Id)
"
>
<icon
icon=
"terminal"
size=
"2x"
...
...
@@ -137,6 +136,9 @@ export default {
.
finally
(()
=>
{
this
.
getContainers
();
});
},
f
:
function
(
f
,
v
)
{
window
.
ipcRenderer
.
send
(
f
,
v
);
}
}
};
...
...
vue.config.js
Dosyayı görüntüle @
7ff53935
...
...
@@ -37,6 +37,9 @@ module.exports = {
fallbackLocale
:
"tr"
,
localeDir
:
"locales"
,
enableInSFC
:
false
},
electronBuilder
:
{
preload
:
"src/preload.js"
}
}
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment