|
@@ -6,6 +6,12 @@ import Users from require "models"
|
6
|
6
|
import api, abort, assert_model from require "helpers"
|
7
|
7
|
|
8
|
8
|
class extends lapis.Application
|
|
9
|
+ [console: "/console/#{config.secret}"]: =>
|
|
10
|
+ if Users\count! < 1 or @session.id == 1
|
|
11
|
+ return console.make(env: "all")(@)
|
|
12
|
+ else
|
|
13
|
+ return status: 401, "401 - Unauthorized"
|
|
14
|
+
|
9
|
15
|
[authenticate: "/0/auth"]: api {
|
10
|
16
|
POST: =>
|
11
|
17
|
-- find user by name or id if specified
|
|
@@ -39,6 +45,7 @@ class extends lapis.Application
|
39
|
45
|
|
40
|
46
|
return name: user.name, id: user.id
|
41
|
47
|
}
|
|
48
|
+
|
42
|
49
|
[name: "/0/:id[%d]"]: api {
|
43
|
50
|
GET: =>
|
44
|
51
|
if user = Users\find id: @params.id
|