Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
3cbf153f
authored
Jan 28, 2013
by
cloud
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
ssh://giccero.cloud.ik.bme.hu/cloud
parents
d9103dc8
d3cded80
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
126 additions
and
32 deletions
+126
-32
miscellaneous/store-server/CloudStore.py
+15
-10
miscellaneous/temp-design/teszt-wm.html
+1
-0
one/templates/base.html
+24
-0
one/templates/home.html
+86
-22
No files found.
miscellaneous/store-server/CloudStore.py
View file @
3cbf153f
...
...
@@ -45,7 +45,7 @@ def neptun_POST(neptun):
#DOWNLOAD LINK GENERATOR
elif
request
.
json
[
'CMD'
]
==
'DOWNLOAD'
:
dl_path
=
home_path
+
'/'
+
request
.
json
[
'PATH'
]
dl_path
=
os
.
path
.
norm
path
(
dl_path
)
dl_path
=
os
.
path
.
real
path
(
dl_path
)
if
not
dl_path
.
startswith
(
home_path
):
abort
(
400
,
'Invalid download path.'
)
if
(
os
.
path
.
isfile
(
dl_path
)
):
...
...
@@ -59,7 +59,7 @@ def neptun_POST(neptun):
#UPLOAD
elif
request
.
json
[
'CMD'
]
==
'UPLOAD'
:
up_path
=
home_path
+
'/'
+
request
.
json
[
'PATH'
]
up_path
=
os
.
path
.
norm
path
(
up_path
)
up_path
=
os
.
path
.
real
path
(
up_path
)
if
not
up_path
.
startswith
(
home_path
):
abort
(
400
,
'Invalid upload path.'
)
if
os
.
path
.
exists
(
up_path
)
==
True
and
os
.
path
.
isdir
(
up_path
):
...
...
@@ -72,9 +72,11 @@ def neptun_POST(neptun):
elif
request
.
json
[
'CMD'
]
==
'MOVE'
:
src_path
=
home_path
+
'/'
+
request
.
json
[
'SOURCE'
]
dst_path
=
home_path
+
'/'
+
request
.
json
[
'DESTINATION'
]
if
not
os
.
path
.
normpath
(
src_path
)
.
startswith
(
home_path
):
src_path
=
os
.
path
.
realpath
(
src_path
)
dst_path
=
os
.
path
.
realpath
(
dst_path
)
if
not
src_path
.
startswith
(
home_path
):
abort
(
400
,
'Invalid source path.'
)
if
not
os
.
path
.
normpath
(
dst_path
)
.
startswith
(
home_path
):
if
not
dst_path
.
startswith
(
home_path
):
abort
(
400
,
'Invalid destination path.'
)
if
os
.
path
.
exists
(
src_path
)
==
True
and
os
.
path
.
exists
(
dst_path
)
==
True
and
os
.
path
.
isdir
(
dst_path
)
==
True
:
shutil
.
move
(
src_path
,
dst_path
)
...
...
@@ -85,7 +87,8 @@ def neptun_POST(neptun):
#RENAME
elif
request
.
json
[
'CMD'
]
==
'RENAME'
:
src_path
=
home_path
+
'/'
+
request
.
json
[
'PATH'
]
if
not
os
.
path
.
normpath
(
src_path
)
.
startswith
(
home_path
):
src_path
=
os
.
path
.
realpath
(
src_path
)
if
not
src_path
.
startswith
(
home_path
):
abort
(
400
,
'Invalid source path.'
)
dst_path
=
os
.
path
.
dirname
(
src_path
)
+
'/'
+
request
.
json
[
'NEW_NAME'
]
if
os
.
path
.
exists
(
src_path
)
==
True
:
...
...
@@ -96,7 +99,8 @@ def neptun_POST(neptun):
#NEW FOLDER
elif
request
.
json
[
'CMD'
]
==
'NEW_FOLDER'
:
dir_path
=
home_path
+
'/'
+
request
.
json
[
'PATH'
]
if
not
os
.
path
.
normpath
(
dir_path
)
.
startswith
(
home_path
):
dir_path
=
os
.
path
.
realpath
(
dir_path
)
if
not
dir_path
.
startswith
(
home_path
):
abort
(
400
,
'Invalid directory path.'
)
if
os
.
path
.
exists
(
dir_path
)
==
True
:
abort
(
400
,
"Directory already exist!"
)
...
...
@@ -106,7 +110,8 @@ def neptun_POST(neptun):
#REMOVE
elif
request
.
json
[
'CMD'
]
==
'REMOVE'
:
remove_path
=
home_path
+
'/'
+
request
.
json
[
'PATH'
]
if
not
os
.
path
.
normpath
(
remove_path
)
.
startswith
(
home_path
):
remove_path
=
os
.
path
.
realpath
(
remove_path
)
if
not
remove_path
.
startswith
(
home_path
):
abort
(
400
,
'Invalid path.'
)
if
os
.
path
.
exists
(
remove_path
)
!=
True
:
abort
(
404
,
"Path not found!"
)
...
...
@@ -187,7 +192,7 @@ def upload(hash_num):
if
os
.
path
.
exists
(
up_path
):
abort
(
400
,
'File already exists'
)
#Check if upload path valid
if
not
os
.
path
.
normpath
(
up_path
)
.
startswith
(
'/home'
):
if
not
up_path
.
startswith
(
'/home'
):
abort
(
400
,
'Invalid path.'
)
os
.
remove
(
ROOT_WWW_FOLDER
+
'/'
+
hash_num
)
#Get the real upload path
...
...
@@ -205,7 +210,7 @@ def upload(hash_num):
datalength
+=
len
(
chunk
)
f
.
close
()
os
.
chown
(
up_path
,
getpwnam
(
username
)
.
pw_uid
,
getpwnam
(
username
)
.
pw_gid
)
os
.
chmod
(
up_path
,
0
7
44
)
os
.
chmod
(
up_path
,
0
6
44
)
return
'Upload finished: '
+
file_name
+
' - '
+
str
(
datalength
)
+
' Byte'
...
...
@@ -245,7 +250,7 @@ def updateSSHAuthorizedKeys(username,key_list):
def
list_directory
(
home
,
path
):
#Check for path breakout
if
not
os
.
path
.
norm
path
(
path
)
.
startswith
(
home
):
if
not
os
.
path
.
real
path
(
path
)
.
startswith
(
home
):
abort
(
400
,
'Invalid path.'
)
#Check if path exist
if
os
.
path
.
exists
(
path
)
!=
True
:
...
...
miscellaneous/temp-design/teszt-wm.html
View file @
3cbf153f
...
...
@@ -7,6 +7,7 @@
<link
href=
'http://fonts.googleapis.com/css?family=Metrophobic'
rel=
'stylesheet'
type=
'text/css'
>
<link
rel=
"stylesheet"
href=
"../../one/static/style.css"
>
<link
rel=
"icon"
type=
"image/png"
href=
"one/static/favicon.png"
>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
/>
<script
src=
"http://code.jquery.com/jquery.min.js"
></script>
<script
type=
"text/javascript"
>
$
(
function
(){
...
...
one/templates/base.html
View file @
3cbf153f
...
...
@@ -6,6 +6,30 @@
<title>
{% block title %}IK Cloud{% endblock %}
</title>
<link
rel=
"stylesheet"
href=
"/static/style.css"
/>
<link
rel=
"icon"
type=
"image/png"
href=
"/static/favicon.png"
/>
<link
rel=
"icon"
type=
"image/png"
href=
"one/static/favicon.png"
>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
/>
<script
src=
"http://code.jquery.com/jquery.min.js"
></script>
<script
type=
"text/javascript"
>
$
(
function
(){
$
(
'.wm'
).
click
(
function
(){
if
(
$
(
this
).
children
(
'.details'
).
is
(
':hidden'
)){
$
(
this
).
children
(
'.details'
)
.
css
(
'height'
,
0
)
.
css
(
'padding'
,
'0px 5px'
)
.
show
()
.
animate
({
height
:
160
,
paddingTop
:
15
,
paddingBottom
:
15
},
700
);
}
else
{
var
that
=
this
;
$
(
this
).
children
(
'.details'
)
.
css
(
'height'
,
130
)
.
css
(
'padding'
,
'15px 5px'
)
.
animate
({
height
:
0
,
paddingTop
:
0
,
paddingBottom
:
0
},
700
,
function
(){
$
(
that
).
children
(
'.details'
).
hide
();
});
}
})
})
</script>
{{ form.media }}
{% block js %}{% endblock %}
...
...
one/templates/home.html
View file @
3cbf153f
...
...
@@ -26,27 +26,91 @@
{% endfor %}
</div>
<div
class=
"boxes"
>
<div
class=
"contentblock"
>
<h2>
Adattár
</h2>
<div
class=
"content"
>
<ul>
<li>
a.out
<span
class=
"file-size"
>
4K
</span>
<span
class=
"file-age"
>
(5 perce)
</span>
<a
href=
""
class=
"file-download"
>
Letöltés
</a></li>
<li>
a.out
<span
class=
"file-size"
>
4K
</span>
<span
class=
"file-age"
>
(5 perce)
</span>
<a
href=
""
class=
"file-download"
>
Letöltés
</a></li>
<li
class=
"file-details"
>
Tovább
</li>
<li
class=
"file-upload"
>
Fájl feltöltése
</li>
</ul>
</div>
</div>
<div
class=
"contentblock"
id=
"state"
>
<h2>
A cluster állapota
</h2>
<div
class=
"content"
>
<p>
<a
href=
"http://cloud.ik.bme.hu/"
>
<img
src=
"/stat/cpu.png"
alt=
"aktuális terhelés"
/>
<img
src=
"/stat/ram.png"
alt=
"aktuális memóriafoglaltság"
/>
</a>
</p>
</div>
</div>
<div
class=
"contentblock"
>
<h2>
Adattár
</h2>
<div
class=
"content"
>
<ul
class=
"file-list"
>
<li
class=
"wm"
>
<div
class=
"summary"
>
<div
class=
"name filetype-c"
>
hello.c
</div>
<div
class=
"actions"
>
<a
href=
"#"
><img
src=
"/static/icons/pencil.png"
alt=
"rename"
/></a>
<a
href=
"#"
><img
src=
"/static/icons/minus-circle.png"
alt=
"delete"
/></a>
<a
href=
"#"
><img
src=
"/static/icons/download-cloud.png"
alt=
"download"
/></a>
</div>
<div
class=
"info"
>
1 Kb
</div>
<div
class=
"clear"
></div>
</div>
<div
class=
"details"
>
<h3>
Részletek
</h3>
<ul>
<li>
Létrehozva:
<span
class=
"value"
>
2012.12.29. 23:12
</span></li>
<li>
Módosítva:
<span
class=
"value"
>
2012.12.29. 23:12
</span></li>
<li>
Hozzáférés:
<span
class=
"value"
>
2012.12.29. 23:12
</span></li>
<li>
Típus:
<span
class=
"value"
>
text/plain
</span></li>
</ul>
</div>
</li>
<li
class=
"wm"
>
<div
class=
"summary"
>
<div
class=
"name filetype-image"
>
suna.jpg
</div>
<div
class=
"actions"
>
<a
href=
"#"
><img
src=
"/static/icons/pencil.png"
alt=
"rename"
/></a>
<a
href=
"#"
><img
src=
"/static/icons/minus-circle.png"
alt=
"delete"
/></a>
<a
href=
"#"
><img
src=
"/static/icons/download-cloud.png"
alt=
"download"
/></a>
</div>
<div
class=
"info"
>
1 Kb
</div>
<div
class=
"clear"
></div>
</div>
<div
class=
"details"
>
<h3>
Részletek
</h3>
<ul>
<li>
Létrehozva:
<span
class=
"value"
>
2012.12.29. 23:12
</span></li>
<li>
Módosítva:
<span
class=
"value"
>
2012.12.29. 23:12
</span></li>
<li>
Hozzáférés:
<span
class=
"value"
>
2012.12.29. 23:12
</span></li>
<li>
Típus:
<span
class=
"value"
>
image/jpg
</span></li>
</ul>
</div>
</li>
<li
class=
"wm"
>
<div
class=
"summary"
>
<div
class=
"name filetype-folder"
>
poresz
</div>
<div
class=
"actions"
>
<a
href=
"#"
><img
src=
"/static/icons/pencil.png"
alt=
"rename"
/></a>
<a
href=
"#"
><img
src=
"/static/icons/minus-circle.png"
alt=
"delete"
/></a>
</div>
<div
class=
"info"
>
katalógus
</div>
<div
class=
"clear"
></div>
</div>
<div
class=
"details"
>
<h3>
Részletek
</h3>
<ul>
<li>
Létrehozva:
<span
class=
"value"
>
2012.12.29. 23:12
</span></li>
<li>
Módosítva:
<span
class=
"value"
>
2012.12.29. 23:12
</span></li>
<li>
Hozzáférés:
<span
class=
"value"
>
2012.12.29. 23:12
</span></li>
<li>
Fájlok:
<span
class=
"value"
>
666 db
</span></li>
</ul>
</div>
</li>
<li
class=
"file-details wm"
>
<div
class=
"summary"
>
<div
class=
"name filetype-more"
>
Mutasd a régebbi fájlokat!
</div>
<div
class=
"clear"
></div>
</div>
</li>
<li
class=
"file-upload wm"
>
<div
class=
"summary"
>
<div
class=
"name filetype-up"
>
Fájlfeltöltés
</div>
<div
class=
"clear"
></div>
</div>
</li>
</ul>
</div>
</div>
</div>
{% endblock %}
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