Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
debomatic-webui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
debomatic-webui-admins
debomatic-webui
Commits
168aa2b8
Commit
168aa2b8
authored
Jul 20, 2014
by
Leo Iannacone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
code style on debomatic-webui main file
parent
d5b34635
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
38 deletions
+28
-38
debomatic-webui/debomatic-webui.coffee
debomatic-webui/debomatic-webui.coffee
+28
-38
No files found.
debomatic-webui/debomatic-webui.coffee
View file @
168aa2b8
"use strict"
###
###
Module dependencies.
Module dependencies.
###
###
http
=
require
(
"http"
)
app
=
module
.
exports
=
require
(
"express"
)()
express
=
require
(
"express"
)
server
=
require
(
"http"
).
createServer
(
app
)
io
=
require
(
"socket.io"
)(
server
)
serve_static
=
require
(
"serve-static"
)
serve_static
=
require
(
"serve-static"
)
serve_index
=
require
(
"serve-index"
)
serve_index
=
require
(
"serve-index"
)
errorhandler
=
require
(
"errorhandler"
)
errorhandler
=
require
(
"errorhandler"
)
routes
=
require
(
"./routes"
)
routes
=
require
(
"./routes"
)
config
=
require
(
"./lib/config"
)
config
=
require
(
"./lib/config"
)
utils
=
require
(
"./lib/utils"
)
utils
=
require
(
"./lib/utils"
)
Client
=
require
(
"./lib/client"
)
Client
=
require
(
"./lib/client"
)
Debomatic
=
require
(
"./lib/debomatic"
)
Debomatic
=
require
(
"./lib/debomatic"
)
app
=
module
.
exports
=
express
()
server
=
http
.
createServer
(
app
)
io
=
require
(
"socket.io"
)(
server
)
# error handler setup
env
=
process
.
env
.
NODE_ENV
or
"development"
env
=
process
.
env
.
NODE_ENV
or
"development"
if
"development"
is
env
if
env
is
"development"
app
.
use
errorhandler
(
app
.
use
(
errorhandler
({
dumpExceptions
:
true
,
showStack
:
true
}))
dumpExceptions
:
tru
e
els
e
showStack
:
true
app
.
use
(
errorhandler
())
)
else
app
.
use
errorhandler
()
if
"production"
is
env
# the views
app
.
set
"views"
,
__dirname
+
"/views"
app
.
set
(
"views"
,
__dirname
+
"/views"
)
app
.
set
"view engine"
,
"ejs"
app
.
set
(
"view engine"
,
"ejs"
)
# index page
# index page
app
.
get
"/"
,
routes
.
index
app
.
get
(
"/"
,
routes
.
index
)
# distibution page
# distibution page
app
.
get
config
.
routes
.
distribution
,
routes
.
distribution
app
.
get
(
config
.
routes
.
distribution
,
routes
.
distribution
)
# p
arefer
nces page
# p
refere
nces page
if
config
.
routes
.
preferences
if
config
.
routes
.
preferences
app
.
get
config
.
routes
.
preferences
,
routes
.
preferences
app
.
get
(
config
.
routes
.
preferences
,
routes
.
preferences
)
# commands page
# commands page
app
.
get
config
.
routes
.
commands
,
routes
.
commands
if
config
.
routes
.
commands
if
config
.
routes
.
commands
app
.
get
(
config
.
routes
.
commands
,
routes
.
commands
)
# debomatic static page
# debomatic static page
if
config
.
routes
.
debomatic
if
config
.
routes
.
debomatic
app
.
all
config
.
routes
.
debomatic
+
"*"
,
(
req
,
res
,
next
)
->
app
.
all
config
.
routes
.
debomatic
+
"*"
,
(
req
,
res
,
next
)
->
# send 403 status when users want to browse the chroots:
# send 403 status when users want to browse the chroots:
# - unstable/unstable
# - unstable/unstable
# - unstable/build/*
# - unstable/build/*
# this prevents system crashes
# this prevents system crashes
base
=
config
.
routes
.
debomatic
base
=
config
.
routes
.
debomatic
base
+=
(
if
base
[
base
.
length
-
1
]
isnt
"/"
then
"/"
else
""
)
# append /
base
+=
"/"
if
base
[
base
.
length
-
1
]
isnt
"/"
# append /
match
=
req
.
url
.
replace
(
base
,
""
).
split
(
"/"
)
match
=
req
.
url
.
replace
(
base
,
""
).
split
(
"/"
)
match
.
pop
()
if
match
[
match
.
length
-
1
]
is
""
match
.
pop
()
if
match
[
match
.
length
-
1
]
is
""
...
@@ -60,45 +62,33 @@ if config.routes.debomatic
...
@@ -60,45 +62,33 @@ if config.routes.debomatic
next
()
next
()
return
return
app
.
use
config
.
routes
.
debomatic
,
serve_static
(
config
.
debomatic
.
path
)
app
.
use
(
config
.
routes
.
debomatic
,
serve_static
(
config
.
debomatic
.
path
)
)
app
.
use
(
config
.
routes
.
debomatic
,
serve_index
(
config
.
debomatic
.
path
,
app
.
use
(
config
.
routes
.
debomatic
,
serve_index
(
config
.
debomatic
.
path
,
{
view
:
"details"
,
icons
:
true
}))
{
view
:
"details"
,
icons
:
true
}))
# serve stylesheet-javascript
# serve stylesheet-javascript
app
.
use
serve_static
(
__dirname
+
"/public"
)
app
.
use
(
serve_static
(
__dirname
+
"/public"
)
)
# serve dsc files as octet-stream
# serve dsc files as octet-stream
serve_static
.
mime
.
define
"application/octet-stream"
:
[
"dsc"
]
serve_static
.
mime
.
define
(
"application/octet-stream"
:
[
"dsc"
])
# Listening
# Listening
server
.
listen
config
.
port
,
config
.
host
,
null
,
(
err
)
->
server
.
listen
config
.
port
,
config
.
host
,
null
,
(
err
)
->
# Checking nodejs with sudo:
# Find out which user used sudo through the environment variable
# and set his user id
uid
=
parseInt
(
process
.
env
.
SUDO_UID
)
if
uid
console
.
log
"Please do not run nodejs with sudo. "
+
"Changing user to %d"
,
uid
process
.
setgid
uid
process
.
setuid
uid
debomatic
=
new
Debomatic
(
io
.
sockets
)
debomatic
=
new
Debomatic
(
io
.
sockets
)
debomatic
.
start
()
debomatic
.
start
()
io
.
sockets
.
on
"connection"
,
(
socket
)
->
io
.
sockets
.
on
"connection"
,
(
socket
)
->
client
=
new
Client
(
socket
)
client
=
new
Client
(
socket
)
client
.
start
()
client
.
start
()
client
.
send_status
debomatic
.
status
client
.
send_status
(
debomatic
.
status
)
client
.
send_status_debomatic
(
debomatic
.
running
)
client
.
send_status_debomatic
(
debomatic
.
running
)
client
.
send_distributions
(
debomatic
.
distributions
)
client
.
send_distributions
(
debomatic
.
distributions
)
return
console
.
log
"Debomatic-webui listening on %s:%d in %s mode"
,
console
.
log
"Debomatic-webui listening on %s:%d in %s mode"
,
server
.
address
().
address
,
server
.
address
().
address
,
server
.
address
().
port
,
server
.
address
().
port
,
app
.
settings
.
env
app
.
settings
.
env
return
server
.
on
"error"
,
(
e
)
->
server
.
on
"error"
,
(
e
)
->
if
e
.
code
is
"EADDRINUSE"
if
e
.
code
is
"EADDRINUSE"
...
...
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