Compare commits

...

10 Commits
0.6.4 ... main

Author SHA1 Message Date
e38023d790 release: version 0.6.9 🚀
Some checks failed
SonarQube Scan / SonarQube Trigger (push) Has been cancelled
CI / tests_linux (9.0.X, ubuntu-latest) (push) Has been cancelled
CI / linter (9.0.X, ubuntu-latest) (push) Has been cancelled
Build Docker image / Create Release (push) Successful in 44s
Build Docker image / deploy (push) Successful in 1m59s
2025-07-20 17:45:00 +02:00
939ae74e95 fix: improved Spotify auth check flow, refs NOISSUE 2025-07-20 17:44:52 +02:00
95406be062 release: version 0.6.8 🚀
Some checks failed
Build Docker image / Create Release (push) Successful in 22s
CI / linter (9.0.X, ubuntu-latest) (push) Failing after 1m17s
CI / tests_linux (9.0.X, ubuntu-latest) (push) Has been skipped
Build Docker image / deploy (push) Successful in 1m59s
SonarQube Scan / SonarQube Trigger (push) Failing after 4m54s
2025-07-20 17:32:20 +02:00
918ed2e667 fix: improved Spotify auth check flow, refs NOISSUE 2025-07-20 17:32:18 +02:00
e0b0d6b98c release: version 0.6.7 🚀
Some checks failed
Build Docker image / Create Release (push) Successful in 20s
CI / linter (9.0.X, ubuntu-latest) (push) Failing after 1m23s
CI / tests_linux (9.0.X, ubuntu-latest) (push) Has been skipped
Build Docker image / deploy (push) Successful in 2m29s
SonarQube Scan / SonarQube Trigger (push) Failing after 4m53s
2025-07-20 17:24:16 +02:00
74a8c7dbe8 fix: attempted bugfix for crashing process on invalid spotify access token, refs NOISSUE 2025-07-20 17:24:14 +02:00
da2a32ecfc release: version 0.6.6 🚀
Some checks failed
Build Docker image / Create Release (push) Successful in 16s
CI / tests_linux (9.0.X, ubuntu-latest) (push) Has been cancelled
CI / linter (9.0.X, ubuntu-latest) (push) Has been cancelled
SonarQube Scan / SonarQube Trigger (push) Has been cancelled
Build Docker image / deploy (push) Successful in 1m33s
2025-07-20 17:14:53 +02:00
ef8c8fb867 fix: add additional logging, refs NOISSUE 2025-07-20 17:14:49 +02:00
567f192c46 release: version 0.6.5 🚀
Some checks failed
CI / tests_linux (9.0.X, ubuntu-latest) (push) Has been cancelled
CI / linter (9.0.X, ubuntu-latest) (push) Has been cancelled
SonarQube Scan / SonarQube Trigger (push) Has been cancelled
Build Docker image / Create Release (push) Successful in 15s
Build Docker image / deploy (push) Successful in 1m29s
2025-07-20 17:05:12 +02:00
ff5c4588c9 fix: configurable Cron schedules, refs NOISSUE 2025-07-20 17:05:09 +02:00
5 changed files with 117 additions and 19 deletions

View File

@ -5,10 +5,66 @@ Changelog
(unreleased) (unreleased)
------------ ------------
Fix
~~~
- Improved Spotify auth check flow, refs NOISSUE. [Simon Diesenreiter]
0.6.8 (2025-07-20)
------------------
Fix
~~~
- Improved Spotify auth check flow, refs NOISSUE. [Simon Diesenreiter]
Other
~~~~~
0.6.7 (2025-07-20)
------------------
Fix
~~~
- Attempted bugfix for crashing process on invalid spotify access token,
refs NOISSUE. [Simon Diesenreiter]
Other
~~~~~
0.6.6 (2025-07-20)
------------------
Fix
~~~
- Add additional logging, refs NOISSUE. [Simon Diesenreiter]
Other
~~~~~
0.6.5 (2025-07-20)
------------------
Fix
~~~
- Configurable Cron schedules, refs NOISSUE. [Simon Diesenreiter]
Other
~~~~~
0.6.4 (2025-07-20)
------------------
Fix Fix
~~~ ~~~
- Better data model for liked songs, refs NOISSUE. [Simon Diesenreiter] - Better data model for liked songs, refs NOISSUE. [Simon Diesenreiter]
Other
~~~~~
0.6.3 (2025-07-20) 0.6.3 (2025-07-20)
------------------ ------------------

View File

@ -33,6 +33,13 @@ public class AppConfiguration
CrewGroup = $"cn={userGroupName},ou=groups,dc=disi,dc=dev", CrewGroup = $"cn={userGroupName},ou=groups,dc=disi,dc=dev",
ManagerGroup = $"cn={managersGroupName},ou=groups,dc=disi,dc=dev" ManagerGroup = $"cn={managersGroupName},ou=groups,dc=disi,dc=dev"
}; };
this.UserCheckTimerSchedule = Environment.GetEnvironmentVariable("USER_CHECK_TIMER_SCHEDULE") ?? "*/1 * * * *";
this.LikePlaylistCheckTimerSchedule = Environment.GetEnvironmentVariable("LIKE_PLAYLIST_CHECK_TIMER_SCHEDULE") ?? "*/10 * * * *";
this.UserIntroCheckTimerSchedule = Environment.GetEnvironmentVariable("USER_INTRO_TIMER_SCHEDULE") ?? "*/1 * * * *";
this.PickOfTheDayCheckTimerSchedule = Environment.GetEnvironmentVariable("PICK_OF_THE_DAY_TIMER_SCHEDULE") ?? "0 8 * * *";
this.LdapAssociationTimerSchedule = Environment.GetEnvironmentVariable("LDAP_ASSOCIATION_TIMER_SCHEDULE") ?? "*/10 * * * *";
this.MessageSyncTimerSchedule = Environment.GetEnvironmentVariable("MESSAGE_SYNC_TIMER_SCHEDULE") ?? "*/10 * * * *";
} }
public string SignalAPIEndpointUri public string SignalAPIEndpointUri
@ -109,4 +116,34 @@ public class AppConfiguration
{ {
get; private set; get; private set;
} }
public string UserCheckTimerSchedule
{
get; private set;
}
public string LikePlaylistCheckTimerSchedule
{
get; private set;
}
public string UserIntroCheckTimerSchedule
{
get; private set;
}
public string PickOfTheDayCheckTimerSchedule
{
get; private set;
}
public string LdapAssociationTimerSchedule
{
get; private set;
}
public string MessageSyncTimerSchedule
{
get; private set;
}
} }

View File

@ -32,7 +32,7 @@ var app = builder.Build();
var logger = app.Logger; var logger = app.Logger;
logger.LogTrace("Setting up user check timer"); logger.LogTrace("Setting up user check timer");
var userCheckTimer = new CronTimer("*/1 * * * *", "Europe/Vienna", includingSeconds: false); var userCheckTimer = new CronTimer(AppConfiguration.Instance.UserCheckTimerSchedule, "Europe/Vienna", includingSeconds: false);
userCheckTimer.OnOccurence += async (s, ea) => userCheckTimer.OnOccurence += async (s, ea) =>
{ {
var signalIntegration = app.Services.GetService<SignalIntegration>(); var signalIntegration = app.Services.GetService<SignalIntegration>();
@ -72,7 +72,7 @@ userCheckTimer.OnOccurence += async (s, ea) =>
}; };
logger.LogTrace("Setting up liked songs playlist creation timer"); logger.LogTrace("Setting up liked songs playlist creation timer");
var likePlaylistCheckTimer = new CronTimer("*/30 * * * *", "Europe/Vienna", includingSeconds: false); var likePlaylistCheckTimer = new CronTimer(AppConfiguration.Instance.LikePlaylistCheckTimerSchedule, "Europe/Vienna", includingSeconds: false);
likePlaylistCheckTimer.OnOccurence += async (s, ea) => likePlaylistCheckTimer.OnOccurence += async (s, ea) =>
{ {
var spotifyApiClient = app.Services.GetService<SpotifyApiClient>(); var spotifyApiClient = app.Services.GetService<SpotifyApiClient>();
@ -86,19 +86,24 @@ likePlaylistCheckTimer.OnOccurence += async (s, ea) =>
{ {
if (!await spotifyApiClient.IsUserAuthenticatedAsync(user)) if (!await spotifyApiClient.IsUserAuthenticatedAsync(user))
{ {
continue; logger.LogWarning($"User {user.LdapUserName} is not authorized with Spotify - skipping playlist sync");
} }
var foundPlaylist = dci.SmartPlaylistDefinitions?.Where(p => p.CreatedBy == user).ToList().Where(p => p.IsThisUsersLikedSongsPlaylist).SingleOrDefault(); else
if (foundPlaylist == null)
{ {
var title = $"{user.PreferredName}'s liked Songs"; var foundPlaylist = dci.SmartPlaylistDefinitions?.Where(p => p.CreatedBy == user).ToList().Where(p => p.IsThisUsersLikedSongsPlaylist).SingleOrDefault();
var description = $"A collection of the songs liked by {user.PreferredName} on their 'Song of the day' server instance."; if (foundPlaylist == null)
// playlist does not exist yet, creating it {
var newPlaylist = await (await spotifyApiClient.WithUserAuthorizationAsync(user)).CreateSpotifyPlaylist(title, description, false, true, user); logger.LogWarning($"Creating liked songs playlist for user {user.LdapUserName}");
await playlistSynchronizer.SynchronizePlaylistAsync(newPlaylist); var title = $"{user.PreferredName}'s liked songs";
needsSaving = true; var description = $"A collection of the songs liked by {user.PreferredName} on their 'Song of the day' server instance.";
// playlist does not exist yet, creating it
var newPlaylist = await (await spotifyApiClient.WithUserAuthorizationAsync(user)).CreateSpotifyPlaylist(title, description, false, true, user);
await playlistSynchronizer.SynchronizePlaylistAsync(newPlaylist);
needsSaving = true;
}
logger.LogWarning($"Syncing playlists for user {user.LdapUserName}");
await playlistSynchronizer.SynchronizeUserPlaylistsAsync(user);
} }
await playlistSynchronizer.SynchronizeUserPlaylistsAsync(user);
} }
if (needsSaving) if (needsSaving)
@ -109,7 +114,7 @@ likePlaylistCheckTimer.OnOccurence += async (s, ea) =>
}; };
logger.LogTrace("Setting up user intro timer"); logger.LogTrace("Setting up user intro timer");
var userIntroTimer = new CronTimer("*/1 * * * *", "Europe/Vienna", includingSeconds: false); var userIntroTimer = new CronTimer(AppConfiguration.Instance.UserIntroCheckTimerSchedule, "Europe/Vienna", includingSeconds: false);
userIntroTimer.OnOccurence += async (s, ea) => userIntroTimer.OnOccurence += async (s, ea) =>
{ {
var dci = DataContext.Instance; var dci = DataContext.Instance;
@ -138,7 +143,7 @@ userIntroTimer.OnOccurence += async (s, ea) =>
logger.LogTrace("Setting up pick of the day timer"); logger.LogTrace("Setting up pick of the day timer");
var pickOfTheDayTimer = new CronTimer("0 8 * * *", "Europe/Vienna", includingSeconds: false); var pickOfTheDayTimer = new CronTimer(AppConfiguration.Instance.PickOfTheDayCheckTimerSchedule, "Europe/Vienna", includingSeconds: false);
pickOfTheDayTimer.OnOccurence += async (s, ea) => pickOfTheDayTimer.OnOccurence += async (s, ea) =>
{ {
var dci = DataContext.Instance; var dci = DataContext.Instance;
@ -209,10 +214,10 @@ var startUserAssociationProcess = async (User userToAssociate) =>
await signalIntegration.SendMessageToUserAsync($"Once you have done so, go to https://sotd.disi.dev, login, navigate to \"Unclaimed Phone Numbers\" and click on the \"Claim\" button to start the claim process.", signalId); await signalIntegration.SendMessageToUserAsync($"Once you have done so, go to https://sotd.disi.dev, login, navigate to \"Unclaimed Phone Numbers\" and click on the \"Claim\" button to start the claim process.", signalId);
await signalIntegration.SendMessageToUserAsync($"With a future update you will be required to submit songs via your user account - at that point you will be skipped during the selection process if you have not yet claimed your phone number!", signalId); await signalIntegration.SendMessageToUserAsync($"With a future update you will be required to submit songs via your user account - at that point you will be skipped during the selection process if you have not yet claimed your phone number!", signalId);
} }
}; };
logger.LogTrace("Setting up LdapAssociation timer"); logger.LogTrace("Setting up LdapAssociation timer");
var ldapAssociationTimer = new CronTimer("*/10 * * * *", "Europe/Vienna", includingSeconds: false); var ldapAssociationTimer = new CronTimer(AppConfiguration.Instance.LdapAssociationTimerSchedule, "Europe/Vienna", includingSeconds: false);
ldapAssociationTimer.OnOccurence += async (s, ea) => ldapAssociationTimer.OnOccurence += async (s, ea) =>
{ {
var dci = DataContext.Instance; var dci = DataContext.Instance;
@ -241,7 +246,7 @@ ldapAssociationTimer.OnOccurence += async (s, ea) =>
}; };
logger.LogTrace("Setting up MessageSync timer"); logger.LogTrace("Setting up MessageSync timer");
var messageSyncTimer = new CronTimer("*/10 * * * *", "Europe/Vienna", includingSeconds: false); var messageSyncTimer = new CronTimer(AppConfiguration.Instance.MessageSyncTimerSchedule, "Europe/Vienna", includingSeconds: false);
messageSyncTimer.OnOccurence += async (s, ea) => messageSyncTimer.OnOccurence += async (s, ea) =>
{ {
var signalIntegration = app.Services.GetService<SignalIntegration>(); var signalIntegration = app.Services.GetService<SignalIntegration>();

View File

@ -110,7 +110,7 @@ public class SpotifyApiClient
public async Task<string> GetValidAuthorizationTokenAsync(User user) public async Task<string> GetValidAuthorizationTokenAsync(User user)
{ {
if (string.IsNullOrEmpty(user.SpotifyAuthAccessToken)) if (string.IsNullOrEmpty(user.SpotifyAuthAccessToken) || string.IsNullOrEmpty(user.SpotifyAuthRefreshToken))
{ {
// user either never connected Spotify or we failed to refresh token - user needs to re-authenticate // user either never connected Spotify or we failed to refresh token - user needs to re-authenticate
return string.Empty; return string.Empty;

View File

@ -1 +1 @@
0.6.4 0.6.9