mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-02-06 15:04:58 +00:00
fix
fix
This commit is contained in:
parent
ea33d8fcc4
commit
8a01d987d7
12
app.hta
12
app.hta
|
@ -25,9 +25,9 @@
|
||||||
@attribute WindowsState [Normal]|Minimize|Maximize
|
@attribute WindowsState [Normal]|Minimize|Maximize
|
||||||
-->
|
-->
|
||||||
<hta:application
|
<hta:application
|
||||||
ID="Window_WelsonJS"
|
ID="WELSONJS"
|
||||||
Version="0.1"
|
Version="1.0"
|
||||||
ApplicationName="WelsonJS"
|
ApplicationName="NextVPN"
|
||||||
Border="None"
|
Border="None"
|
||||||
BorderStyle="Static"
|
BorderStyle="Static"
|
||||||
InnerBorder="No"
|
InnerBorder="No"
|
||||||
|
@ -46,13 +46,13 @@
|
||||||
WindowState="Normal"
|
WindowState="Normal"
|
||||||
Selection="No"
|
Selection="No"
|
||||||
/>
|
/>
|
||||||
<title>WelsonJS</title>
|
<title>NextVPN</title>
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=9" />
|
<meta http-equiv="X-UA-Compatible" content="IE=9" />
|
||||||
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
|
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
|
||||||
<meta name="description" content="Welsonjs: Build a windows desktop apps fastly without installing packages" />
|
<meta name="description" content="Welsonjs: Build a windows desktop apps fastly without installing packages" />
|
||||||
<meta name="keywords" content="WelsonJS" />
|
<meta name="keywords" content="webapp" />
|
||||||
<meta name="author" content="gnh1201" />
|
<meta name="author" content="gnh1201" />
|
||||||
<meta name="generator" content="WelsonJS" />
|
<meta name="generator" content="welsonjs" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<link type="image/x-icon" rel="icon" href="favicon.ico" />
|
<link type="image/x-icon" rel="icon" href="favicon.ico" />
|
||||||
<link type="image/png" rel="shortcut icon" href="app/assets/img/paper-plane-icon.png" />
|
<link type="image/png" rel="shortcut icon" href="app/assets/img/paper-plane-icon.png" />
|
||||||
|
|
|
@ -1,75 +0,0 @@
|
||||||
var FILE = require("lib/file");
|
|
||||||
var SHELL = require("lib/shell");
|
|
||||||
|
|
||||||
var serverUrl = "http://96.30.198.29/";
|
|
||||||
|
|
||||||
$(".show-logged").css("display", "none");
|
|
||||||
|
|
||||||
$("#loginform").ajaxForm({
|
|
||||||
success: function(res) {
|
|
||||||
if (res.success === false) {
|
|
||||||
console.log("로그인에 실패하였습니다. 다시 시도하여 주세요");
|
|
||||||
} else {
|
|
||||||
// 로그인 사용자의 토큰을 저장
|
|
||||||
FILE.writeFile("token.txt", res.data.token, "utf-8");
|
|
||||||
|
|
||||||
// 저장 여부 확인
|
|
||||||
var isTokenExists = FILE.fileExists("token.txt");
|
|
||||||
if (isTokenExists) {
|
|
||||||
// 성공하면 아이디 표시
|
|
||||||
$("#logged_username").text(res.data.username);
|
|
||||||
|
|
||||||
// 화면 전환
|
|
||||||
$(".show-no-logged").css("display", "none");
|
|
||||||
$(".show-logged").css("display", "");
|
|
||||||
} else {
|
|
||||||
console.log("저장공간이 충분한지 확인하여 주세요");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function(xhr, status, error) {
|
|
||||||
var errorMessage = xhr.status + ': ' + xhr.statusText;
|
|
||||||
alert('Error - ' + errorMessage);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 기존 토큰 정보가 있는 경우
|
|
||||||
var isTokenExists = FILE.fileExists("token.txt");
|
|
||||||
if (isTokenExists) {
|
|
||||||
var token = FILE.readFile("token.txt", "utf-8");
|
|
||||||
$.get(serverUrl, {
|
|
||||||
route: "api.authenticate",
|
|
||||||
action: "checkToken",
|
|
||||||
token: token
|
|
||||||
}, function(res) {
|
|
||||||
// 토큰 확인에 성공하면 아이디 표시
|
|
||||||
$("#logged_username").text(res.data.username);
|
|
||||||
|
|
||||||
// 화면 전환
|
|
||||||
$(".show-no-logged").css("display", "none");
|
|
||||||
$(".show-logged").css("display", "");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 닫기
|
|
||||||
$("a[href='#exit']").click(function() {
|
|
||||||
exit();
|
|
||||||
});
|
|
||||||
|
|
||||||
// 로그아웃
|
|
||||||
$("#btn_logout").click(function() {
|
|
||||||
// 토큰 파일 삭제
|
|
||||||
FILE.deleteFile("token.txt");
|
|
||||||
|
|
||||||
// todo: expire token in the database
|
|
||||||
|
|
||||||
// 화면 전환
|
|
||||||
$(".loginbox").css("display", "");
|
|
||||||
$(".logoutbox").css("display", "none");
|
|
||||||
|
|
||||||
console.log("로그아웃 되었습니다.");
|
|
||||||
});
|
|
||||||
|
|
||||||
// 계산기 실행
|
|
||||||
var text = SHELL.exec("calc && echo hello");
|
|
||||||
alert(text);
|
|
|
@ -6,7 +6,7 @@
|
||||||
<div class="serverbox">
|
<div class="serverbox">
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<span>모든 위치</span>
|
<span>모든 네트워크</span>
|
||||||
<ul class="sub">
|
<ul class="sub">
|
||||||
<li class="show-no-logged"><span><img src="app/assets/img/iconfinder_Caution_53013.png" alt="Caution" /> 로그인하세요</span></li>
|
<li class="show-no-logged"><span><img src="app/assets/img/iconfinder_Caution_53013.png" alt="Caution" /> 로그인하세요</span></li>
|
||||||
<li class="show-logged"><a href="#us1"><span><img src="app/assets/img/flags/shiny/16/United-States.png" alt="United States" /> US 1</span></a></li>
|
<li class="show-logged"><a href="#us1"><span><img src="app/assets/img/flags/shiny/16/United-States.png" alt="United States" /> US 1</span></a></li>
|
||||||
|
@ -29,9 +29,9 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="loginbox show-no-logged">
|
<div class="loginbox show-no-logged">
|
||||||
<form id="loginform" method="post" action="http://96.30.198.29/">
|
<form id="loginform" method="post" action="#">
|
||||||
<div class="hidden">
|
<div class="hidden">
|
||||||
<input type="hidden" name="route" value="api.authenticate" />
|
<input type="hidden" name="route" value="api.auth.json" />
|
||||||
<input type="hidden" name="action" value="getToken" />
|
<input type="hidden" name="action" value="getToken" />
|
||||||
</div>
|
</div>
|
||||||
<div class="box1">
|
<div class="box1">
|
||||||
|
|
76
app/index.js
Normal file
76
app/index.js
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
var FILE = require("lib/file");
|
||||||
|
var serverUrl = "http://158.247.196.146/";
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
$(".show-logged").css("display", "none");
|
||||||
|
|
||||||
|
$("#loginform").attr("action", serverUrl);
|
||||||
|
$("#loginform").ajaxForm({
|
||||||
|
beforeSubmit: function() {
|
||||||
|
console.log("로그인을 시도합니다. 잠시만 기다려 주세요.");
|
||||||
|
},
|
||||||
|
success: function(res) {
|
||||||
|
if(res.success === false) {
|
||||||
|
console.log("로그인에 실패하였습니다. 다시 시도하여 주세요");
|
||||||
|
} else {
|
||||||
|
// 로그인 사용자의 토큰을 저장
|
||||||
|
FILE.writeFile("token.txt", res.data.token, "utf-8");
|
||||||
|
|
||||||
|
// 저장 여부 확인
|
||||||
|
var isTokenExists = FILE.fileExists("token.txt");
|
||||||
|
if(isTokenExists) {
|
||||||
|
// 성공하면 아이디 표시
|
||||||
|
$("#logged_username").text(res.data.username);
|
||||||
|
|
||||||
|
// 화면 전환
|
||||||
|
$(".show-no-logged").css("display", "none");
|
||||||
|
$(".show-logged").css("display", "");
|
||||||
|
} else {
|
||||||
|
console.log("저장공간이 충분한지 확인하여 주세요");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
var errorMessage = xhr.status + ': ' + xhr.statusText;
|
||||||
|
console.log(xhr.responseText);
|
||||||
|
console.log('Error: ' + errorMessage);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 기존 토큰 정보가 있는 경우
|
||||||
|
var isTokenExists = FILE.fileExists("token.txt");
|
||||||
|
if(isTokenExists) {
|
||||||
|
var token = FILE.readFile("token.txt", "utf-8");
|
||||||
|
$.get(serverUrl, {
|
||||||
|
route: "api.auth.json",
|
||||||
|
action: "checkToken",
|
||||||
|
token: token
|
||||||
|
}, function(res) {
|
||||||
|
// 토큰 확인에 성공하면 아이디 표시
|
||||||
|
$("#logged_username").text(res.data.username);
|
||||||
|
|
||||||
|
// 화면 전환
|
||||||
|
$(".show-no-logged").css("display", "none");
|
||||||
|
$(".show-logged").css("display", "");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 닫기
|
||||||
|
$("a[href='#exit']").click(function() {
|
||||||
|
exit();
|
||||||
|
});
|
||||||
|
|
||||||
|
// 로그아웃
|
||||||
|
$("#btn_logout").click(function() {
|
||||||
|
// 토큰 파일 삭제
|
||||||
|
FILE.deleteFile("token.txt");
|
||||||
|
|
||||||
|
// todo: expire token in the database
|
||||||
|
|
||||||
|
// 화면 전환
|
||||||
|
$(".loginbox").css("display", "");
|
||||||
|
$(".logoutbox").css("display", "none");
|
||||||
|
|
||||||
|
console.log("로그아웃 되었습니다.");
|
||||||
|
});
|
||||||
|
});
|
|
@ -1 +1 @@
|
||||||
aYqDglJdvLq28W84JYcXUeKX4Nj3bwyP
|
CiH0U66N07jxLHl9eMTHG9tFaLZ3H5ps
|
|
@ -219,7 +219,7 @@ return {
|
||||||
|
|
||||||
// "go to entrypoint";
|
// "go to entrypoint";
|
||||||
var start = function() {
|
var start = function() {
|
||||||
self.addScript("app/assets/js/index.js");
|
self.addScript("app/index.js");
|
||||||
};
|
};
|
||||||
|
|
||||||
// "when loaded jquery (strictly)";
|
// "when loaded jquery (strictly)";
|
||||||
|
|
Loading…
Reference in New Issue
Block a user