tis-config-bitwarden

1.1-7
Bitwarden Configuration
1589 downloads
Download
default icon

  Description 

  • package : tis-config-bitwarden
  • version : 1.1-7
  • architecture : all
  • categories : System and network
  • maintainer : WAPT Team,Tranquil IT,Jimmy PELÉ
  • description : Bitwarden Configuration
  • locale : all
  • target_os : all
  • min_wapt_version :
  • sources :
  • installed_size :
  • impacted_process :
  • description_fr :
  • description_pl :
  • description_de :
  • description_es :
  • description_pt :
  • description_it :
  • description_nl :
  • description_ru :
  • editor :
  • licence :
  • signature_date : 2021-01-28T18:14:59.837927
  • Depends :

  Setup.py 

# -*- coding: utf-8 -*-
from setuphelpers import *
import json

uninstallkey = []

# Defining variables
my_bitwarden_server = 'https://example.ad.domain.lan'


def install():
    pass


def session_setup():
    print('Configuring: URL of remote Bitwarden server')

    #C:\Users\username\AppData\Roaming\Bitwarden\data.json
    #/home/username/.config/Bitwarden/data.json
    user_conf_file = 'data.json'
    if get_os_name() == 'Windows':
        if installed_softwares(uninstallkey='Bitwarden'):
            user_conf_dir = makepath(user_appdata, 'Bitwarden-Portable', 'bitwarden-appdata')
        else:
            user_conf_dir = makepath(user_appdata, 'Bitwarden')
    else:
        user_conf_dir = makepath(user_home_directory(),'.config','Bitwarden')
    user_conf_path = makepath(user_conf_dir,user_conf_file)
    user_conf_content = '{"environmentUrls": {"base": "%s"}, "clearClipboardKey": 20, "enableTray": true, "enableCloseToTray": true}' % my_bitwarden_server

    # Writting configuration file
    if not isdir(user_conf_dir):
        mkdirs(user_conf_dir)
    if isfile(user_conf_path):
        data = json_load(user_conf_path)
        new_data = json.loads(user_conf_content)
        data.update(new_data)
    else:
        data = json.loads(user_conf_content)
    json_write(user_conf_path,data)


def update_package():
    # Incrementing version of the package
    control.version = '%s-%s'%(control.get_software_version(),int(control.version.split('-')[-1])+1)
    control.save_control_to_wapt()
    print('Changing version to: %s in WAPT\\control' % control.version)




def get_os_name():
    import platform
    return platform.system()

def update_control_version(version):
    control.version = '%s-%s'%(version,int(control.version.split('-')[-1])+1)
    control.save_control_to_wapt()

def json_load(json_file):
    with open(json_file) as read_file:
        data = json.load(read_file)
    return data

def json_write(json_file,data,sort_keys=True, indent=4):
    import codecs
    with codecs.open(json_file, 'w', encoding='utf-8') as write_file:
        json.dump(data, write_file, sort_keys=sort_keys, indent=indent)


										

  Changelog 



No changelog.txt.
									
  manifest.sha256