Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -356,3 +356,6 @@ healthchecksdb

# Jetbrains Rider run folder
.run/

# Visual Studio Code
.vscode/
29 changes: 29 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
## Branch & PR Guidelines

### Overview
This repository uses a branch-based development workflow. Please follow the conventions below when working in this project, especially when creating branches, writing PR titles, and generating commits or documentation.

### Branch Naming
Use the following prefixes:
- `feature/<name>` for new features
- `fix/<name>` for bug fixes
- `refactor/<name>` for refactorings
- `docs/<name>` for refactorings
- `test/<name>` for tests

Avoid slashes other than the prefix.

### PR Titles
Format:
`[<type>] <Short summary>`

Allowed types: `feature`, `fix`, `refactor`, `docs`, `test`

Examples:
- `[feature] Add user registration`
- `[bugfix] Fix memory leak in sync module`

### Notes for Agents
- Never propose changes directly on `master`.
- Always create a branch using the proper prefix.
- PR titles must follow the documented format.
10 changes: 5 additions & 5 deletions docs/client-deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ These projects are written in **C#** and target a specific version of **.NET**.
{
"LocalDebugUrl": "",
"DevelopmentUrl": "",
"StagingUrl": "",
"ProductionUrl": "",
"UpdatesDefinitionUrl": ""
}
```
"StagingUrl": "",
"ProductionUrl": "",
"UpdatesDefinitionUrl": ""
}
```

Fill in any relevant URLs or other settings your environment requires.

Expand Down
7 changes: 5 additions & 2 deletions docs/server-deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ Below is the JSON structure indicating which properties must be set. In particul
"DatabaseName": ""
},
"AppSettings": {
"Secret": "YOUR_UNIQUE_RANDOM_SEED"
"Secret": "YOUR_UNIQUE_RANDOM_SEED",
"AnnouncementsUrl": ""
}
}
```
Expand All @@ -97,7 +98,8 @@ Below is the JSON structure indicating which properties must be set. In particul
"SignalR:ConnectionString": "<your-signalr-connection-string>",
"CosmosDb:ConnectionString": "<your-cosmosdb-connection-string>",
"CosmosDb:DatabaseName": "<your-database-name>",
"AppSettings:Secret": "YOUR_UNIQUE_RANDOM_SEED"
"AppSettings:Secret": "YOUR_UNIQUE_RANDOM_SEED",
"AppSettings:AnnouncementsUrl": ""
}
}
```
Expand Down Expand Up @@ -136,6 +138,7 @@ cd ByteSync.Functions

# App Settings
dotnet user-secrets set "AppSettings:Secret" "YOUR_UNIQUE_RANDOM_SEED"
dotnet user-secrets set "AppSettings:AnnouncementsUrl" ""
```

Repeat these steps for **ByteSync.Functions.IntegrationTests** and **ByteSync.ServerCommon.Tests**, navigating to each project's directory and setting the same secrets.
Expand Down
13 changes: 13 additions & 0 deletions docs/synchronization-rules.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Synchronization rules

ByteSync supports creating synchronization rules to automatically trigger actions when comparison conditions are met. Rules can compare file or directory attributes using different elements and operators.

## Comparison properties

- **Content**
- **Date**
- **Size**
- **Presence**
- **Name** (supports `Equals` and `NotEquals` operators, wildcard `*` is allowed)

Use `Name` to match items based on their file name. When a pattern contains `*`, the rule interprets it as a wildcard.
23 changes: 22 additions & 1 deletion src/ByteSync.Client/Assets/Resources/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 12 additions & 3 deletions src/ByteSync.Client/Assets/Resources/Resources.fr.resx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,10 @@
<value>Dernière écriture</value>
</data>
<data name="AtomicConditionEdit_Size" xml:space="preserve">
<value>Taille</value>
<value>Taille</value>
</data>
<data name="AtomicConditionEdit_Name" xml:space="preserve">
<value>Nom</value>
</data>
<data name="AtomicConditionEdit_Equals" xml:space="preserve">
<value>Égal à</value>
Expand Down Expand Up @@ -160,7 +163,7 @@
<value>Inférieure à</value>
</data>
<data name="AtomicConditionEdit_Source" xml:space="preserve">
<value>Source</value>
<value>Source ou Propriété</value>
</data>
<data name="AtomicConditionEdit_ComparisonElement" xml:space="preserve">
<value>Élément</value>
Expand All @@ -171,6 +174,9 @@
<data name="AtomicConditionEdit_Destination" xml:space="preserve">
<value>Destination</value>
</data>
<data name="AtomicConditionEdit_NamePlaceholder" xml:space="preserve">
<value>Nom</value>
</data>
<data name="AtomicConditionEdit_DateTime" xml:space="preserve">
<value>Date et heure</value>
</data>
Expand Down Expand Up @@ -343,7 +349,10 @@ Voulez-vous continuer ?</value>
<value>Date</value>
</data>
<data name="AtomicConditionDescription_ComparisonElement_Size" xml:space="preserve">
<value>Taille</value>
<value>Taille</value>
</data>
<data name="AtomicConditionDescription_ComparisonElement_Name" xml:space="preserve">
<value>Nom</value>
</data>
<data name="AtomicConditionDescription_ConditionOperator_Equals" xml:space="preserve">
<value>Est égal à</value>
Expand Down
11 changes: 10 additions & 1 deletion src/ByteSync.Client/Assets/Resources/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,9 @@
<data name="AtomicConditionEdit_Size" xml:space="preserve">
<value>Size</value>
</data>
<data name="AtomicConditionEdit_Name" xml:space="preserve">
<value>Name</value>
</data>
<data name="AtomicConditionEdit_Equals" xml:space="preserve">
<value>Equals</value>
</data>
Expand Down Expand Up @@ -265,7 +268,7 @@
<value>Less than</value>
</data>
<data name="AtomicConditionEdit_Source" xml:space="preserve">
<value>Source</value>
<value>Source or Property</value>
</data>
<data name="AtomicConditionEdit_ComparisonElement" xml:space="preserve">
<value>Element</value>
Expand All @@ -276,6 +279,9 @@
<data name="AtomicConditionEdit_Destination" xml:space="preserve">
<value>Destination</value>
</data>
<data name="AtomicConditionEdit_NamePlaceholder" xml:space="preserve">
<value>Name</value>
</data>
<data name="AtomicConditionEdit_DateTime" xml:space="preserve">
<value>Date and Time</value>
</data>
Expand Down Expand Up @@ -453,6 +459,9 @@ Would you like to continue ?</value>
<data name="AtomicConditionDescription_ComparisonElement_Size" xml:space="preserve">
<value>Size</value>
</data>
<data name="AtomicConditionDescription_ComparisonElement_Name" xml:space="preserve">
<value>Name</value>
</data>
<data name="AtomicConditionDescription_ConditionOperator_Equals" xml:space="preserve">
<value>Equals</value>
</data>
Expand Down
18 changes: 10 additions & 8 deletions src/ByteSync.Client/Business/Actions/Local/AtomicCondition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,22 @@ public AtomicCondition()

}

public AtomicCondition(DataPart source, ComparisonElement comparisonElement, ConditionOperatorTypes conditionOperator, DataPart? destination)
public AtomicCondition(DataPart source, ComparisonProperty comparisonProperty, ConditionOperatorTypes conditionOperator, DataPart? destination)
{
Source = source;
ComparisonElement = comparisonElement;
ComparisonProperty = comparisonProperty;
ConditionOperator = conditionOperator;
Destination = destination;
}

public DataPart Source { get; set; } = null!;
public ComparisonElement ComparisonElement { get; set; }

public ComparisonProperty ComparisonProperty { get; set; }

public ConditionOperatorTypes ConditionOperator { get; set; }

/// <summary>
/// Peut être nulle quand on travaille sur la Size ou la DateTime
/// </summary>

public DataPart? Destination { get; set; }


public string? SourceName
{
get
Expand All @@ -46,6 +44,10 @@ public string? DestinationName
}

public int? Size { get; set; }

public SizeUnits? SizeUnit { get; set; }

public DateTime? DateTime { get; set; }

public string? NamePattern { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ public class LooseAtomicCondition : IAtomicCondition

public int? Size { get; set; }

public ComparisonElement ComparisonElement { get; set; }
public ComparisonProperty ComparisonProperty { get; set; }

public ConditionOperatorTypes ConditionOperator { get; set; }

public DateTime? DateTime { get; set; }

public SizeUnits? SizeUnit { get; set; }

public string? NamePattern { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
namespace ByteSync.Business.Comparisons;

public enum ComparisonElement
public enum ComparisonProperty
{
Content = 1,
Date = 2,
Size = 3,
Presence = 4,
Name = 5,
}
49 changes: 49 additions & 0 deletions src/ByteSync.Client/Business/Configurations/ApplicationSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public ApplicationSettings()
AgreesBetaWarning0 = false;
TrustedPublicKeys = null;
SettingsVersion = null;
AcknowledgedAnnouncementIds = null;
}

public string InstallationId { get; set; } = null!;
Expand Down Expand Up @@ -186,12 +187,39 @@ public ReadOnlyCollection<TrustedPublicKey>? DecodedTrustedPublicKeys
}

public string? SettingsVersion { get; set; }

public string? AcknowledgedAnnouncementIds { get; set; }

private string EncryptionPassword { get; set; } = null!;

[XmlIgnore]
public RSA PrivateRsa { get; private set; } = null!;

[XmlIgnore]
public List<string> DecodedAcknowledgedAnnouncementIds
{
get
{
if (AcknowledgedAnnouncementIds.IsNullOrEmpty())
{
return new List<string>();
}

return AcknowledgedAnnouncementIds!.Split(';', StringSplitOptions.RemoveEmptyEntries).ToList();
}
set
{
if (value == null || value.Count == 0)
{
AcknowledgedAnnouncementIds = null;
}
else
{
AcknowledgedAnnouncementIds = string.Join(";", value);
}
}
}

public object Clone()
{
return this.MemberwiseClone();
Expand Down Expand Up @@ -238,6 +266,27 @@ public void RemoveTrustedKey(TrustedPublicKey trustedPublicKey)
TrustedPublicKeys = CryptographyUtils.Encrypt(json, EncryptionPassword);
}

public void InitializeAcknowledgedAnnouncementIds()
{
AcknowledgedAnnouncementIds = null;
}

public void AddAcknowledgedAnnouncementId(string announcementId)
{
var acknowledgedIds = DecodedAcknowledgedAnnouncementIds;

if (!acknowledgedIds.Contains(announcementId))
{
acknowledgedIds.Add(announcementId);
DecodedAcknowledgedAnnouncementIds = acknowledgedIds;
}
}

public bool IsAnnouncementAcknowledged(string announcementId)
{
return DecodedAcknowledgedAnnouncementIds.Contains(announcementId);
}

public void InitializeRsa()
{
var rsa = RSA.Create();
Expand Down
4 changes: 4 additions & 0 deletions src/ByteSync.Client/ByteSync.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -227,5 +227,9 @@
<DependentUpon>SessionSettingsEditView.axaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Update="Views\Announcements\AnnouncementView.axaml.cs">
<DependentUpon>AnnouncementView.axaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using ByteSync.Business.Navigations;
using ByteSync.Interfaces.Dialogs;
using ByteSync.ViewModels;
using ByteSync.ViewModels.Announcements;
using ByteSync.ViewModels.Headers;
using ByteSync.ViewModels.Home;
using ByteSync.ViewModels.Lobbies;
Expand All @@ -28,6 +29,7 @@ protected override void Load(ContainerBuilder builder)
.AsImplementedInterfaces();

builder.RegisterType<HeaderViewModel>().SingleInstance().AsSelf();
builder.RegisterType<AnnouncementViewModel>().SingleInstance().AsSelf();

builder.RegisterType<HomeMainViewModel>().Keyed<IRoutableViewModel>(NavigationPanel.Home);
builder.RegisterType<SessionMainViewModel>().Keyed<IRoutableViewModel>(NavigationPanel.CloudSynchronization);
Expand Down
Loading