1
0
Fork 0
mirror of https://github.com/seiichiro0185/sailotp.git synced 2024-04-26 01:19:21 +00:00

Fix Empty Token List after Restart for New Installs

This commit is contained in:
seiichiro 2023-02-26 19:09:23 +01:00
parent 78b9e561bd
commit 90314355e0
4 changed files with 35 additions and 4 deletions

View file

@ -15,7 +15,7 @@ From the main view a token can be copied to the clipboard by tapping on it.
From the pulley menu the token database can be exported to a file for backup purposes. The backup is a AES-256-CBC encrypted and
Base64 encoded file containing a JSON-representation of the database. It can be decrypted with openssl using the following command:
openssl enc -d -a -A -md md5 -aes-256-cbc -in <file>
openssl enc -d -a -aes-256-cbc -in <file>
if you need the information outside of SailOTP.

View file

@ -1,3 +1,6 @@
* Sun Feb 26 2023 Stefan Brand <sailfish@seiichiro0185.org> 1.11.1-1
- Fix Empty Token List after Restart for New Installs.
* Mon Feb 20 2023 Stefan Brand <sailfish@seiichiro0185.org> 1.11.0-1
- Rework Export/Import File Encryption to use C++
- Switch to SHA256 for Export/Import Encryption instead of MD5

View file

@ -1,6 +1,6 @@
Name: harbour-sailotp
Summary: SailOTP
Version: 1.11.0
Version: 1.11.1
Release: 1
Group: Security
URL: https://github.com/seiichiro0185/sailotp/

View file

@ -35,6 +35,31 @@
#include "qzxing.h"
#include "qqrencode.h"
void migrateLocalStorage()
{
// The new location of the LocalStorage database
QDir newDbDir(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + "/QML/OfflineStorage/Databases/");
if(newDbDir.exists())
return;
newDbDir.mkpath(newDbDir.path());
QString dbname = QString(QCryptographicHash::hash(("harbour-sailotp"), QCryptographicHash::Md5).toHex());
// The old LocalStorage database
QFile oldDb(QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + "/.local/share/harbour-sailotp/harbour-sailotp/QML/OfflineStorage/Databases/" + dbname + ".sqlite");
QFile oldIni(QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + "/.local/share/harbour-sailotp/harbour-sailotp/QML/OfflineStorage/Databases/" + dbname + ".ini");
qDebug() << "Migrating " + oldDb.fileName() + " to " + newDbDir.absolutePath() + "/" + dbname + ".sqlite";
// Copy to new Database Location
oldDb.copy(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + "/QML/OfflineStorage/Databases/" + dbname + ".sqlite");
oldIni.copy(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + "/QML/OfflineStorage/Databases/" + dbname + ".ini");
}
int main(int argc, char *argv[])
{
// Get App and QML-View objects
@ -51,9 +76,12 @@ int main(int argc, char *argv[])
translator.load(locale,SailfishApp::pathTo(QString("i18n")).toLocalFile());
app->installTranslator(&translator);
// Migrate to new Storage Directory
migrateLocalStorage();
// Set some global values
app->setOrganizationName("harbour-sailotp");
app->setOrganizationDomain("harbour-sailotp");
app->setOrganizationName("org.seiichiro0185");
app->setOrganizationDomain("org.seiichiro0185");
app->setApplicationName("harbour-sailotp");
app->setApplicationVersion(APP_VERSION);