Skip to content

Commit

Permalink
fix(a lot): Copyright + Unqlite
Browse files Browse the repository at this point in the history
Added copyright to appicable files and removed unqlite code which is
no
longer needed.
Updated Upcoming features & Updates section in
README.md

BREAKING CHANGE: Does not break anything... maybe the ability to import
unqlite databases.
Using this break to bump the major as a means of
officially releasing v1
  • Loading branch information
mibs510 committed Jul 12, 2023
1 parent 3b0af32 commit d548a4a
Show file tree
Hide file tree
Showing 90 changed files with 1,849 additions and 849 deletions.
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ It was designed with an emphasis on security to meet organization/business needs
- ~~Worker management needs reimplementation~~
- ~~Currently working on this~~
- Manually requeuing jobs fail
- Update vulnerable packages (Flask, requests, Werkzeug)
- Updating vulnerable packages (Flask, requests, Werkzeug) fail.
- Cannot install flask-dance alongside other packages
- Gunicorn with more than one worker has issues with Worker Manager Server
- ~~Searching plates will only work if pagination position is on page 1~~
- ~~This is a grid.js issue [#1314](https://github.com/grid-js/gridjs/issues/1314) [#1344](https://github.com/grid-js/gridjs/pull/1334) [#1311](https://github.com/grid-js/gridjs/issues/1311).~~
Expand All @@ -42,6 +43,7 @@ It was designed with an emphasis on security to meet organization/business needs
- Export/import settings
- Add audit logs for each action
- Add support for 2FA/MFA
- Package application with [briefcase](https://github.com/beeware/briefcase)

# Development
- Run/Debug Configuration
Expand Down Expand Up @@ -93,8 +95,9 @@ Restart=always
WantedBy=multi-user.target
```

Be sure to modify `User`, `WorkingDirectory`, and `ExecStart`
`User` should not be a user with root privileges
Be sure to modify `User`, `WorkingDirectory`, and `ExecStart`.

`User` should not have root privileges without invoking sudo!

Then execute:

Expand All @@ -119,8 +122,9 @@ Optional: `journalctl -n 50 -f`

```shell
# Log into OpenALPR-Webhook
# Go to Settings/Maintenance/App (http://OpenALPR-Webhook:8080/settings/maintenance/app)
# Shutdown Worker Manager Server
# Go to Settings/Maintenance/App (http://OpenALPR-Webhook:8080/settings/maintenance/app) and Shutdown Worker Manager Server
# Shutdown web server
sudo systemctl stop oalpr-wh
# Go to the root directory of OpenALPR-Webhook
cd OpenALPR-Webhook
# Backup databases
Expand All @@ -135,6 +139,8 @@ git pull
flask db init --multidb
flask db migrate
flask db upgrade
# Start web server
sudo systemctl start oalpr-wh
```

# Documentation
Expand Down
31 changes: 26 additions & 5 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,33 @@
# Copyright (c) 2023. Connor McMillan
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
# following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
# disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
# following disclaimer in the documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote
# products derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#

import os

from flask_migrate import Migrate, MigrateCommand
from flask_minify import Minify
from flask_script import Manager

from apps import create_app, db
from apps.config import config_dict
from flask_migrate import Migrate, MigrateCommand
from flask_minify import Minify
import os

# WARNING: Don't run with debug turned on in production!
DEBUG = os.getenv('DEBUG', 'False') == 'True'
Expand All @@ -26,13 +49,11 @@
if not DEBUG:
Minify(app=app, html=True, js=False, cssless=False)


if DEBUG:
app.logger.info("DEBUG = {}".format(str(DEBUG)))
app.logger.info("Page Compression = {}".format('FALSE' if DEBUG else 'TRUE'))
app.logger.info("DBMS = {}".format(app_config.SQLALCHEMY_DATABASE_URI))


if __name__ == "__main__":
with app.app_context():
app.run(host="0.0.0.0", port=8080)
32 changes: 27 additions & 5 deletions apps/__init__.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,42 @@
# Copyright (c) 2023. Connor McMillan
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
# following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
# disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
# following disclaimer in the documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote
# products derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#

import logging
import os
import platform
import subprocess
import time
from datetime import datetime
from importlib import import_module

import setproctitle
from flask import Flask
from flask_ipban import IpBan
from flask_login import LoginManager
from flask_mail import Mail
from flask_migrate import Migrate
from flask_sqlalchemy import SQLAlchemy, declarative_base
from redis import Redis
from rq import Queue
from flask import Flask
from flask_login import LoginManager
from flask_sqlalchemy import SQLAlchemy, declarative_base
from importlib import import_module
from flask_mail import Mail

import log
import version
Expand Down
31 changes: 21 additions & 10 deletions apps/alpr/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
# Database
__alpr_alert_db__ = "apps/db/alpr_alert.db"
__alpr_group_db__ = "apps/db/alpr_group.db"
__cache_db__ = "apps/db/cache.db"
__vehicle_db__ = "apps/db/vehicle.db"
# Copyright (c) 2023. Connor McMillan
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
# following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
# disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
# following disclaimer in the documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote
# products derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#

# Json
__alpr_alert_json__ = "apps/db/alpr_alert.json"
__alpr_group_json__ = "apps/db/alpr_group.json"
__cache_json__ = "apps/db/cache.json"
__vehicle_json__ = "apps/db/vehicle.json"
22 changes: 22 additions & 0 deletions apps/alpr/beautify.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
# Copyright (c) 2023. Connor McMillan
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
# following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
# disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
# following disclaimer in the documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote
# products derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#

import json
import logging
import time
Expand Down
Loading

0 comments on commit d548a4a

Please sign in to comment.