Skip to content

Commit

Permalink
更新脚本
Browse files Browse the repository at this point in the history
  • Loading branch information
jiang committed Apr 19, 2024
1 parent 790811a commit 08b2418
Showing 1 changed file with 36 additions and 2 deletions.
38 changes: 36 additions & 2 deletions Tools/Tools.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# coding=utf-8
#!/bin/python


import sys
import os

def newuser(name,password,int):
import base64
Expand Down Expand Up @@ -28,4 +31,35 @@ def ifuser(name,password):
ifpass = base64.b64decode(ifpass)
if ifpass == password.encode("utf-8"):
text = 'yes'
return text
return text

def port():
if len(sys.argv) == 2:
if os.path.exists(".config/main/port"):
fs = open(".config/main/port", "rb")
ini = fs.read().decode("utf-8")
print("port [" + ini + "]")
elif len(sys.argv) == 3:
if not os.path.exists(".config"):
os.mkdir(".config")
if not os.path.exists(".config/main"):
os.mkdir(".config/main")
fs = open(".config/main/port","w")
fs.write(str(int(sys.argv[2])))
fs.close
print("set port [" + sys.argv[2] + "]")
else:
print("port [port]")

def help():
print("port [port]")

if __name__ == "__main__":
dir = sys.argv[0][:-14]
os.chdir(dir)
if len(sys.argv) == 1:
sys.argv = (sys.argv[0]+" port 8889").split(' ')
if sys.argv[1] == "help":
help()
elif sys.argv[1] == "port":
port()

0 comments on commit 08b2418

Please sign in to comment.