Commit 09df2b70 authored by Nong Hoang Tu's avatar Nong Hoang Tu
Browse files

code clean

parent 59590461
Pipeline #3776 canceled with stages
......@@ -12,7 +12,7 @@ proc getTorrcPorts*(): TorConfig =
result.fileErr = false
for line in lines(path):
if line.startsWith("TransPort"):
result.transPort = line.split(" ")[1]
result.transPort = line.split(" ")[1] # FIXME got crash randomly here
elif line.startsWith("SocksPort"):
result.socksPort = line.split(" ")[1]
elif line.startsWith("DNSPort"):
......
......@@ -17,9 +17,8 @@ proc getServStatus*(serviceName: string): int =
proc isServEnabled*(serviceName: string): bool =
#[
Check if service is enabled at boot by systemd
Todo: use native check instead of subprocess
Enable service: Created symlink /etc/systemd/system/multi-user.target.wants/tor.service → /lib/systemd/system/tor.service.
Disable service: Removed /etc/systemd/system/multi-user.target.wants/tor.service.
Enable service: Created symlink /etc/systemd/system/multi-user.target.wants/tor.service → /lib/systemd/system/tor.service.
Disable service: Removed /etc/systemd/system/multi-user.target.wants/tor.service.
]#
if fileExists("/etc/systemd/system/multi-user.target.wants/" & serviceName):
return true
......
......@@ -75,19 +75,6 @@ proc ansurf_acts_handle_restart*(sudo: string, callback_send_messages: proc) =
callback_send_messages("AnonSurf Restart", "AnonSurf failed to restart", 2)
# proc ansurf_acts_handle_status*() =
# TODO must deal with gtk and cli
# # if not checkInitSystem():
# # callback_send_messages("System check", "No system init is running", 2)
# # return
# let status = ansurf_core_status()
# # Expected program didn't start. We have to handle program exits / interrupted as well
# if status != 0:
# # TODO we have to show status of Tor, AnonDaemon, ports, DNS
# discard
proc ansurf_acts_handle_boot_disable*(sudo: string, callback_send_messages: proc) =
if not isServEnabled("anonsurfd.service"):
callback_send_messages("AnonSurf disable boot", "AnonSurf is already disabled!", 1)
......@@ -108,14 +95,6 @@ proc ansurf_acts_handle_boot_enable*(sudo: string, callback_send_messages: proc)
callback_send_messages("AnonSurf Enable Boot", "Failed to enable AnonSurf at boot", 2)
# proc ansurf_acts_handle_boot_status*() =
# TODO must deal with gtk and cli
# if not checkInitSystem():
# callback_send_messages("System check", "No system init is running", 2)
# return
# discard
proc ansurf_acts_handle_changeID*(callback_send_messages: proc) =
if getServStatus("anonsurfd") != 0:
callback_send_messages("AnonSurf Status", "AnonSurf is not running", 2)
......
......@@ -18,7 +18,7 @@ proc do_kill(b: Button, callback_send_msg: callback_send_messenger) =
# proc do_exit(b: Button) =
# mainQuit()
# # TODO do not start as well
# # TODO do not start anonsurf instead of just call
proc box_kill_app(callback_send_msg: callback_send_messenger): Box =
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment