Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
O
Oyun Parkı API
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ı API
Commits
e1ce20ff
Kaydet (Commit)
e1ce20ff
authored
May 06, 2021
tarafından
Hakkı Dizdar
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Park isimlerine Değerli Türk Bilim Insanlarının isimleri athıf edildi
üst
a7738da3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
144 additions
and
5 deletions
+144
-5
create.js
docker/controllers/create.js
+4
-0
names.js
docker/names.js
+129
-0
index.js
index.js
+11
-5
No files found.
docker/controllers/create.js
Dosyayı görüntüle @
e1ce20ff
const
Docker
=
require
(
"dockerode"
);
const
Docker
=
require
(
"dockerode"
);
const
docker
=
new
Docker
();
const
docker
=
new
Docker
();
const
{
generate
}
=
require
(
"../names"
);
const
start
=
async
(
image
,
res
)
=>
{
const
start
=
async
(
image
,
res
)
=>
{
const
port
=
Math
.
floor
(
Math
.
random
()
*
(
55000
-
50000
)
+
50000
).
toString
();
const
port
=
Math
.
floor
(
Math
.
random
()
*
(
55000
-
50000
)
+
50000
).
toString
();
const
name
=
await
generate
();
docker
.
createContainer
(
docker
.
createContainer
(
{
{
name
:
`
${
name
.
replace
()}
Parki`
.
replace
(
" "
,
"-"
),
Image
:
image
,
Image
:
image
,
AttachStdin
:
false
,
AttachStdin
:
false
,
AttachStdout
:
true
,
AttachStdout
:
true
,
...
...
docker/names.js
0 → 100644
Dosyayı görüntüle @
e1ce20ff
const
Docker
=
require
(
"dockerode"
);
const
docker
=
new
Docker
();
// Değerli Türk Bilim Insanlarının isimleri parklarımıza ithaf edildi.
// https://tr.wikipedia.org/wiki/T%C3%BCrk_bilim_insanlar%C4%B1_listesi
const
names
=
{
"Ahmet Cevdet Paşa"
:
"Ahmet-Cevdet-Pasa"
,
"Ahmed Resmî Efendi"
:
"Ahmed-Resm-Efendi"
,
"Abbas Vesim Efendi"
:
"Abbas-Vesim-Efendi"
,
"Ahmed Cemal Eringen"
:
"Ahmed-Cemal-Eringen"
,
"Ahmet S. Çakmak"
:
"Ahmet-S-Cakmak"
,
"Ahmet Ziyaeddin Akçasu"
:
"Ahmet-Ziyaeddin-Akcasu"
,
Ak
ş
emseddin
:
"Aksemseddin"
,
"Ali Akansu"
:
"Ali-Akansu"
,
"Ali Erdemir"
:
"Ali-Erdemir"
,
"Ali Demirsoy"
:
"Ali-Demirsoy"
,
"Ali Kuşçu"
:
"Ali-Kuscu"
,
"Ali Nesin"
:
"Ali-Nesin"
,
"Asım Orhan Barut"
:
"Asim-Orhan-Barut"
,
"Ataç İmamoğlu"
:
"Atac-Imamoglu"
,
"Attila Aşkar"
:
"Attila-Askar"
,
"Asuman Baytop"
:
"Asuman-Baytop"
,
"Asuman Özdağlar"
:
"Asuman-Ozdaglar"
,
"Aydın Sayılı"
:
"Aydin-Sayili"
,
"Aykut Barka"
:
"Aykut-Barka"
,
"Aykut Kence"
:
"Aykut-Kence"
,
"Aziz Sancar"
:
"Aziz-Sancar"
,
"Bahattin Baysal"
:
"Bahattin-Baysal"
,
"Behram Kurşunoğlu"
:
"Behram-Kursunoglu"
,
"Betül Kaçar"
:
"Betul-Kacar"
,
"Bilge Demirköz"
:
"Bilge-Demirkoz"
,
"Bursalı Kadızade Rumi"
:
"Bursali-Kadizade-Rumi"
,
"Cahit Arf"
:
"Cahit-Arf"
,
"Canan Dağdeviren"
:
"Canan-Dagdeviren"
,
"Cavid Erginsoy"
:
"Cavid-Erginsoy"
,
"Celâl Şengör"
:
"Cell-Sengor"
,
"Daron Acemoğlu"
:
"Daron-Acemoglu"
,
"Dilhan Eryurt"
:
"Dilhan-Eryurt"
,
"Derya Akkaynak"
:
"Derya-Akkaynak"
,
"Ekrem Akurgal"
:
"Ekrem-Akurgal"
,
"Erdal İnönü"
:
"Erdal-Inonu"
,
"Ergi Deniz Özsoy"
:
"Ergi-Deniz-Ozsoy"
,
"Erhan Çınlar"
:
"Erhan-Cinlar"
,
"Erzurumlu İbrahim Hakkı"
:
"Erzurumlu-Ibrahim-Hakki"
,
"Engin Arık"
:
"Engin-Arik"
,
Farabi
:
"Farabi"
,
"Fazıl Erdoğan"
:
"Fazil-Erdogan"
,
Fergani
:
"Fergani"
,
"Feza Gürsey"
:
"Feza-Gursey"
,
"Feryal Özel"
:
"Feryal-Ozel"
,
"Galip Ulsoy"
:
"Galip-Ulsoy"
,
"Gazi Yaşargil"
:
"Gazi-Yasargil"
,
"Gelenbevi İsmail Efendi"
:
"Gelenbevi-Ismail-Efendi"
,
"Halil İnalcık"
:
"Halil-Inalcik"
,
"Hezârfen Ahmed Çelebi"
:
"Hezrfen-Ahmed-Celebi"
,
"Hulusi Behçet"
:
"Hulusi-Behcet"
,
"Hüseyin Yılmaz"
:
"Huseyin-Yilmaz"
,
"İbn Türk"
:
"Ibn-Turk"
,
"İhsan Ketin"
:
"Ihsan-Ketin"
,
"İlber Ortaylı"
:
"Ilber-Ortayli"
,
"İlhan Aksay"
:
"Ilhan-Aksay"
,
"Janet Akyüz Mattei"
:
"Janet-Akyuz-Mattei"
,
"Kâşgarlı Mahmud"
:
"Ksgarli-Mahmud"
,
"Kâtip Çelebi"
:
"Ktip-Celebi"
,
"Kemal Reis"
:
"Kemal-Reis"
,
"Lagarî Hasan Çelebi"
:
"Lagar-Hasan-Celebi"
,
"Masatoşi Gündüz İkeda"
:
"Masatosi-Gunduz-Ikeda"
,
"Mehmet Fuad Köprülü"
:
"Mehmet-Fuad-Koprulu"
,
"Mehmet Özgür Oktel"
:
"Mehmet-Ozgur-Oktel"
,
"Metin Gürses"
:
"Metin-Gurses"
,
"Mete Atatüre"
:
"Mete-Atature"
,
"Mirim Çelebi"
:
"Mirim-Celebi"
,
"Merkez Efendi"
:
"Merkez-Efendi"
,
"Mustafa İnan"
:
"Mustafa-Inan"
,
"Muzafer Sherif"
:
"Muzafer-Sherif"
,
"Müneccimbaşı Ahmed Dede"
:
"Muneccimbasi-Ahmed-Dede"
,
"Nihat Berker"
:
"Nihat-Berker"
,
"Okan K. Ersoy"
:
"Okan-K-Ersoy"
,
"Oktay Sinanoğlu"
:
"Oktay-Sinanoglu"
,
"Ongun Alsaç"
:
"Ongun-Alsac"
,
"Piri Reis"
:
"Piri-Reis"
,
"Ratip Berker"
:
"Ratip-Berker"
,
"Reşit Süreyya Gürsey"
:
"Resit-Sureyya-Gursey"
,
"Selman Akbulut"
:
"Selman-Akbulut"
,
"Seydi Ali Reis"
:
"Seydi-Ali-Reis"
,
"Sırrı Erinç"
:
"Sirri-Erinc"
,
"Sinan Keten"
:
"Sinan-Keten"
,
"Suha Gürsey"
:
"Suha-Gursey"
,
"Sabuncuoğlu Şerefeddin"
:
"Sabuncuoglu-Serefeddin"
,
Takiy
ü
ddin
:
"Takiyuddin"
,
"Tamer Başar"
:
"Tamer-Basar"
,
"Turhan Baytop"
:
"Turhan-Baytop"
,
"Uğur Şahin"
:
"Ugur-Sahin"
,
"Uluğ Bey"
:
"Ulug-Bey"
,
"Umran İnan"
:
"Umran-Inan"
,
"Vamık Volkan"
:
"Vamik-Volkan"
,
"Yavuz Nutku"
:
"Yavuz-Nutku"
,
};
const
generate
=
()
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
docker
.
listContainers
({
all
:
true
})
.
then
((
cnt
)
=>
{
const
containers
=
cnt
.
map
((
c
)
=>
{
return
c
.
Names
[
0
].
substring
(
1
);
});
_names
=
Object
.
values
(
names
).
filter
(
(
n
)
=>
!
containers
.
some
((
c
)
=>
{
return
c
.
startsWith
(
n
);
})
);
resolve
(
_names
[
Math
.
floor
(
Math
.
random
()
*
_names
.
length
)]);
})
.
catch
(()
=>
{
reject
();
});
});
};
const
convert
=
(
n
)
=>
{
const
name
=
n
.
replace
(
/^
\/(
.*
)
-Parki$/gm
,
"$1"
);
return
`
${
Object
.
keys
(
names
).
find
((
k
)
=>
names
[
k
]
===
name
)}
Parkı`
;
};
module
.
exports
.
generate
=
generate
;
module
.
exports
.
convert
=
convert
;
index.js
Dosyayı görüntüle @
e1ce20ff
...
@@ -5,6 +5,7 @@ const Docker = require("dockerode");
...
@@ -5,6 +5,7 @@ const Docker = require("dockerode");
const
docker
=
new
Docker
();
const
docker
=
new
Docker
();
const
ws
=
require
(
"express-ws"
)(
app
);
const
ws
=
require
(
"express-ws"
)(
app
);
const
cors
=
require
(
"cors"
);
const
cors
=
require
(
"cors"
);
const
{
convert
}
=
require
(
"./docker/names"
);
app
.
use
(
cors
());
app
.
use
(
cors
());
app
.
use
(
compression
());
app
.
use
(
compression
());
app
.
use
(
express
.
json
());
app
.
use
(
express
.
json
());
...
@@ -16,11 +17,16 @@ app.get("/", (_, res) => {
...
@@ -16,11 +17,16 @@ app.get("/", (_, res) => {
app
.
get
(
"/containers"
,
(
_
,
res
)
=>
{
app
.
get
(
"/containers"
,
(
_
,
res
)
=>
{
docker
.
listContainers
({
all
:
true
},
function
(
_
,
containers
)
{
docker
.
listContainers
({
all
:
true
},
function
(
_
,
containers
)
{
res
.
send
(
res
.
send
(
containers
.
filter
(
containers
(
i
)
=>
.
filter
(
i
.
Image
.
startsWith
(
"nyxteam/oyunparki-small"
)
||
(
c
)
=>
i
.
Image
.
startsWith
(
"nyxteam/oyunparki-full"
)
c
.
Image
.
startsWith
(
"nyxteam/oyunparki-small"
)
||
c
.
Image
.
startsWith
(
"nyxteam/oyunparki-full"
)
)
)
.
map
((
c
)
=>
{
c
.
Names
[
0
]
=
convert
(
c
.
Names
[
0
]);
return
c
;
})
);
);
});
});
});
});
...
@@ -38,7 +44,7 @@ app.get("/images", (_, res) => {
...
@@ -38,7 +44,7 @@ app.get("/images", (_, res) => {
});
});
app
.
post
(
"/create"
,
(
req
,
res
)
=>
{
app
.
post
(
"/create"
,
(
req
,
res
)
=>
{
require
(
"./docker/controllers/create"
)(
req
.
body
.
image
,
res
);
require
(
"./docker/controllers/create"
)(
req
,
res
);
});
});
app
.
post
(
"/restart"
,
(
req
,
res
)
=>
{
app
.
post
(
"/restart"
,
(
req
,
res
)
=>
{
...
...
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