diff --git a/README.md b/README.md index 827b388..61751e2 100644 --- a/README.md +++ b/README.md @@ -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 +openssl enc -d -a -aes-256-cbc -in if you need the information outside of SailOTP. diff --git a/rpm/harbour-sailotp.changes b/rpm/harbour-sailotp.changes index 780e081..e0470c8 100644 --- a/rpm/harbour-sailotp.changes +++ b/rpm/harbour-sailotp.changes @@ -1,3 +1,6 @@ +* Sun Feb 26 2023 Stefan Brand 1.11.1-1 +- Fix Empty Token List after Restart for New Installs. + * Mon Feb 20 2023 Stefan Brand 1.11.0-1 - Rework Export/Import File Encryption to use C++ - Switch to SHA256 for Export/Import Encryption instead of MD5 diff --git a/rpm/harbour-sailotp.yaml b/rpm/harbour-sailotp.yaml index e100111..d6c3648 100644 --- a/rpm/harbour-sailotp.yaml +++ b/rpm/harbour-sailotp.yaml @@ -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/ diff --git a/src/harbour-sailotp.cpp b/src/harbour-sailotp.cpp index 09bd660..ce51e16 100644 --- a/src/harbour-sailotp.cpp +++ b/src/harbour-sailotp.cpp @@ -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);