Skip to content

Commit 2a428c4

Browse files
committed
feat: Support Linux and Mac, some fixes and typos
1 parent b8ac6f4 commit 2a428c4

File tree

3 files changed

+35
-12
lines changed

3 files changed

+35
-12
lines changed

Quickshare/Program.cs

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,42 @@
55
using uplink.NET.Interfaces;
66
using uplink.NET.Models;
77
using uplink.NET.Services;
8+
using static System.Environment;
89

910
var assembly = Assembly.GetExecutingAssembly();
1011
var assemblyVersion = assembly.GetName().Version;
1112
Console.ForegroundColor = ConsoleColor.Blue;
12-
Console.WriteLine($"\nWelcome to Quickshare v{assemblyVersion.Major}.{assemblyVersion.Minor}.{assemblyVersion.Build} powered by Storj DCS (https://storj.io)!\n");
13+
Console.WriteLine($"\nWelcome to Quickshare v{assemblyVersion.Major}.{assemblyVersion.Minor}.{assemblyVersion.Build} powered by Storj DCS (https://storj.io)!");
14+
Console.WriteLine($"It is using uplink-c {uplink.NET.Models.Access.GetStorjVersion()} and Go {uplink.NET.Models.Access.GetGoVersion()}\n");
1315
Console.ForegroundColor = ConsoleColor.Gray;
1416

15-
string configLocation = Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + @"\quickshare.config";
16-
if (!File.Exists(configLocation))
17+
string appData = Path.Combine(Environment.GetFolderPath(SpecialFolder.LocalApplicationData, SpecialFolderOption.DoNotVerify), "quickshare");
18+
if (!Directory.Exists(appData))
1719
{
20+
Directory.CreateDirectory(appData);
21+
}
22+
23+
string configLocation = Path.Combine(appData, @"\quickshare.config");
24+
25+
//Check if the user wants to set new config-values
26+
bool requestsConfigUpdate = false;
27+
Parser.Default.ParseArguments<CommandLineConfigOptions>(args)
28+
.WithParsed(o =>
29+
{
30+
requestsConfigUpdate = true;
31+
});
32+
33+
if (!File.Exists(configLocation) || requestsConfigUpdate)
34+
{
35+
//There is no config or the user explicitly wants to set new values
1836
Parser.Default.ParseArguments<CommandLineConfigOptions>(args)
1937
.WithParsed(o =>
2038
{
2139
var quickshareConfig = new QuickshareConfig { AccessGrant = o.AccessGrant, BucketName = o.BucketName };
2240
var configJson = JsonConvert.SerializeObject(quickshareConfig);
2341
File.WriteAllText(configLocation, configJson);
2442

25-
Console.WriteLine("Your configuration has been set! You may now use 'quickshare FILENAME' to share a file.");
43+
Console.WriteLine("Your configuration has been set! You may now use 'quickshare -f FILENAME' to share a file. Add something like '-d \"1 week\" to restrict the availability of your file and delete it automatically.");
2644
})
2745
.WithNotParsed(o =>
2846
{
@@ -45,7 +63,7 @@
4563
if (!string.IsNullOrEmpty(s.Duration))
4664
{
4765
var parsed = TimeSpanParserUtil.TimeSpanParser.TryParse(s.Duration, out shareDuration);
48-
if(!parsed)
66+
if (!parsed)
4967
{
5068
Console.ForegroundColor = ConsoleColor.Red;
5169
Console.WriteLine("Could not parse the share-duration. Please try a different expression.");
@@ -63,7 +81,7 @@
6381
Console.WriteLine("Starting upload...");
6482
IObjectService objectService = new ObjectService(access);
6583
var uploadOptions = new UploadOptions();
66-
if(shareDuration != TimeSpan.MinValue)
84+
if (shareDuration != TimeSpan.MinValue)
6785
{
6886
uploadOptions.Expires = DateTime.Now + shareDuration;
6987
}
@@ -98,7 +116,7 @@
98116
Console.WriteLine(url);
99117
TextCopy.ClipboardService.SetText(url);
100118
Console.WriteLine("It has been copied to the clipboard.");
101-
if(shareDuration != TimeSpan.MinValue)
119+
if (shareDuration != TimeSpan.MinValue)
102120
{
103121
Console.ForegroundColor = ConsoleColor.Magenta;
104122
Console.WriteLine("Your shared file will expire on {0}. The file will be automatically deleted afterwards.", uploadOptions.Expires.ToString());

Quickshare/Quickshare.csproj

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
<Title>Quickshare</Title>
1313
<Authors>TopperDEL</Authors>
1414
<Company>TopperDEL</Company>
15-
<Version>0.4.3</Version>
16-
<PackageReleaseNotes>Still in alpha, but should be ready for production.
17-
- Fix for files larger then 2GB</PackageReleaseNotes>
15+
<Version>1.0.0</Version>
16+
<PackageReleaseNotes>Release v1.0.0!
17+
Supports Windows, Linux and MacOS</PackageReleaseNotes>
1818
<Description>This package lets you share files quickly by leveraging Storj DCS.</Description>
1919
<Copyright>2022 TopperDEL</Copyright>
2020
<PackageProjectUrl>https://github.com/TopperDEL/Quickshare</PackageProjectUrl>
@@ -37,11 +37,16 @@
3737
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
3838
<PackageReference Include="TextCopy" Version="6.1.0" />
3939
<PackageReference Include="TimeSpanParserUtil" Version="1.2.0" />
40-
<PackageReference Include="uplink.NET" Version="2.9.2782" />
41-
<PackageReference Include="uplink.NET.Win" Version="2.9.2782" />
40+
<PackageReference Include="uplink.NET" Version="2.9.2858" />
41+
<PackageReference Include="uplink.NET.Linux" Version="2.9.2896" />
42+
<PackageReference Include="uplink.NET.Mac" Version="2.9.2896" />
43+
<PackageReference Include="uplink.NET.Win" Version="2.9.2858" />
4244
</ItemGroup>
4345

4446
<ItemGroup>
47+
<None Update="libstorj_uplink.dylib">
48+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
49+
</None>
4550
<None Update="StoreLogo.png">
4651
<Pack>True</Pack>
4752
<PackagePath>\</PackagePath>

Quickshare/libstorj_uplink.dylib

23.4 MB
Binary file not shown.

0 commit comments

Comments
 (0)