system users improvement
parent
622c3f9a51
commit
908420937f
|
@ -10,7 +10,7 @@ from pyhocon import ConfigFactory
|
|||
import requests
|
||||
from flask import Flask, render_template, request, redirect
|
||||
|
||||
from stats import get_data
|
||||
from tildetown.stats import get_data
|
||||
|
||||
## disgusting hack for python 3.4.0
|
||||
import pkgutil
|
||||
|
|
|
@ -4,12 +4,14 @@ from os import listdir
|
|||
from os.path import getmtime, join
|
||||
from datetime import datetime
|
||||
from sh import find, uptime, who, sort, wc, cut
|
||||
from util import slurp, thread, p
|
||||
from tildetown.util import slurp, thread, p
|
||||
|
||||
# this script emits json on standard out that has information about tilde.town
|
||||
# users. It denotes who has not updated their page from the default. It also
|
||||
# reports the time this script was run. The user list is sorted by public_html update time.
|
||||
|
||||
SYSTEM_USERS = ['wiki', 'root', 'ubuntu', 'nate']
|
||||
|
||||
DEFAULT_HTML = slurp("/etc/skel/public_html/index.html")
|
||||
|
||||
username_to_html_path = lambda u: "/home/{}/public_html".format(u)
|
||||
|
@ -43,7 +45,7 @@ def sort_user_list(usernames):
|
|||
return sorted(usernames, key=modify_time)
|
||||
|
||||
def user_generator():
|
||||
ignore_system_users = lambda f: f != "ubuntu" and f != "poetry"
|
||||
ignore_system_users = lambda un: un not in SYSTEM_USERS
|
||||
return filter(ignore_system_users, listdir("/home"))
|
||||
|
||||
def get_user_data():
|
||||
|
|
Reference in New Issue