This commit is contained in:
parent
305dcbd794
commit
024570f0ed
7 changed files with 235 additions and 34 deletions
81
.forgejo/workflows/dotnet.yaml
Normal file
81
.forgejo/workflows/dotnet.yaml
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
name: Java CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: arch-rolling
|
||||||
|
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check Dotnet Version
|
||||||
|
run: |
|
||||||
|
dotnet --version
|
||||||
|
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Extract FileVersion from .csproj
|
||||||
|
id: get_version
|
||||||
|
run: |
|
||||||
|
version=$(grep -oPm1 "(?<=<FileVersion>)[^<]+" Cryptura/Cryptura.csproj)
|
||||||
|
echo "Cryptura version: $version"
|
||||||
|
echo "version=$version" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
|
||||||
|
- name: Check if release tag already exists
|
||||||
|
run: |
|
||||||
|
tag="v${{ steps.get_version.outputs.version }}"
|
||||||
|
if git ls-remote --tags origin | grep -q "refs/tags/$tag"; then
|
||||||
|
echo "Release tag $tag already exists. Cancelling workflow."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Build the project (Linux x64)
|
||||||
|
run: |
|
||||||
|
dotnet publish ./Cryptura/Cryptura.csproj \
|
||||||
|
-c Release \
|
||||||
|
-r linux-x64 \
|
||||||
|
--self-contained true \
|
||||||
|
-p:PublishSingleFile=true \
|
||||||
|
-p:PublishTrimmed=true \
|
||||||
|
-o ./output_linux
|
||||||
|
- name: Build the project (Windows x64)
|
||||||
|
run: |
|
||||||
|
dotnet publish ./Cryptura/Cryptura.csproj \
|
||||||
|
-c Release \
|
||||||
|
-r win-x64 \
|
||||||
|
--self-contained true \
|
||||||
|
-p:PublishSingleFile=true \
|
||||||
|
-p:PublishTrimmed=true \
|
||||||
|
-o ./output_win
|
||||||
|
|
||||||
|
|
||||||
|
- name: Pack Releases into Zips
|
||||||
|
run: |
|
||||||
|
mkdir -p ./release
|
||||||
|
zip -r ./release/Cryptura_Linux_x64.zip ./output_linux
|
||||||
|
zip -r ./release/Cryptura_Windows_x64.zip ./output_win
|
||||||
|
rm -rf ./output_linux ./output_win
|
||||||
|
|
||||||
|
|
||||||
|
- name: Create Git tag
|
||||||
|
run: |
|
||||||
|
git config user.name "WeeXnes"
|
||||||
|
git config user.email "somtrigi@gmail.com"
|
||||||
|
git tag v${{ steps.get_version.outputs.version }}
|
||||||
|
git push origin v${{ steps.get_version.outputs.version }}
|
||||||
|
|
||||||
|
- name: Upload to Forgejo
|
||||||
|
uses: actions/forgejo-release@v2.6.0
|
||||||
|
with:
|
||||||
|
direction: upload
|
||||||
|
url: https://git.weexnes.dev/
|
||||||
|
repo: WeeXnes/Cryptura
|
||||||
|
token: ${{ secrets.RELEASE_TOKEN }}
|
||||||
|
tag: v${{ steps.get_version.outputs.version }}
|
||||||
|
release-dir: release
|
||||||
|
release-notes: "Automated release for version ${{ steps.get_version.outputs.version }}"
|
|
@ -6,6 +6,8 @@
|
||||||
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
||||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||||
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
|
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
|
||||||
|
<AssemblyVersion>1.0</AssemblyVersion>
|
||||||
|
<FileVersion>1.0</FileVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -18,4 +18,27 @@ public class Globals
|
||||||
{
|
{
|
||||||
return Guid.NewGuid() + ".wx";
|
return Guid.NewGuid() + ".wx";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static class ColorScheme
|
||||||
|
{
|
||||||
|
public static class Primary
|
||||||
|
{
|
||||||
|
public static string Color_1 = "#28548a";
|
||||||
|
public static string Color_2 = "#446597";
|
||||||
|
public static string Color_3 = "#5c77a3";
|
||||||
|
public static string Color_4 = "#7489b0";
|
||||||
|
public static string Color_5 = "#8b9cbd";
|
||||||
|
public static string Color_6 = "#a1afca";
|
||||||
|
}
|
||||||
|
public static class Surface
|
||||||
|
{
|
||||||
|
public static string Color_1 = "#161a21";
|
||||||
|
public static string Color_2 = "#2b2f36";
|
||||||
|
public static string Color_3 = "#42454c";
|
||||||
|
public static string Color_4 = "#5a5d63";
|
||||||
|
public static string Color_5 = "#73767b";
|
||||||
|
public static string Color_6 = "#8e9094";
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -23,33 +23,58 @@
|
||||||
</ExperimentalAcrylicBorder.Material>
|
</ExperimentalAcrylicBorder.Material>
|
||||||
</ExperimentalAcrylicBorder>
|
</ExperimentalAcrylicBorder>
|
||||||
|
|
||||||
<Grid RowDefinitions="4*, 50">
|
<Grid>
|
||||||
<Border Grid.Row="0" Background="#35313d" CornerRadius="10" Margin="10">
|
<Border Grid.Row="0" Background="#80000000" CornerRadius="10" Margin="10" Name="ContentBorder">
|
||||||
<ListBox Name="PasswordList" Background="Transparent" SelectionChanged="PasswordList_OnSelectionChanged">
|
<ListBox Name="PasswordList" Background="Transparent" SelectionChanged="PasswordList_OnSelectionChanged">
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate x:DataType="local:Password">
|
<DataTemplate x:DataType="local:Password">
|
||||||
<Border Background="Transparent" Padding="10">
|
<Border Background="Transparent" Padding="10">
|
||||||
<Grid ColumnDefinitions="*, *">
|
<Border.ContextMenu>
|
||||||
<TextBlock Grid.Column="0" Foreground="White" Text="{Binding Name}" VerticalAlignment="Center"/>
|
<ContextMenu>
|
||||||
<TextBlock Grid.Column="1" Foreground="White" Text="{Binding DisplayValue}" VerticalAlignment="Center"/>
|
<MenuItem Header="Add New Password" Click="CreatePassword_OnClick"/>
|
||||||
</Grid>
|
<MenuItem Header="Remove Password" Click="DeletePassword_OnClick"/>
|
||||||
</Border>
|
</ContextMenu>
|
||||||
</DataTemplate>
|
</Border.ContextMenu>
|
||||||
</ListBox.ItemTemplate>
|
<Grid ColumnDefinitions="*, *">
|
||||||
<ListBox.Styles>
|
<TextBlock Grid.Column="0" Foreground="White" Text="{Binding Name}" VerticalAlignment="Center"/>
|
||||||
<Style Selector="ListBoxItem:selected /template/ ContentPresenter">
|
<TextBlock Grid.Column="1" Foreground="White" Text="{Binding DisplayValue}" VerticalAlignment="Center"/>
|
||||||
<Setter Property="Background" Value="#35313d"/>
|
</Grid>
|
||||||
</Style>
|
</Border>
|
||||||
<Style Selector="ListBoxItem">
|
</DataTemplate>
|
||||||
<Setter Property="Padding" Value="0"/>
|
</ListBox.ItemTemplate>
|
||||||
<Setter Property="CornerRadius" Value="10"/>
|
<ListBox.ContextMenu>
|
||||||
</Style>
|
<ContextMenu>
|
||||||
</ListBox.Styles>
|
<MenuItem Header="Add New Password" Click="CreatePassword_OnClick"/>
|
||||||
</ListBox>
|
<MenuItem Header="Remove Password" Click="DeletePassword_OnClick"/>
|
||||||
|
</ContextMenu>
|
||||||
|
</ListBox.ContextMenu>
|
||||||
|
<ListBox.Styles>
|
||||||
|
<Style Selector="ListBoxItem:selected /template/ ContentPresenter">
|
||||||
|
<Setter Property="Background" Value="#35313d"/>
|
||||||
|
</Style>
|
||||||
|
<Style Selector="ListBoxItem">
|
||||||
|
<Setter Property="Padding" Value="0"/>
|
||||||
|
<Setter Property="CornerRadius" Value="10"/>
|
||||||
|
</Style>
|
||||||
|
</ListBox.Styles>
|
||||||
|
</ListBox>
|
||||||
|
|
||||||
</Border>
|
</Border>
|
||||||
<Border Grid.Row="1" Background="#35313d" CornerRadius="10" Margin="10,0,10,10">
|
<Border Background="#80000000" Name="AddPasswordContainer" IsVisible="False">
|
||||||
<Button Click="Button_OnClick"></Button>
|
<Border Margin="50" Background="#2b2f36" CornerRadius="10">
|
||||||
|
<StackPanel Spacing="10" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="20">
|
||||||
|
<TextBlock Text="Name:" Margin="20,0"/>
|
||||||
|
<TextBox Name="PasswordName" Margin="20,0" HorizontalAlignment="Stretch" VerticalAlignment="Center" KeyDown="DialogKeyDown"/>
|
||||||
|
<TextBlock Text="Password:" Margin="20,0"/>
|
||||||
|
<TextBox Name="PasswordValue" Margin="20,0" HorizontalAlignment="Stretch" VerticalAlignment="Center" KeyDown="DialogKeyDown"/>
|
||||||
|
<TextBlock Text="Repeat Password:" Margin="20,0"/>
|
||||||
|
<TextBox Name="PasswordRepeat" Margin="20,0" HorizontalAlignment="Stretch" VerticalAlignment="Center" KeyDown="DialogKeyDown"/>
|
||||||
|
<Button Name="PasswordSave" Click="PasswordSave_OnClick" HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||||
|
Content="Confirm"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
</Border>
|
||||||
|
|
||||||
</Border>
|
</Border>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Panel>
|
</Panel>
|
||||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Data;
|
using Avalonia.Data;
|
||||||
|
using Avalonia.Input;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
using Avalonia.Media;
|
using Avalonia.Media;
|
||||||
|
|
||||||
|
@ -17,7 +18,8 @@ public partial class MainWindow : Window
|
||||||
if (Core.IsRunningOnGnome())
|
if (Core.IsRunningOnGnome())
|
||||||
{
|
{
|
||||||
this.TransparencyLevelHint = new[] { WindowTransparencyLevel.None };
|
this.TransparencyLevelHint = new[] { WindowTransparencyLevel.None };
|
||||||
this.Background = new SolidColorBrush(Color.Parse("#201c29"));
|
this.Background = new SolidColorBrush(Color.Parse(ColorScheme.Surface.Color_1));
|
||||||
|
this.ContentBorder.Background = new SolidColorBrush(Color.Parse(ColorScheme.Surface.Color_2));
|
||||||
AcrylicBorderObject.IsVisible = false;
|
AcrylicBorderObject.IsVisible = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -32,7 +34,6 @@ public partial class MainWindow : Window
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
MasterPassword = masterPassword;
|
MasterPassword = masterPassword;
|
||||||
AdjustThemeToPlatform();
|
AdjustThemeToPlatform();
|
||||||
Password pw = new Password("Example", "Password");
|
|
||||||
FetchPasswords();
|
FetchPasswords();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,4 +75,54 @@ public partial class MainWindow : Window
|
||||||
{
|
{
|
||||||
if (PasswordList.SelectedItem is Password password) Core.SetClipboardText(password.Value, this);
|
if (PasswordList.SelectedItem is Password password) Core.SetClipboardText(password.Value, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CreatePassword_OnClick(object? sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
AddPasswordContainer.IsVisible = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DeletePassword_OnClick(object? sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ErrorMessage(string message)
|
||||||
|
{
|
||||||
|
//TODO: Show Error in GUI
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SavePassword()
|
||||||
|
{
|
||||||
|
if (String.IsNullOrEmpty(PasswordName.Text))
|
||||||
|
{
|
||||||
|
ErrorMessage("Name cannot be empty");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(String.IsNullOrEmpty(PasswordValue.Text))
|
||||||
|
{
|
||||||
|
ErrorMessage("Password cannot be empty");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (PasswordValue.Text != PasswordRepeat.Text)
|
||||||
|
{
|
||||||
|
ErrorMessage("Password doesn't match");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Password newPassword = new Password(PasswordName.Text, PasswordValue.Text);
|
||||||
|
FetchPasswords();
|
||||||
|
AddPasswordContainer.IsVisible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PasswordSave_OnClick(object? sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
SavePassword();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DialogKeyDown(object? sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Key == Key.Enter)
|
||||||
|
{
|
||||||
|
SavePassword();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -6,7 +6,8 @@
|
||||||
x:Class="Cryptura.PasswordWindow"
|
x:Class="Cryptura.PasswordWindow"
|
||||||
TransparencyLevelHint="AcrylicBlur"
|
TransparencyLevelHint="AcrylicBlur"
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
Title="Enter Master Password"
|
Title="Cryptura"
|
||||||
|
CanResize="False"
|
||||||
Width="430"
|
Width="430"
|
||||||
Height="170">
|
Height="170">
|
||||||
<Panel>
|
<Panel>
|
||||||
|
@ -19,9 +20,13 @@
|
||||||
MaterialOpacity="0.65"/>
|
MaterialOpacity="0.65"/>
|
||||||
</ExperimentalAcrylicBorder.Material>
|
</ExperimentalAcrylicBorder.Material>
|
||||||
</ExperimentalAcrylicBorder>
|
</ExperimentalAcrylicBorder>
|
||||||
<Grid RowDefinitions="*,*,*,*">
|
<Border Background="#80000000" CornerRadius="10" Margin="10" Name="ContentBorder">
|
||||||
<TextBox Grid.Row="1" Name="MasterPasswordBox" HorizontalAlignment="Center" VerticalAlignment="Center" Width="300" PasswordChar="*"/>
|
<StackPanel Spacing="10" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="20">
|
||||||
<Button Grid.Row="2" Name="MasterPasswordConfirm" Content="Confirm" Click="MasterPasswordConfirm_OnClick" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
|
||||||
</Grid>
|
<TextBlock Text="Enter Master password" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
<TextBox Name="MasterPasswordBox" HorizontalAlignment="Center" VerticalAlignment="Center" Width="300" PasswordChar="*" KeyDown="MasterPasswordBox_OnKeyDown"/>
|
||||||
|
<Button Name="MasterPasswordConfirm" Content="Confirm" Click="MasterPasswordConfirm_OnClick" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
</Panel>
|
</Panel>
|
||||||
</Window>
|
</Window>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Input;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
using Avalonia.Markup.Xaml;
|
using Avalonia.Markup.Xaml;
|
||||||
using Avalonia.Media;
|
using Avalonia.Media;
|
||||||
|
@ -14,7 +15,8 @@ public partial class PasswordWindow : Window
|
||||||
if (Core.IsRunningOnGnome())
|
if (Core.IsRunningOnGnome())
|
||||||
{
|
{
|
||||||
this.TransparencyLevelHint = new[] { WindowTransparencyLevel.None };
|
this.TransparencyLevelHint = new[] { WindowTransparencyLevel.None };
|
||||||
this.Background = new SolidColorBrush(Color.Parse("#201c29"));
|
this.Background = new SolidColorBrush(Color.Parse(ColorScheme.Surface.Color_1));
|
||||||
|
this.ContentBorder.Background = new SolidColorBrush(Color.Parse(ColorScheme.Surface.Color_2));
|
||||||
AcrylicBorderObject.IsVisible = false;
|
AcrylicBorderObject.IsVisible = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -35,9 +37,21 @@ public partial class PasswordWindow : Window
|
||||||
Console.WriteLine(e.ClientSize);
|
Console.WriteLine(e.ClientSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MasterPasswordConfirm_OnClick(object? sender, RoutedEventArgs e)
|
private void ConfirmPassword()
|
||||||
{
|
{
|
||||||
new MainWindow(MasterPasswordBox.Text ?? "").Show();
|
new MainWindow(MasterPasswordBox.Text ?? "").Show();
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
|
private void MasterPasswordConfirm_OnClick(object? sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
ConfirmPassword();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MasterPasswordBox_OnKeyDown(object? sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Key == Key.Enter)
|
||||||
|
{
|
||||||
|
ConfirmPassword();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue