예제 #1
0
파일: api.py 프로젝트: razeghi71/pypassman
 def register_app(self, new_app):
     app = App.select().where(App.executable == new_app.executable)
     if not app.exists():
         app = App()
         app.executable = new_app.executable
         app.exec_hash = new_app.exec_hash
         app.save()
         return app.id
     return -1
예제 #2
0
파일: main.py 프로젝트: razeghi71/pypassman
def approver(app):
    exec_eq = App.select().where(App.executable == app.executable)
    both_eq = exec_eq.where(App.exec_hash == app.exec_hash)

    if both_eq.exists():
        return True
    if exec_eq.exists(): #app update
        if run_viewer(app, "app's hash changed and now wants to update?"):
            API().update_app(app)
            return True
    else: #new app wants to connect
        if run_viewer(app, "new apps wants to connect allow or reject?"):
            API().register_app(app)
            return True
    return False