mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-02-06 15:04:58 +00:00
fix
This commit is contained in:
parent
189f50fee4
commit
3bd2e748c7
32
app/index.js
32
app/index.js
|
@ -7,13 +7,39 @@ var OldBrowser = require("lib/oldbrowser");
|
|||
var HTTP = require("lib/http");
|
||||
|
||||
var apiUrl = CONFIG.readConfig("/Config/ApiUrl").first().text;
|
||||
var token;
|
||||
var token, userId;
|
||||
|
||||
var showServers = function() {
|
||||
OldBrowser.setContent(FILE.readFile("app\\servers.html", "utf-8"));
|
||||
|
||||
var req = HTTP.get(apiUrl + "/netsolid/items/assignedservers", "filter[assigned_to][eq]=" + userId, {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
"Authorization": "bearer " + token
|
||||
});
|
||||
|
||||
alert(req.responseText);
|
||||
|
||||
/*
|
||||
var res = JSON.parse(req.responseText);
|
||||
|
||||
for(var i = 0; i < res.data.length; i++) {
|
||||
alert(res.data[i].assigned_to);
|
||||
}
|
||||
*/
|
||||
};
|
||||
|
||||
|
||||
if (FILE.fileExists("token.txt")) {
|
||||
token = FILE.readFile("token.txt", "utf-8");
|
||||
}
|
||||
|
||||
if (typeof(token) === "undefined") {
|
||||
if (FILE.fileExists("userid.txt")) {
|
||||
userId = FILE.readFile("userid.txt", "utf-8");
|
||||
}
|
||||
|
||||
if (typeof(token) !== "undefined") {
|
||||
showServers();
|
||||
} else {
|
||||
OldBrowser.setContent(FILE.readFile("app\\login.html", "utf-8"));
|
||||
|
||||
document.getElementById("loginform").onsubmit = function(ev) {
|
||||
|
@ -37,6 +63,8 @@ if (typeof(token) === "undefined") {
|
|||
} else if ("data" in res) {
|
||||
console.log("ok");
|
||||
FILE.writeFile("token.txt", res.data.token, "utf-8");
|
||||
FILE.writeFile("userid.txt", res.data.user.id, "utf-8");
|
||||
showServers();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
79
app/servers.html
Normal file
79
app/servers.html
Normal file
|
@ -0,0 +1,79 @@
|
|||
<div class="panel cell">
|
||||
<div class="header">서버 목록</div>
|
||||
<div class="body">
|
||||
<div class="cell">
|
||||
<div class="col">
|
||||
<div class="col width-fit mobile-width-fit"><span class="icon icon-bookmark color-blue"></span></div>
|
||||
<div class="col width-fill mobile-width-fill">
|
||||
<span class="float-right">
|
||||
<span class="text">
|
||||
123
|
||||
</span>
|
||||
<span class="icon icon-star color-yellow"></span>
|
||||
</span>
|
||||
<div class="col width-fill mobile-width-fill">
|
||||
<a class="fatty" href="#">Repo 1</a>
|
||||
</div>
|
||||
<div class="col">This is one of my coolest repos.</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="body">
|
||||
<div class="cell">
|
||||
<div class="col">
|
||||
<div class="col width-fit mobile-width-fit"><span class="icon icon-bookmark color-blue"></span></div>
|
||||
<div class="col width-fill mobile-width-fill">
|
||||
<span class="float-right">
|
||||
<span class="text">
|
||||
123
|
||||
</span>
|
||||
<span class="icon icon-star color-yellow"></span>
|
||||
</span>
|
||||
<div class="col width-fill mobile-width-fill">
|
||||
<a class="fatty" href="#">Repo 2</a>
|
||||
</div>
|
||||
<div class="col">This is one of my coolest repos.</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="body">
|
||||
<div class="cell">
|
||||
<div class="col">
|
||||
<div class="col width-fit mobile-width-fit"><span class="icon icon-bookmark color-blue"></span></div>
|
||||
<div class="col width-fill mobile-width-fill">
|
||||
<span class="float-right">
|
||||
<span class="text">
|
||||
123
|
||||
</span>
|
||||
<span class="icon icon-star color-yellow"></span>
|
||||
</span>
|
||||
<div class="col width-fill mobile-width-fill">
|
||||
<a class="fatty" href="#">Repo 3</a>
|
||||
</div>
|
||||
<div class="col">This is one of my coolest repos.</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="body">
|
||||
<div class="cell">
|
||||
<div class="col">
|
||||
<div class="col width-fit mobile-width-fit"><span class="icon icon-bookmark color-blue"></span></div>
|
||||
<div class="col width-fill mobile-width-fill">
|
||||
<span class="float-right">
|
||||
<span class="text">
|
||||
123
|
||||
</span>
|
||||
<span class="icon icon-star color-yellow"></span>
|
||||
</span>
|
||||
<div class="col width-fill mobile-width-fill">
|
||||
<a class="fatty" href="#">Repo 4</a>
|
||||
</div>
|
||||
<div class="col">This is one of my coolest repos.</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -49,11 +49,13 @@ exports.post = function(url, data, headers) {
|
|||
return http;
|
||||
};
|
||||
|
||||
exports.get = function(url, headers) {
|
||||
exports.get = function(url, data, headers) {
|
||||
var data = (typeof(data) !== "undefined") ? data : "";
|
||||
var http = exports.create();
|
||||
|
||||
http.open("GET", url, false);
|
||||
exports.addHeaders(http, headers);
|
||||
http.send();
|
||||
http.send(data);
|
||||
|
||||
return http;
|
||||
};
|
||||
|
|
|
@ -1 +1 @@
|
|||
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6MSwiZXhwIjoxNjA0NTU0MTQ5LCJ0dGwiOjIwLCJ0eXBlIjoiYXV0aCIsImtleSI6Ijg1N2NlZDg1LTMzOWEtNDViNS04YTQ5LTJjOGM0YmE4ZDVmNCIsInByb2plY3QiOiJuZXRzb2xpZCJ9.m9DzCyaEjVhT5Z6jDS_gtUaB7AVnLjVHGqK4CxGXWnM
|
||||
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6MSwiZXhwIjoxNjA0NTU1MTU3LCJ0dGwiOjIwLCJ0eXBlIjoiYXV0aCIsImtleSI6Ijg1N2NlZDg1LTMzOWEtNDViNS04YTQ5LTJjOGM0YmE4ZDVmNCIsInByb2plY3QiOiJuZXRzb2xpZCJ9.4VxsLxSeGzyPyICblqlWjmlIWtqCgbeoI8ZyTwQKl6A
|
1
userid.txt
Normal file
1
userid.txt
Normal file
|
@ -0,0 +1 @@
|
|||
1
|
Loading…
Reference in New Issue
Block a user