diff --git a/appimage-requirements.txt b/appimage-requirements.txt index 9e6b21e..2d812a1 100644 --- a/appimage-requirements.txt +++ b/appimage-requirements.txt @@ -4,3 +4,4 @@ izzylib-sql@git+https://git.barkshark.xyz/izaliamae/izzylib-sql objgraph==3.5.0 pillow==8.3.2 pysftp==0.2.9 +watchfiles==0.17.0 diff --git a/appimage.yaml b/appimage.yaml index f2c747a..ef5875a 100644 --- a/appimage.yaml +++ b/appimage.yaml @@ -1,12 +1,12 @@ version: 1 script: - #- rm -rf AppDir | true - - mkdir -p AppDir/usr/src - - mkdir -p AppDir/usr/share/icons/hicolor/128x128/apps - - cp -R barkshark_web AppDir/usr/src/ - - cp appimage-requirements.txt AppDir/usr/src/requirements.txt - - cp appimage-main.py AppDir/usr/src/main.py - - cp barkshark_web/resources/icon-128.png AppDir/usr/share/icons/hicolor/128x128/apps/barkshark-web.png + - rm -rf ${APPDIR} | true + - mkdir -p ${APPDIR}/usr/src + - mkdir -p ${APPDIR}/usr/share/icons/hicolor/128x128/apps + - cp -R barkshark_web ${APPDIR}/usr/src/ + - cp appimage-requirements.txt ${APPDIR}/usr/src/requirements.txt + - cp appimage-main.py ${APPDIR}/usr/src/main.py + - cp barkshark_web/resources/icon-128.png ${APPDIR}/usr/share/icons/hicolor/128x128/apps/barkshark-web.png AppDir: @@ -21,7 +21,7 @@ AppDir: exec_args: "${APPDIR}/usr/src/main.py $@" after_bundle: - - AppDir/usr/bin/python3 -m pip install --ignore-installed --prefix=/usr --root=AppDir -r appimage-requirements.txt + - ${APPDIR}/usr/bin/python3 -m pip install --ignore-installed --prefix=/usr --root=${APPDIR} -r appimage-requirements.txt apt: arch: amd64 allow_unauthenticated: true @@ -62,7 +62,6 @@ AppDir: - python3-pkg-resources - python3-psutil - python3-secretstorage - - python3-watchdog - python3-wheel - xapp diff --git a/barkshark_web/__init__.py b/barkshark_web/__init__.py index 7750404..9881802 100644 --- a/barkshark_web/__init__.py +++ b/barkshark_web/__init__.py @@ -11,8 +11,9 @@ gi.require_version('Gdk', '3.0') gi.require_version('GdkPixbuf', '2.0') gi.require_version('Gtk', '3.0') gi.require_version('Notify', '0.7') -gi.require_version('WebKit2', '4.0') +try: gi.require_version('WebKit2', '4.1') +except ValueError: gi.require_version('WebKit2', '4.0') from izzylib import LruCache from gi.repository import ( diff --git a/barkshark_web/component/status_bar.py b/barkshark_web/component/status_bar.py index 423d623..10d58a5 100644 --- a/barkshark_web/component/status_bar.py +++ b/barkshark_web/component/status_bar.py @@ -294,7 +294,7 @@ class StatusBar(ComponentBase): data = self.bookmark_get_data() if self.bookmark_row: - self.put_bookmark_row(self.bookmark_row, **data) + s.put_bookmark_row(self.bookmark_row, **data) else: s.put_bookmark(**data) diff --git a/barkshark_web/config.py b/barkshark_web/config.py index b3b0b3d..14645fb 100644 --- a/barkshark_web/config.py +++ b/barkshark_web/config.py @@ -1,3 +1,5 @@ +import os + from izzylib.config import JsonConfig from izzylib.misc import get_current_user_info from izzylib.object_base import ObjectBase @@ -29,14 +31,15 @@ def get_config(paths): def get_paths(profile='DEFAULT'): - data = Path.app_data_dir('config', 'barkshark', 'web') + home = Path(os.environ.get('HOME', '~')) + data = Path(os.environ.get('XDG_CONFIG_HOME', home.join('.config', 'barkshark', 'web'))) profilepath = data.join(profile or 'DEFAULT') paths = ObjectBase( readonly_props = True, # misc paths - downloads = Path('~/Downloads'), + downloads = home.join('Downloads'), data = data, script = scriptpath, diff --git a/barkshark_web/database/__init__.py b/barkshark_web/database/__init__.py index 5f4c60b..2dcbcea 100644 --- a/barkshark_web/database/__init__.py +++ b/barkshark_web/database/__init__.py @@ -1,3 +1,4 @@ +from izzylib.misc import class_name from izzylib_sql import Database from . import migrate @@ -34,11 +35,19 @@ def get_database(app): with db.session as s: ## Check if database is up to date and migrate if necessary - if not s.tables.get('config'): - version = 0 + try: + if not s.tables.get('config'): + version = 0 - else: - version = s.get_config('version', 0) + else: + version = s.get_config('version', 0) + + except Exception as e: + if class_name(e).lower() == 'operationalerror': + version = 0 + + else: + raise e if var.dbversion > version: migrate.now(db, version) diff --git a/barkshark_web/database/migrate.py b/barkshark_web/database/migrate.py index 6c90840..33e8db7 100644 --- a/barkshark_web/database/migrate.py +++ b/barkshark_web/database/migrate.py @@ -1,6 +1,6 @@ import sys -from .base import tables +from .base import tables, default_config, default_searches from .. import var from ..functions import get_app @@ -24,17 +24,17 @@ def now(db, version): db.create_database(tables) with db.session as s: - ## Input default data and then return if version == 0: - for k,v in s.default_config.items(): + for k,v in default_config.items(): s.put_config(k, v[0], v[1]) - for keyword, data in s.default_searches.items(): + for keyword, data in default_searches.items(): s.put_search(data[0], keyword, data[1]) - if version < 20210905: - s.create_tables({'passwords': tables['passwords']}) - s.drop_table('passfields') + else: + if version < 20210905: + s.create_tables({'passwords': tables['passwords']}) + s.drop_table('passfields') s.put_config('version', var.dbversion, 'int') diff --git a/barkshark_web/protocol/local.py b/barkshark_web/protocol/local.py index 40853ec..4227b04 100644 --- a/barkshark_web/protocol/local.py +++ b/barkshark_web/protocol/local.py @@ -472,8 +472,8 @@ def preferences_update(handler, request): if tab.zoom == s.get_config('zoom'): tab.page_action('zoom', zoom=value) - row = s.put_config(key, value) - logging.verbose(f'Updated config: {row.key} = {row.value}') + s.put_config(key, value) + logging.verbose(f'Updated config: {key} = {value}') return request.ok_or_redirect('Updated preferences') diff --git a/pyvenv.json b/pyvenv.json index 8283094..79825ad 100644 --- a/pyvenv.json +++ b/pyvenv.json @@ -72,7 +72,7 @@ "url": null }, "pygobject": { - "version": "3.38.2", + "version": "3.42.2", "options": [], "url": null }, @@ -115,4 +115,4 @@ "pyvenv.py" ] } -} +} \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 7238d7b..088d07c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,17 +1,18 @@ -beautifulsoup4==4.9.3 -click==8.1.0 -configobj@git+https://github.com/DiffSK/configobj +beautifulsoup4==4.11.1 +click==8.1.3 +configobj@git+https://github.com/DiffSK/configobj@v5.0.6 dasbus==1.6 dnspython==2.2.1 +izzylib@git+https://git.barkshark.xyz/izaliamae/izzylib@0.7.5 izzylib-http-async@git+https://git.barkshark.xyz/izaliamae/izzylib-http-async izzylib-sql@git+https://git.barkshark.xyz/izaliamae/izzylib-sql -lxml==4.6.3 +lxml==4.9.1 mastodon.py==1.5.1 objgraph==3.5.0 -pillow==8.3.2 -psutil==5.8.0 +pillow==9.2.0 +psutil==5.9.1 pycairo==1.21.0 -pygobject==3.38.0 +pygobject==3.42.2 pysftp==0.2.9 secretstorage==3.3.2 watchfiles==0.17.0 diff --git a/setup.cfg b/setup.cfg index 0f0a3f6..5c9029e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -32,20 +32,19 @@ python_requires = >= 3.8 packages = barkshark_web setup_requires = - beautifulsoup4==4.9.3 - click==8.1.0 - configobj@git+https://github.com/DiffSK/configobj + beautifulsoup4==4.11.1 + click==8.1.3 + configobj@git+https://github.com/DiffSK/configobj@v5.0.6 dasbus==1.6 dnspython==2.2.1 - izzylib@git+https://git.barkshark.xyz/izaliamae/izzylib@0.7.5 izzylib-http-async@git+https://git.barkshark.xyz/izaliamae/izzylib-http-async izzylib-sql@git+https://git.barkshark.xyz/izaliamae/izzylib-sql - lxml==4.6.3 + lxml==4.9.1 mastodon.py==1.5.1 objgraph==3.5.0 - pillow==8.3.2 - psutil==5.8.0 - pygobject==3.38.0 + pillow==9.2.0 + psutil==5.9.1 + pygobject==3.38.2 pysftp==0.2.9 secretstorage==3.3.2 watchfiles==0.17.0