mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
fixed bug where tables/default settings were firing each restart
This commit is contained in:
parent
c896a12b17
commit
2eeee9d6c4
@ -43,6 +43,7 @@ class Users(BaseModel):
|
||||
class Meta:
|
||||
table_name = "users"
|
||||
|
||||
|
||||
class Audit_Log(BaseModel):
|
||||
audit_id = AutoField()
|
||||
created = DateTimeField(default=datetime.datetime.now)
|
||||
@ -53,7 +54,6 @@ class Audit_Log(BaseModel):
|
||||
log_msg = TextField(default='')
|
||||
|
||||
|
||||
|
||||
class Host_Stats(BaseModel):
|
||||
time = DateTimeField(default=datetime.datetime.now)
|
||||
boot_time = CharField(default="")
|
||||
@ -167,7 +167,8 @@ class db_builder:
|
||||
|
||||
@staticmethod
|
||||
def default_settings():
|
||||
|
||||
logger.info("Fresh Install Detected - Creating Default Settings")
|
||||
console.info("Fresh Install Detected - Creating Default Settings")
|
||||
default_data = helper.find_default_password()
|
||||
|
||||
username = default_data.get("username", 'admin')
|
||||
@ -185,9 +186,12 @@ class db_builder:
|
||||
|
||||
@staticmethod
|
||||
def is_fresh_install():
|
||||
if helper.check_file_exists(helper.db_path):
|
||||
try:
|
||||
user = Users.get_by_id(1)
|
||||
return False
|
||||
return True
|
||||
except:
|
||||
return True
|
||||
pass
|
||||
|
||||
|
||||
class db_shortcuts:
|
||||
|
Loading…
Reference in New Issue
Block a user