reworked username preloading due to import coupling
This commit is contained in:
parent
cb17270512
commit
4b7b408d60
@ -4,11 +4,12 @@ Setup config from onboarding choices
|
||||
"""
|
||||
from pathlib import Path
|
||||
from typing import Union
|
||||
from threading import Thread
|
||||
from time import sleep
|
||||
|
||||
from filepaths import onboarding_mark_file
|
||||
from onionrtypes import JSONSerializable
|
||||
from onionrtypes import OnboardingConfig
|
||||
from onionrplugins import onionrevents
|
||||
|
||||
import config
|
||||
"""
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@ -69,4 +70,4 @@ def set_config_from_onboarding(config_settings: OnboardingConfig):
|
||||
get(config_settings, 'plainContrib'))
|
||||
|
||||
config.set('onboarding.done', True, savefile=True)
|
||||
onionrevents.event("onboard", config_settings)
|
||||
|
||||
|
@ -16,18 +16,18 @@ import onionrcrypto
|
||||
from onionrcrypto import getourkeypair
|
||||
from etc.onionrvalues import DATABASE_LOCK_TIMEOUT
|
||||
"""
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
"""
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"name" : "usernames",
|
||||
"version" : "0.0.0",
|
||||
"version" : "0.0.1",
|
||||
"author" : "onionr"
|
||||
}
|
||||
|
@ -6,8 +6,13 @@ Preset Onionr usernames
|
||||
import locale
|
||||
locale.setlocale(locale.LC_ALL, '')
|
||||
|
||||
from utils import identifyhome
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)))
|
||||
import logger
|
||||
from onionrusers import contactmanager
|
||||
from utils import identifyhome
|
||||
import config
|
||||
"""
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -24,13 +29,19 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
"""
|
||||
|
||||
plugin_name = 'usernames'
|
||||
PLUGIN_VERSION = '0.0.1'
|
||||
|
||||
|
||||
def on_onboard(api, data=None):
|
||||
username_file = identifyhome.identify_home() + f'plugins/{plugin_name}/usernames.dat'
|
||||
def on_init(api, data = None):
|
||||
config.reload()
|
||||
if config.get('onboarding.done', True):
|
||||
return
|
||||
|
||||
username_file = identifyhome.identify_home() + 'plugins/usernames/usernames.dat'
|
||||
with open(username_file, 'r') as usernames:
|
||||
username_and_keys = usernames.readlines()
|
||||
|
||||
logger.info("Setting preset usernames", terminal=True)
|
||||
for entry in username_and_keys:
|
||||
username, key = entry.split(',')
|
||||
username = username.strip()
|
||||
@ -40,5 +51,3 @@ def on_onboard(api, data=None):
|
||||
user = contactmanager.ContactManager(key, saveUser=True)
|
||||
user.set_info('name', username)
|
||||
|
||||
|
||||
|
||||
|
@ -1 +1,3 @@
|
||||
Kevin Froman,GM3E4VCUNLF5F7Y64STD2HEURG45U3NYPLBZBT3Z6YWOALJHZPPQ
|
||||
Supernova,OXDRJS7YC7GQCQX7AAAJWN7LFI34AB2BE4VBYGEEUWGB3TSDB5FQ
|
||||
Cartr,DWQ4CGQGUAVBTXZKFABS63W6KK4JSXK6HTEOXDATOADJNBE4C62A
|
@ -203,7 +203,7 @@
|
||||
<div class="step-content has-text-justified">
|
||||
<div class="box">
|
||||
<div class="columns">
|
||||
<div class="column is-3">
|
||||
<div class="column is-4">
|
||||
<div class="box">
|
||||
<nav class="level">
|
||||
<div class="level-left">
|
||||
@ -214,7 +214,7 @@
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column is-3">
|
||||
<div class="column is-4">
|
||||
<div class="box">
|
||||
<nav class="level">
|
||||
<div class="level-left">
|
||||
@ -225,7 +225,7 @@
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column is-3">
|
||||
<div class="column is-4">
|
||||
<div class="box">
|
||||
<nav class="level">
|
||||
<div class="level-left">
|
||||
@ -236,17 +236,6 @@
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column is-3">
|
||||
<div class="box">
|
||||
<nav class="level">
|
||||
<div class="level-left">
|
||||
<div class="level-item">
|
||||
<i class="icon fas fa-id-card" for="usernames"></i> <input type="checkbox" name="usernames" checked> <label for="usernames">Preloaded Usernames</label>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -52,13 +52,12 @@ document.getElementById('onboardingForm').onsubmit = function(e){
|
||||
submitInfo.networkContrib = getCheckValue('networkContribution')
|
||||
submitInfo.plainContrib = getCheckValue('networkContributionPlain')
|
||||
submitInfo.donate = getCheckValue('donate')
|
||||
//submitInfo.deterministic = getCheckValue('useDeterministic')
|
||||
submitInfo.mail = getCheckValue('useMail')
|
||||
submitInfo.circles = getCheckValue('useCircles')
|
||||
submitInfo.useDark = getCheckValue('useDarkTheme')
|
||||
submitInfo.preloadUsernames = getCheckValue('usernames')
|
||||
submitInfo.optimize = getCheckValue('optimize')
|
||||
|
||||
|
||||
if (submitInfo.donate){
|
||||
openDonateModal(submitInfo)
|
||||
return false
|
||||
|
Loading…
Reference in New Issue
Block a user