Skip to content

Commit

Permalink
dropped viewing tool
Browse files Browse the repository at this point in the history
the viewing tool is impossible to use with the new session feature. there will be a newer one later
  • Loading branch information
t-a-g-o committed Jun 1, 2024
1 parent 2788149 commit 049ce31
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 110 deletions.
7 changes: 0 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,6 @@ print(db.read_collection('my_collection', session_id))

### PyJONDB gets way more advanced than writing simple data. To learn more about collections, documents, aggregation, linking, and tree structures read the [docs](https://github.com/t-a-g-o/PyJONDB)


# Database Viewing Tool
In the `database-viewer` folder there is an executable which you can run along with any PyJONDB database file (.ndb extension)

#### Note: you cannot directly edit the database with the viewing tool


# License & Contact 📃
This project is published under the [MIT license](./LICENSE)

Expand Down
Binary file removed database-viewer/PyJONDB Viewer.exe
Binary file not shown.
1 change: 0 additions & 1 deletion database-viewer/readme.txt

This file was deleted.

86 changes: 0 additions & 86 deletions database-viewer/src/PyJONDB Viewer.py

This file was deleted.

Binary file removed database-viewer/src/dist/PyJONDB Viewer.exe
Binary file not shown.
4 changes: 2 additions & 2 deletions example.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from pyjondb import session

# Initialize authentication
auth = session.start(work_in_db_dir=False, support_view_tool=True)
#auth.create_user('admin', 'adminpass', roles=['admin'])
auth = session.start(work_in_db_dir=False)
auth.create_user('admin', 'adminpass', roles=['admin'])

# Authenticate and get a session ID
session_id = auth.authenticate('admin', 'adminpass')
Expand Down
4 changes: 3 additions & 1 deletion pyjondb/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
# `--' .-' / `-----' `-----' `--' `--'`-------' `------'
# `---'
#
# made with <3 by tago | version 1.6
# made with <3 by tago | version 2.0
#
# learn more at https://github.com/tagoWorks/pyjondb
#





import json
import os
import base64
Expand Down
16 changes: 3 additions & 13 deletions pyjondb/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
# `--' .-' / `-----' `-----' `--' `--'`-------' `------'
# `---'
#
# made with <3 by tago | version 1.6
# made with <3 by tago | version 2.0
#
# learn more at https://github.com/tagoWorks/pyjondb
#





import hashlib
import os
import json
Expand All @@ -25,33 +26,22 @@
databasepath = None

class start:
def __init__(self, user_file='users.json', work_in_db_dir=True, session_timeout=3600, support_view_tool=False):
def __init__(self, user_file='users.json', work_in_db_dir=True, session_timeout=3600):
"""
Initializes a new instance for the database handling.
Args:
user_file (str, optional): The path to the user file. Defaults to 'users.json'.
work_in_db_dir (bool, optional): Whether to work in the databases directory for the user data. Defaults to 'True'
session_timeout (int, optional): The session timeout in seconds. Defaults to 3600.
support_view_tool (bool, optional): Whether to support the view tool. Defaults to 'False'. Set to false for production.
- Enabling the view tool support will create a PyJONDB user in your user file in order to view the database. This means
that anyone with the PyJONDB View Tool name and password can view your database.
"""
global databasepath
self.user_file = user_file
self.support_view_tool = support_view_tool
self.work_in_db_dir = work_in_db_dir
self.users = self.load_users()
self.sessions = {}
self.absolute = databasepath
self.session_timeout = session_timeout
if self.support_view_tool == True:
hashed_password = self.hash_password("pyjondbviewtool")
self.users["pyjondb.viewtool"] = {
'password': hashed_password,
'roles': ["user"]
}
self.save_users()

def load_users(self):
"""
Expand Down

0 comments on commit 049ce31

Please sign in to comment.