1.0 Release
All checks were successful
Java CI / test (push) Successful in 1m16s

This commit is contained in:
WeeXnes 2025-05-06 18:31:54 +02:00
parent 305dcbd794
commit 024570f0ed
7 changed files with 235 additions and 34 deletions

View 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 }}"

View file

@ -6,6 +6,8 @@
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<ApplicationManifest>app.manifest</ApplicationManifest>
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
<AssemblyVersion>1.0</AssemblyVersion>
<FileVersion>1.0</FileVersion>
</PropertyGroup>
<ItemGroup>

View file

@ -19,3 +19,26 @@ public class Globals
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";
}
}

View file

@ -23,12 +23,18 @@
</ExperimentalAcrylicBorder.Material>
</ExperimentalAcrylicBorder>
<Grid RowDefinitions="4*, 50">
<Border Grid.Row="0" Background="#35313d" CornerRadius="10" Margin="10">
<Grid>
<Border Grid.Row="0" Background="#80000000" CornerRadius="10" Margin="10" Name="ContentBorder">
<ListBox Name="PasswordList" Background="Transparent" SelectionChanged="PasswordList_OnSelectionChanged">
<ListBox.ItemTemplate>
<DataTemplate x:DataType="local:Password">
<Border Background="Transparent" Padding="10">
<Border.ContextMenu>
<ContextMenu>
<MenuItem Header="Add New Password" Click="CreatePassword_OnClick"/>
<MenuItem Header="Remove Password" Click="DeletePassword_OnClick"/>
</ContextMenu>
</Border.ContextMenu>
<Grid ColumnDefinitions="*, *">
<TextBlock Grid.Column="0" Foreground="White" Text="{Binding Name}" VerticalAlignment="Center"/>
<TextBlock Grid.Column="1" Foreground="White" Text="{Binding DisplayValue}" VerticalAlignment="Center"/>
@ -36,6 +42,12 @@
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
<ListBox.ContextMenu>
<ContextMenu>
<MenuItem Header="Add New Password" Click="CreatePassword_OnClick"/>
<MenuItem Header="Remove Password" Click="DeletePassword_OnClick"/>
</ContextMenu>
</ListBox.ContextMenu>
<ListBox.Styles>
<Style Selector="ListBoxItem:selected /template/ ContentPresenter">
<Setter Property="Background" Value="#35313d"/>
@ -48,8 +60,21 @@
</ListBox>
</Border>
<Border Grid.Row="1" Background="#35313d" CornerRadius="10" Margin="10,0,10,10">
<Button Click="Button_OnClick"></Button>
<Border Background="#80000000" Name="AddPasswordContainer" IsVisible="False">
<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>
</Grid>
</Panel>

View file

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.IO;
using Avalonia.Controls;
using Avalonia.Data;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Media;
@ -17,7 +18,8 @@ public partial class MainWindow : Window
if (Core.IsRunningOnGnome())
{
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;
}
else
@ -32,7 +34,6 @@ public partial class MainWindow : Window
InitializeComponent();
MasterPassword = masterPassword;
AdjustThemeToPlatform();
Password pw = new Password("Example", "Password");
FetchPasswords();
}
@ -74,4 +75,54 @@ public partial class MainWindow : Window
{
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();
}
}
}

View file

@ -6,7 +6,8 @@
x:Class="Cryptura.PasswordWindow"
TransparencyLevelHint="AcrylicBlur"
Background="Transparent"
Title="Enter Master Password"
Title="Cryptura"
CanResize="False"
Width="430"
Height="170">
<Panel>
@ -19,9 +20,13 @@
MaterialOpacity="0.65"/>
</ExperimentalAcrylicBorder.Material>
</ExperimentalAcrylicBorder>
<Grid RowDefinitions="*,*,*,*">
<TextBox Grid.Row="1" Name="MasterPasswordBox" HorizontalAlignment="Center" VerticalAlignment="Center" Width="300" PasswordChar="*"/>
<Button Grid.Row="2" Name="MasterPasswordConfirm" Content="Confirm" Click="MasterPasswordConfirm_OnClick" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
<Border Background="#80000000" CornerRadius="10" Margin="10" Name="ContentBorder">
<StackPanel Spacing="10" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="20">
<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>
</Window>

View file

@ -1,6 +1,7 @@
using System;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using Avalonia.Media;
@ -14,7 +15,8 @@ public partial class PasswordWindow : Window
if (Core.IsRunningOnGnome())
{
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;
}
else
@ -35,9 +37,21 @@ public partial class PasswordWindow : Window
Console.WriteLine(e.ClientSize);
}
private void MasterPasswordConfirm_OnClick(object? sender, RoutedEventArgs e)
private void ConfirmPassword()
{
new MainWindow(MasterPasswordBox.Text ?? "").Show();
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();
}
}
}