Add API function to list mirrored accounts
This commit is contained in:
parent
e5c6c9e2c5
commit
6db3fad9e3
|
@ -1,6 +1,7 @@
|
||||||
from http.server import BaseHTTPRequestHandler, HTTPServer
|
from http.server import BaseHTTPRequestHandler, HTTPServer
|
||||||
import igmirror
|
import igmirror
|
||||||
import sys
|
import sys
|
||||||
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
class MyServer(BaseHTTPRequestHandler):
|
class MyServer(BaseHTTPRequestHandler):
|
||||||
|
@ -13,7 +14,12 @@ class MyServer(BaseHTTPRequestHandler):
|
||||||
# example: /shakira/add
|
# example: /shakira/add
|
||||||
path = self.path.strip('/')
|
path = self.path.strip('/')
|
||||||
parts = path.split('/')
|
parts = path.split('/')
|
||||||
if len(parts) == 2:
|
if len(parts) == 1:
|
||||||
|
if parts[0] == 'list':
|
||||||
|
accounts = os.listdir('./db/accounts')
|
||||||
|
for acc in sorted(set(accounts)):
|
||||||
|
self.wfile.write(bytes(acc+'\n', "utf-8"))
|
||||||
|
elif len(parts) == 2:
|
||||||
# a wilcard select all accounts
|
# a wilcard select all accounts
|
||||||
if parts[0] == '*':
|
if parts[0] == '*':
|
||||||
if parts[1].lower() == 'update':
|
if parts[1].lower() == 'update':
|
||||||
|
|
Loading…
Reference in New Issue