Skip to content

Commit

Permalink
custom method
Browse files Browse the repository at this point in the history
  • Loading branch information
orvice committed Jan 21, 2016
2 parents 74a7302 + f353296 commit 5648082
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 1 deletion.
3 changes: 3 additions & 0 deletions app/Controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ public function nodeInfo($request, $response, $args){
$ary['server_port'] = $this->user->port;
$ary['password'] = $this->user->passwd;
$ary['method'] = $node->method;
if($node->custom_method){
$ary['method'] = $this->user->method;
}
$json = json_encode($ary);
$ssurl = $node->method.":".$this->user->passwd."@".$node->server.":".$this->user->port;
$ssqr = "ss://".base64_encode($ssurl);
Expand Down
40 changes: 40 additions & 0 deletions views/default/user/edit.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@
<button type="submit" id="ss-pwd-update" class="btn btn-primary" >修改 </button>
</div>


<div class="form-group">
<input type="text" id="method" placeholder="输入新加密方式" class="form-control" >
</div>

<div class="box-footer">
<button type="submit" id="method-update" class="btn btn-primary" >修改 </button>
</div>

</div><!-- /.box-body -->
</div><!-- /.box -->
</div><!-- /.col (right) -->
Expand Down Expand Up @@ -152,4 +161,35 @@
})
</script>


<script>
$(document).ready(function(){
$("#method-update").click(function(){
$.ajax({
type:"POST",
url:"method",
dataType:"json",
data:{
method: $("#method").val()
},
success:function(data){
if(data.ret){
$("#ss-msg-success").show();
$("#ss-msg-success-p").html(data.msg);
}else{
$("#ss-msg-error").show();
$("#ss-msg-error-p").html(data.msg);
}
},
error:function(jqXHR){
alert("发生错误:"+jqXHR.status);
}
})
})
})
</script>




{include file='user/footer.tpl'}
1 change: 1 addition & 0 deletions views/default/user/index.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
<div class="box-body">
<p> 端口:<code>{$user->port}</code> </p>
<p> 密码:{$user->passwd} </p>
<p> 自定义加密:<code>{$user->method}</code> </p>
<p> 最后使用时间:<code>{$user->lastSsTime()}</code> </p>
</div><!-- /.box-body -->
</div><!-- /.box -->
Expand Down
6 changes: 5 additions & 1 deletion views/default/user/node.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@
<div class="tab-pane active" id="tab_1-1">
<p> <a class="btn btn-xs bg-purple btn-flat margin" href="#">地址:</a> <code>{$node->server}</code>
<a class="btn btn-xs bg-orange btn-flat margin" href="#">{$node->status}</a>
<a class="btn btn-xs bg-green btn-flat margin" href="#">{$node->method}</a>
{if $node->custom_method == 1}
<a class="btn btn-xs bg-green btn-flat margin" href="#">{$user->method}</a>
{else}
<a class="btn btn-xs bg-green btn-flat margin" href="#">{$node->method}</a>
{/if}
</p>
<p> {$node->info}</p>
</div><!-- /.tab-pane -->
Expand Down

0 comments on commit 5648082

Please sign in to comment.