" 38 | self.markdown += f"" 45 | return self.contents 46 | 47 | -------------------------------------------------------------------------------- /app/helpers/argon2.py.old: -------------------------------------------------------------------------------- 1 | from passlib.hash import argon2 2 | 3 | class argon2hash: 4 | def __init__(self,password,type=None,salt=None): 5 | self.password = password 6 | self.type = None 7 | self.salt = None 8 | self.gen_hash() 9 | 10 | def gen_hash(self): 11 | h = argon2 12 | if self.type: 13 | try: 14 | h.type = self.type 15 | except: 16 | pass 17 | 18 | if self.salt: 19 | try: 20 | h.salt = self.salt 21 | except: 22 | pass 23 | 24 | rval = { 25 | "hash" : h.hash(self.password), 26 | "type" : h.type, 27 | "salt" : h.salt 28 | } 29 | 30 | return rval 31 | def check_hash(hash,password): 32 | return False 33 | 34 | if __name__ == "__main__": 35 | Argon2hash = argon2hash("T35tP@55w0rD",type="id") 36 | print(Argon2hash.gen_hash()) 37 | -------------------------------------------------------------------------------- /app/helpers/argon2hash.py: -------------------------------------------------------------------------------- 1 | from argon2 import PasswordHasher 2 | from argon2 import exceptions as argon2Exceptions 3 | try: 4 | from app.helpers.rndpwd import randpwd 5 | except: 6 | from rndpwd import randpwd 7 | 8 | class argon2hash: 9 | def __init__(self,password=None): 10 | self.password = password if password else randpwd().generate() 11 | self.ph = PasswordHasher() 12 | def generate(self): 13 | self.ph = PasswordHasher() 14 | self.hash = self.ph.hash(self.password) 15 | rval = { 16 | "password" : self.password, 17 | "hash" : self.hash 18 | } 19 | return rval 20 | class argon2verify: 21 | def __init__(self,argon_hash,password): 22 | self.hash = argon_hash 23 | print(self.hash) 24 | self.password=password 25 | print(self.password) 26 | 27 | self.ph = PasswordHasher() 28 | print("Initialized PasswordHasher()") 29 | 30 | def verify(self): 31 | output = None 32 | try: 33 | self.ph.verify(self.hash,self.password) 34 | output = True 35 | except (argon2Exceptions.VerifyMismatchError, argon2Exceptions.VerificationError): 36 | output = False 37 | return output 38 | 39 | if __name__ == "__main__": 40 | 41 | print("\n###############################\n Random Password & Verify\n###############################") 42 | password = randpwd.generate() 43 | badpassword = "NotThePassword" 44 | print(password) 45 | hash = argon2hash(password=password).generate()["hash"] 46 | print(hash) 47 | print(f"{password}: {PasswordHasher().verify(hash,password)}") 48 | print(f"{badpassword}: {argon2verify(hash,badpassword).verify()}") 49 | print("###############################\n\n") 50 | print("###############################\n Password='P@5Sw0Rd' & Verify\n###############################") 51 | password="P@5Sw0Rd" 52 | hash=argon2hash(password=password).generate()["hash"] 53 | print(hash) 54 | print(PasswordHasher().verify(hash,"P@5Sw0Rd")) 55 | print(f"{password}: {PasswordHasher().verify(hash,password)}") 56 | print(f"{badpassword}: {argon2verify(hash,badpassword).verify()}") -------------------------------------------------------------------------------- /app/helpers/iterateQuery.py: -------------------------------------------------------------------------------- 1 | def iterateQuery(query): 2 | output={} 3 | if query: 4 | for q in query: 5 | output[q.id] = {} 6 | for item in q.__dict__: 7 | if not item.startswith('_') and item != "id": 8 | output[q.id][item] = q.__dict__[item] 9 | return output -------------------------------------------------------------------------------- /app/helpers/rndpwd.py: -------------------------------------------------------------------------------- 1 | # This code is a portion of frigate Event Video Recorder (fEVR) 2 | # 3 | # Copyright (C) 2021-2022 The Bearded Tek (http://www.beardedtek.com) William Kenny 4 | # 5 | # This program is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU Affero General Public License as published by 7 | # the Free Software Foundation, either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU AfferoGeneral Public License 16 | # along with this program. If not, see" 39 | self.markdown += f" {url} \r" 40 | self.markdown += "
" 41 | self.markdown += "" 42 | self.markdown += f" {self.contents[url]}" 43 | self.markdown += f"
" 44 | self.markdown += f"
12 | endpoint 13 | | 14 |15 | Description 16 | | 17 |
---|---|
24 |
25 | |
26 | 27 | {{apidocs[api][url]}} 28 | | 29 |
Current {{data}}: JSON YAML
14 | {% elif format|upper == "YAML" %} 15 |Current {{data}}: YAML JSON
16 | {% endif %} 17 |{{Data}}18 |
Edit configuration.yaml
8 |Each accordian represents a section of the configuration.yaml file. Sane defaults will be listed in each field if the value is not yet set.
9 |Click save on each section after editing.
10 |For now, only the file backend is supported. In the future other backends may be supported.
149 |For now, only the file backend is supported. In the future other backends may be supported.
250 |Access Control
254 |Networks
273 |Rules
297 |Edit {{data}}
8 |To Edit a{{data}}, make changes and click `Save`
9 |To refresh data, click `Refresh Data`.
10 |{{ intro['body'][item] }}
18 | {% endif %} 19 | {% endfor %} 20 |{{ intro2['body'][item] }}
60 | {% endif %} 61 | {% endfor %} 62 |Descriptive Title
10 |by Admin
11 |Descriptive Subtitle
14 |{{ lipsum(2) }}
15 |{{ lipsum(2) }}
16 |Another Descriptive Title
24 |by Admin
25 |{{ lipsum(2) }}
29 |{{ lipsum(2) }}
30 |