extract all
This commit is contained in:
15
PKGBUILD
15
PKGBUILD
@@ -1,22 +1,27 @@
|
|||||||
pkgname=dull
|
pkgname=dull-git
|
||||||
pkgver=0.1
|
pkgver=0.1
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="Desktop app for securely storing sensitive files"
|
pkgdesc="Desktop app for securely storing sensitive files"
|
||||||
arch=('x86_64')
|
arch=('x86_64')
|
||||||
url="https://github.com/antpiasecki/dull"
|
url="https://github.com/antpiasecki/dull"
|
||||||
depends=('qt6-base' 'botan')
|
depends=('qt6-base' 'botan')
|
||||||
makedepends=('cmake')
|
makedepends=('cmake' 'git')
|
||||||
source=("${url}/archive/refs/tags/${pkgver}.tar.gz")
|
source=("git+${url}.git")
|
||||||
sha256sums=('SKIP')
|
sha256sums=('SKIP')
|
||||||
options=('!debug')
|
options=('!debug')
|
||||||
|
|
||||||
|
pkgver() {
|
||||||
|
cd "${pkgname%-git}"
|
||||||
|
git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
|
||||||
|
}
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
cd "${pkgname}-${pkgver}"
|
cd "${pkgname%-git}"
|
||||||
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr
|
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr
|
||||||
cmake --build build -j$(nproc)
|
cmake --build build -j$(nproc)
|
||||||
}
|
}
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
cd "${pkgname}-${pkgver}/build"
|
cd "${pkgname%-git}/build"
|
||||||
make DESTDIR="${pkgdir}" install
|
make DESTDIR="${pkgdir}" install
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include <botan/aead.h>
|
#include <botan/aead.h>
|
||||||
#include <botan/hex.h>
|
|
||||||
#include <botan/pwdhash.h>
|
#include <botan/pwdhash.h>
|
||||||
|
|
||||||
namespace Crypto {
|
namespace Crypto {
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include <QApplication>
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
// TODO: actual fs
|
// TODO: actual fs
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QDragEnterEvent>
|
|
||||||
#include <QDropEvent>
|
#include <QDropEvent>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
@@ -9,7 +8,6 @@
|
|||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
#include <QTemporaryDir>
|
#include <QTemporaryDir>
|
||||||
#include <botan/auto_rng.h>
|
#include <botan/auto_rng.h>
|
||||||
#include <botan/hex.h>
|
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent)
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
: QMainWindow(parent), ui(std::make_unique<Ui::MainWindow>()) {
|
: QMainWindow(parent), ui(std::make_unique<Ui::MainWindow>()) {
|
||||||
@@ -22,12 +20,12 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
connect(ui->actionNew, &QAction::triggered, this, [this]() {
|
connect(ui->actionNew, &QAction::triggered, this, [this]() {
|
||||||
QString path = QFileDialog::getSaveFileName(this, "Choose vault location",
|
QString path = QFileDialog::getSaveFileName(this, "Choose vault location",
|
||||||
QDir::currentPath(),
|
QDir::currentPath(),
|
||||||
"Dull Vaults (*.dull)");
|
"Dull vaults (*.dull)");
|
||||||
if (path.isEmpty()) {
|
if (path.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!path.contains(".dull")) {
|
if (!path.endsWith(".dull")) {
|
||||||
path += ".dull";
|
path += ".dull";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,6 +110,29 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
ui->statusbar->showMessage("Added " + QString::number(paths.size()) +
|
ui->statusbar->showMessage("Added " + QString::number(paths.size()) +
|
||||||
" files");
|
" files");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
connect(ui->actionExtract_All, &QAction::triggered, this, [this]() {
|
||||||
|
if (!m_vault) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString path =
|
||||||
|
QFileDialog::getExistingDirectory(this, "Choose location to extract");
|
||||||
|
if (path.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto headers = m_vault->read_file_headers();
|
||||||
|
for (const auto &header : headers) {
|
||||||
|
auto content = m_vault->read_file(header.name);
|
||||||
|
if (content) {
|
||||||
|
std::ofstream file(path.toStdString() + "/" + header.name,
|
||||||
|
std::ios::binary);
|
||||||
|
file.write(content->data(), static_cast<i64>(content->size()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ui->statusbar->showMessage("Extracted all files to " + path);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::reload_fs_tree() {
|
void MainWindow::reload_fs_tree() {
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
#include "ui_mainwindow.h"
|
#include "ui_mainwindow.h"
|
||||||
#include "vault.h"
|
#include "vault.h"
|
||||||
#include <QMainWindow>
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
class MainWindow : public QMainWindow {
|
class MainWindow : public QMainWindow {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|||||||
@@ -46,8 +46,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>800</width>
|
<width>900</width>
|
||||||
<height>32</height>
|
<height>30</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menuVault">
|
<widget class="QMenu" name="menuVault">
|
||||||
@@ -65,6 +65,7 @@
|
|||||||
<string>Files</string>
|
<string>Files</string>
|
||||||
</property>
|
</property>
|
||||||
<addaction name="actionAddFiles"/>
|
<addaction name="actionAddFiles"/>
|
||||||
|
<addaction name="actionExtract_All"/>
|
||||||
</widget>
|
</widget>
|
||||||
<addaction name="menuVault"/>
|
<addaction name="menuVault"/>
|
||||||
<addaction name="menuFiles"/>
|
<addaction name="menuFiles"/>
|
||||||
@@ -93,6 +94,14 @@
|
|||||||
<string>Add</string>
|
<string>Add</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionExtract_All">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="document-save-as"/>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Extract All</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#include "vault.h"
|
#include "vault.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "crypto.h"
|
#include "crypto.h"
|
||||||
#include <array>
|
|
||||||
#include <botan/auto_rng.h>
|
#include <botan/auto_rng.h>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user