From 203c1fb0ac6f65d72a287ec00b9ebea977f2ba03 Mon Sep 17 00:00:00 2001 From: InitialPosition Date: Sat, 18 Sep 2021 19:25:12 +0200 Subject: [PATCH] Update 1.4.4 - fixed a crash related to cookie retrieval in powershell - properly named list and keyword search in the main menu --- files/bulk_voting_explanation.txt | 2 +- files/voting_explanation.txt | 2 +- main.py | 4 ++-- util/CONSTANTS.py | 2 +- util/CookieFetch.py | 16 ++++++++++------ 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/files/bulk_voting_explanation.txt b/files/bulk_voting_explanation.txt index fa18f3b..21f82bf 100644 --- a/files/bulk_voting_explanation.txt +++ b/files/bulk_voting_explanation.txt @@ -1,4 +1,4 @@ -Starting bulk theme voting. +Starting keyword theme voting. Enter a keyword. The program will then look for themes containing that keyword. You then have the ability to vote YES/NO for all of them at once. If you only want to vote for certain themes, include their index in the command. For example, 'Y 2 3 12' will vote YES for themes 2, 3 and 12. diff --git a/files/voting_explanation.txt b/files/voting_explanation.txt index 02a3d04..778b42f 100644 --- a/files/voting_explanation.txt +++ b/files/voting_explanation.txt @@ -1,4 +1,4 @@ -Starting list voting. +Starting list theme voting. The program will show you 10 themes. You have the ability to vote YES/NO for all of them at once. If you only want to vote for certain themes, include their index in the command. For example, 'Y 2 3 12' will vote YES for themes 2, 3 and 12. diff --git a/main.py b/main.py index 3fba978..706ed0f 100644 --- a/main.py +++ b/main.py @@ -47,8 +47,8 @@ def main_menu(): valid_selections.append('4') # print default main menu - print('[1] Start theme voting') - print('[2] Start bulk theme voting') + print('[1] Start list theme voting') + print('[2] Start keyword theme voting') print('[3] Exit') if update_check_result == UpdateCheckResult.UPDATE_AVAILABLE: diff --git a/util/CONSTANTS.py b/util/CONSTANTS.py index 2254d4d..8927f58 100644 --- a/util/CONSTANTS.py +++ b/util/CONSTANTS.py @@ -1,3 +1,3 @@ CONFIG_FILE = 'config.yml' -VERSION = '1.4.3' +VERSION = '1.4.4' AUTHOR = 'InitialPosition / RedCocoa' diff --git a/util/CookieFetch.py b/util/CookieFetch.py index e289587..e0b9b90 100644 --- a/util/CookieFetch.py +++ b/util/CookieFetch.py @@ -2,6 +2,7 @@ import platform import sqlite3 import subprocess +from configparser import MissingSectionHeaderError from getpass import getuser from os import path, getenv from os.path import isdir @@ -26,7 +27,7 @@ def get_cookie_firefox(): os = platform.system() if os == 'Windows': - appdata_dir = path.join(getenv('APPDATA'), 'Mozilla/Firefox') + appdata_dir = path.join(getenv('APPDATA'), 'Mozilla/Firefox').rstrip().replace("\\", "/") elif os == 'Linux': if in_wsl(): # we are in linux subsystem print('Detected Windows Subsystem for Linux') @@ -36,7 +37,7 @@ def get_cookie_firefox(): hack_path = hack_path.rstrip().replace("\\", "/").replace("C:", "/mnt/c") appdata_dir = path.join(hack_path, 'Mozilla/Firefox') else: - appdata_dir = path.join('/home/', getuser(), '.mozilla/firefox') + appdata_dir = path.join('/home/', getuser(), '.mozilla/firefox').rstrip().replace("\\", "/") else: print('Could not establish OS! Aborting cookie retrieval...') return -1 @@ -45,11 +46,14 @@ def get_cookie_firefox(): print('Firefox was not found on this system') return -1 - config_path = path.join(appdata_dir, 'profiles.ini') + config_path = path.join(appdata_dir, 'profiles.ini').rstrip().replace("\\", "/") - config = configparser.ConfigParser() - config.read(config_path) - database_path = path.join(appdata_dir, config['Profile0']['Path'], 'cookies.sqlite') + try: + config = configparser.ConfigParser() + config.read(config_path) + database_path = path.join(appdata_dir, config['Profile0']['Path'], 'cookies.sqlite') + except MissingSectionHeaderError: + return -1 # connect to cookie database and read cookie try: