open TV script

This commit is contained in:
phyusin
2018-09-14 10:15:05 +06:30
parent 57adb09162
commit 9ac2044337
3 changed files with 32 additions and 5 deletions

View File

@@ -184,6 +184,15 @@ class HomeController < ApplicationController
render :json => {:status=> "Success", :url => root_path }.to_json render :json => {:status=> "Success", :url => root_path }.to_json
end end
def run_teamviewer
if File.directory?("/opt/teamviewer")
output = IO.popen('/opt/teamviewer/tv_bin/script/teamviewer')
render :json => {:status=> true}
else
render :json => {:status=> false}
end
end
private private
# Never trust parameters from the scary internet, only allow the white list through. # Never trust parameters from the scary internet, only allow the white list through.

View File

@@ -69,12 +69,12 @@
</a> </a>
</p> </p>
</li> </li>
<!-- <li> <li>
<p class="waves-effect waves-block p-l-30 m-b-5"> <p class="waves-effect waves-block p-l-30 m-b-5 team_viewer">
<i class="material-icons font-7 logout_icon shopinfo">add</i> <i class="material-icons font-7 logout_icon shopinfo">touch_app</i>
<span class="font-15 shopinfo" >Team Viewer</span> <span class="font-15 shopinfo" >Team Viewer</span>
</p> </p>
</li> --> </li>
<% end %> <% end %>
<li> <li>
<!-- <p class="delete waves-effect waves-block p-l-30 m-b-5" data-ref="<%=logout_path%>" data-method="delete"> <!-- <p class="delete waves-effect waves-block p-l-30 m-b-5" data-ref="<%=logout_path%>" data-method="delete">
@@ -137,5 +137,21 @@
$('.order_no').html(parseInt(getOnlineOrderCount())); $('.order_no').html(parseInt(getOnlineOrderCount()));
} }
$(".team_viewer").on('click',function(){
// /opt/teamviewer/tv_bin/script/teamviewer
$.ajax({
type: "POST",
data: {},
dataType: 'json',
url: "/run_teamviewer",
success: function(data){
if(!data.status){
window.open('https://www.teamviewer.com', '_blank');
return false;
}
}
});
});
}); });
</script> </script>

View File

@@ -537,6 +537,8 @@ scope "(:locale)", locale: /en|mm/ do
get '/get_printer_options/:printer_name' => 'print_settings#get_printer_options' get '/get_printer_options/:printer_name' => 'print_settings#get_printer_options'
resources :commissioners resources :commissioners
post '/run_teamviewer' => 'home#run_teamviewer', :defaults => { :format => 'json' }
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end end
end end