Skip to content

Commit

Permalink
Andromeda-compatible Beeskie replica
Browse files Browse the repository at this point in the history
  • Loading branch information
mediaexplorer74 committed Nov 22, 2024
1 parent 39f7095 commit b4f05ed
Show file tree
Hide file tree
Showing 75 changed files with 2,638 additions and 271 deletions.
63 changes: 63 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto

###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp

###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary

###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary

###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
File renamed without changes.
Binary file added Images/shot01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/shot02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
78 changes: 63 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
<p align="center">
<img width="128" align="center" src="images/logo.png">
</p>
<h1 align="center">
Beeskie
</h1>
<p align="center">
A Windows app for Bluesky
</p>
<p align="center">
<a href="https://apps.microsoft.com/store/detail/9PCGNR7QHQGP?cid=github" target="_blank">
<img src="images/storeBadge.png" width="200" alt="Store link" />
</a>
</p>
# Beeskie v0.6.x (Beta) - master branch
![](Images/logo.png)

My RnD of Beeskie, modern uwp app for BlueSky social network. The main gool is to do src code Andromeda-compatible (see https://github.com/mediaexplorer74/Andromeda for details / my samples/dev kit)!

## About (words of the author)
"
## Introduction

Beeskie is a free and open source third-party app for Bluesky. Big kudos to the team that built the Bluesky APIs, which Beeskie relies on heavily. The APIs are extremely thorough and they're very friendly to third-party apps.
Expand All @@ -23,4 +15,60 @@ The app is currently in public beta. You can write new posts, reply, repost, and

## How can I help?

Download the app from the store by clicking the badge above, follow [Beeskie on Bluesky](https://bsky.app/profile/beeskieapp.bsky.social), and send feedback to that handle! While I know there are many things missing still, it will be valuable if you tell me 3 things that you absolutely need ASAP in order to use the app on a more consistent basis. This will help me prioritize the features. Of course, you can let me know of other issues such as bugs. Lastly, you can also create an issue in this repo to submit any feedback. Thanks for your help!
Download the app from the store by clicking the badge above, follow [Beeskie on Bluesky](https://bsky.app/profile/beeskieapp.bsky.social), and send feedback to that handle! While I know there are many things missing still, it will be valuable if you tell me 3 things that you absolutely need ASAP in order to use the app on a more consistent basis. This will help me prioritize the features. Of course, you can let me know of other issues such as bugs. Lastly, you can also create an issue in this repo to submit any feedback. Thanks for your help!

Beeskie (Beta) on Microsoft Store: https://apps.microsoft.com/store/detail/9PCGNR7QHQGP?cid=github
"
- Daniel from Jenius Apps

## Screenshots
![](Images/shot01.png)
![](Images/shot02.png)


## Tech/dev details
- Platforms: UWP only
- Targets: x64; x64; ARM
- OSes: Windows 11 (however, W10M Andromeda is good mobile case too)))
- Win. SDK used: 19041
- Min. Win. OS build: 17134 (Hello, Microsoft WCOS!)

## Status / my 2 cents
- Micro-research of scr code
- win sdk 22000 -> 17xxx
- Draft. Prototype / Pre-Pre-Pre-Alpha version. Still exploring modern-ui & mvvm "magic"...
- some common tools experiments / patches

## Caution
- I noticed that src code uses some "dev telemetry". It's question of your "login-password" security, I think. I have no time to fix cut off that deal.
- Please use special "app password" for your own app tests.

### Bluesky App Passwords

App passwords are codes that Bluesky generates for you which you can use for third-party apps, such as Beeskie. It is **not** that same as your Bluesky account password.

### How to start with BlueSky social network and how to generate an App Password

- Register your account on the official website https://bsky.app.
- Login to the official website https://bsky.app.
- Open settings from the left sidebar menu.
- Click "Privacy and security".
- Click "App passwords".
- Click "Add App Password". Bluesky will generate a new code and display it on screen.
- Start Beeskie app. Copy that code and paste it into Beeskie in the app password field.
- Field "handle" means word construction like "youraccountname.bsky.social". However, your email can substitute this handle.

## References
- https://github.com/jenius-apps/beeskie/ Original Beeskie project
- https://github.com/jenius-apps/ Jenius Apps, Beeskie's creators/dev team

## Licensing
MIT License

## ..
AS IS. No support. RnD only / DIY

## .
[m][e] November 2024


1 change: 1 addition & 0 deletions Src/Clean-Bin-Obj-Folders.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
for /d /r . %%d in (bin,obj) do @if exist "%%d" rd /s /q "%%d"
122 changes: 122 additions & 0 deletions Src/JeniusApps.Common.Uwp/Authentication/WindowsMsalClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
using JeniusApps.Common.Telemetry;
using Microsoft.Identity.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;

#nullable enable

namespace JeniusApps.Common.Authentication.Uwp;

public class WindowsMsalClient : IMsalClient
{
// Ref: https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-client-application-configuration#effective-audience
public const string ConsumerAuthority = "https://login.microsoftonline.com/consumers";
public const string CommonAuthority = "https://login.microsoftonline.com/common";

private readonly ITelemetry _telemetry;
private readonly string _clientId;
private readonly IPublicClientApplication _msalSdkClient;

public event EventHandler<string?>? InteractiveSignInCompleted;

public WindowsMsalClient(ITelemetry telemetry, string clientId, string authorityUrl)
{
_telemetry = telemetry;
_clientId = clientId;

_msalSdkClient = PublicClientApplicationBuilder
.Create(_clientId)
.WithAuthority(authorityUrl)
.WithBroker() // See note below.
.Build();

// ****** WithBroker notes ******
//
// If using WithBroker(), no need for WithRedirectUri().
// Instead, withBroker works only when we include special redirect URIs in Azure Portal:
// ms-appx-web://microsoft.aad.brokerplugin/<package SID here>
//
// To find your SID, go to partner center > Product Identity.
}

/// <inheritdoc/>
public async Task<string?> GetTokenSilentAsync(string[] scopes)
{
try
{
var accounts = await _msalSdkClient.GetAccountsAsync();
var firstAccount = accounts.FirstOrDefault();
var authResult = await _msalSdkClient
.AcquireTokenSilent(scopes, firstAccount)
.ExecuteAsync();
return authResult.AccessToken;
}
catch (MsalUiRequiredException)
{
// this is fine
}
catch (MsalException e) when (e.ErrorCode == "user_null")
{
// this is fine
}
catch (MsalException e)
{
_telemetry.TrackError(e, new Dictionary<string, string>
{
{ "trace", e.StackTrace },
{ "scopes", string.Join(",", scopes) }
});
}
catch (HttpRequestException)
{
// no internet
}

return "";
}

/// <inheritdoc/>
public async Task RequestInteractiveSignIn(string[] scopes, string[]? extraScopes = null)
{
try
{
var builder = _msalSdkClient.AcquireTokenInteractive(scopes);

if (extraScopes is not null)
{
builder = builder.WithExtraScopesToConsent(extraScopes);
}

var authResult = await builder.ExecuteAsync();
InteractiveSignInCompleted?.Invoke(this, authResult?.AccessToken);
}
catch (MsalException e) when (e.ErrorCode == "authentication_canceled")
{
InteractiveSignInCompleted?.Invoke(this, string.Empty);
}
catch (MsalException e)
{
InteractiveSignInCompleted?.Invoke(this, string.Empty);

_telemetry.TrackError(e, new Dictionary<string, string>
{
{ "trace", e.StackTrace },
{ "scopes", string.Join(",", scopes) },
{ "extraScopes", string.Join(",", extraScopes ?? Array.Empty<string>()) }
});
}
}

/// <inheritdoc/>
public async Task SignOutAsync()
{
var accounts = await _msalSdkClient.GetAccountsAsync();
foreach (var a in accounts)
{
await _msalSdkClient.RemoveAsync(a);
}
}
}
Loading

0 comments on commit b4f05ed

Please sign in to comment.