def __init__(self, access_token=''): self.Account = Account(access_token=access_token) self.Apps = Apps(access_token=access_token) self.Audio = Audio(access_token=access_token) self.Auth = Auth(access_token=access_token) self.Board = Board(access_token=access_token) self.Database = Database(access_token=access_token) self.Docs = Docs(access_token=access_token) self.Other = Other(access_token=access_token) self.Fave = Fave(access_token=access_token) self.Friends = Friends(access_token=access_token) self.Gifts = Gifts(access_token=access_token) self.Groups = Groups(access_token=access_token) self.Likes = Likes(access_token=access_token) self.Market = Market(access_token=access_token) self.Messages = Messages(access_token=access_token) self.Newsfeed = Newsfeed(access_token=access_token) self.Notes = Notes(access_token=access_token) self.Notifications = Notifications(access_token=access_token) self.Pages = Pages(access_token=access_token) self.Photos = Photos(access_token=access_token) self.Places = Places(access_token=access_token) self.Polls = Polls(access_token=access_token) self.Search = Search(access_token=access_token) self.Stats = Stats(access_token=access_token) self.Status = Status(access_token=access_token) self.Storage = Storage(access_token=access_token) self.Users = Users(access_token=access_token) self.Utils = Utils(access_token=access_token) self.Video = Video(access_token=access_token) self.Wall = Wall(access_token=access_token) self.Widgets = Widgets(access_token=access_token)
def delete_app(app_name): apps = Apps(get_store(), data_path) app = apps.get(app_name) if not app: return return_error(errors.ERROR_INVALID_APP) apps.remove(app_name) print('Delete') return jsonify({'result': True})
def get_app(app_name): apps = Apps(get_store(), data_path) app = apps.get(app_name) print(app) if not app: return return_error(errors.ERROR_INVALID_APP) app_dict = AppJsonEncoder(app).encode('dict') return jsonify({'app': app_dict})
def update_app(app_name): apps = Apps(get_store(), data_path) app = apps.get(app_name) if not app: return return_error(errors.ERROR_INVALID_APP) if 'max_count' in request.json: app.max_count = request.json['max_count'] app_dict = AppJsonEncoder(app).encode('dict') return jsonify({'app': app_dict})
def __init__(self, db, check=False): """ Instantiates client class. This class in turn instantiations the Apps API class and passes the db connection Parameters: :param db: a mysql.connector connection :param check: Boolean indicating whether SQL checks should be used """ self.apps = Apps(db, check) self.db = db
def add_apps(): if not request.json: return return_error(errors.ERROR_INVALID_REQUEST) if 'name' not in request.json: return return_error(errors.ERROR_MISSING_PARAMS) apps = Apps(get_store(), data_path) name = request.json["name"] max_count = 10 if 'max_count' in request.json: max_count = int(request.json['max_count']) app = apps.get(name) if app: return return_error(errors.ERROR_INVALID_APP) app = apps.add(name, max_count) print('App created', app) app_dict = AppJsonEncoder(app).encode('dict') print(app_dict) return jsonify({'app': app_dict})
APP_FOLDER = "/home/rhys/.local/share/applications/" def get_reg(name, reg): commands = [] commands.append( 'REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList\Applications\{}" /v "Name" /t REG_SZ /d "{}" /f' .format(name, name)) commands.append( 'REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList\Applications\{}" /v "Patg" /t REG_SZ /d "{}" /f' .format(name, reg)) return commands apps = Apps() apps.load("apps") for app in apps.apps: desktop = app.get_desktop() file = join( APP_FOLDER, "{}_Win.desktop".format(app.name.replace(" ", "_").replace(".", "_"))) with open(file, "w") as f: f.write(desktop) system("chmod +x {}".format(file)) print(file)
def get_apps(): apps = Apps(get_store(), data_path) return AppsJsonEncoder(apps).encode()