Commit a192a29f authored by Nong Hoang Tu's avatar Nong Hoang Tu

Add gtk notification

parent 5034a85a
Pipeline #707 failed with stages
import strutils
import httpclient
import os
import gintro / notify
type
Mirror = object
......@@ -48,7 +49,18 @@ proc parseDateFromText(data: string): string =
return line
proc main() =
proc sendNotify*(sumary, body, icon: string) =
#[
Display IP when user click on CheckIP button
Show the information in system's notification
]#
discard init("Parrot Updater")
let ipNotify = newNotification(sumary, body, icon) # security-low
discard ipNotify.show()
proc checkUpdate() =
for line in lines(repoConfig):
if line.startsWith("deb "):
let
......@@ -68,9 +80,13 @@ proc main() =
if localDate == serverDate:
echo "[*] Your system is up to date"
sendNotify("Parrot Updater", "Your system is up to date", "security-high")
else:
echo "[!] New update is available"
sendNotify("Parrot Updater", "New update is available", "security-low")
echo "[+] Your last update: " & localDate
echo "[+] Repo last update: " & serverDate
sendNotify("Server last update: " & serverDate, "Local last update: " & localDate, "security-low")
main()
checkUpdate()
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