Compare commits

..

No commits in common. "main" and "0.6.1" have entirely different histories.
main ... 0.6.1

11 changed files with 47 additions and 593 deletions

View File

@ -5,100 +5,10 @@ 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
~~~
- Better data model for liked songs, refs NOISSUE. [Simon Diesenreiter]
Other
~~~~~
0.6.3 (2025-07-20)
------------------
Fix
~~~
- Issues with index page for unauthenticated users, refs NOISSUE. [Simon
Diesenreiter]
Other
~~~~~
0.6.2 (2025-07-20)
------------------
Fix
~~~
- Build issues, refs NOISSUE. [Simon Diesenreiter]
Other
~~~~~
0.6.1 (2025-07-20)
------------------
Fix Fix
~~~ ~~~
- Remove local debugging configs, refs NOISSUE. [Simon Diesenreiter] - Remove local debugging configs, refs NOISSUE. [Simon Diesenreiter]
Other
~~~~~
0.6.0 (2025-07-20) 0.6.0 (2025-07-20)
------------------ ------------------

View File

@ -33,13 +33,6 @@ 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
@ -116,34 +109,4 @@ 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

@ -18,17 +18,4 @@ public class DataContext : DbContext
=> optionsBuilder.UseNpgsql($"Host={AppConfiguration.Instance.DatabaseUri}:{AppConfiguration.Instance.DatabasePort};" => optionsBuilder.UseNpgsql($"Host={AppConfiguration.Instance.DatabaseUri}:{AppConfiguration.Instance.DatabasePort};"
+ $"Username={AppConfiguration.Instance.DatabaseUser};Password={AppConfiguration.Instance.DatabasePW};" + $"Username={AppConfiguration.Instance.DatabaseUser};Password={AppConfiguration.Instance.DatabasePW};"
+ $"Database={AppConfiguration.Instance.DatabaseName}"); + $"Database={AppConfiguration.Instance.DatabaseName}");
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
// configures one-to-many relationship
modelBuilder.Entity<User>()
.HasMany(u => u.LikedSongs)
.WithMany(s => s.LikedBy)
.UsingEntity(
"LikedSongs",
r => r.HasOne(typeof(Song)).WithMany().HasForeignKey("SongId").HasPrincipalKey(nameof(Song.SongId)),
l => l.HasOne(typeof(User)).WithMany().HasForeignKey("UserId").HasPrincipalKey(nameof(User.UserId)),
j => j.HasKey("SongId", "UserId"));
}
} }

View File

@ -1,296 +0,0 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace song_of_the_day.DataMigrations
{
[DbContext(typeof(DataContext))]
[Migration("20250720144512_explicitly model liked songs relationship")]
partial class explicitlymodellikedsongsrelationship
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.3")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("LikedSongs", b =>
{
b.Property<int>("SongId")
.HasColumnType("integer");
b.Property<int>("UserId")
.HasColumnType("integer");
b.HasKey("SongId", "UserId");
b.HasIndex("UserId");
b.ToTable("LikedSongs");
});
modelBuilder.Entity("SmartPlaylistDefinition", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int?>("CreatedByUserId")
.HasColumnType("integer");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<bool>("IncludesLikedSongs")
.HasColumnType("boolean");
b.Property<bool>("IncludesUnCategorizedSongs")
.HasColumnType("boolean");
b.Property<string>("SpotifyPlaylistId")
.HasColumnType("text");
b.Property<string>("Title")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("CreatedByUserId");
b.ToTable("SmartPlaylistDefinitions");
});
modelBuilder.Entity("Song", b =>
{
b.Property<int>("SongId")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("SongId"));
b.Property<string>("Artist")
.HasColumnType("text");
b.Property<string>("Name")
.HasColumnType("text");
b.Property<int?>("Provider")
.HasColumnType("integer");
b.Property<int?>("SmartPlaylistDefinitionId")
.HasColumnType("integer");
b.Property<int?>("SmartPlaylistDefinitionId1")
.HasColumnType("integer");
b.Property<string>("SpotifyId")
.HasColumnType("text");
b.Property<string>("Url")
.HasColumnType("text");
b.HasKey("SongId");
b.HasIndex("SmartPlaylistDefinitionId");
b.HasIndex("SmartPlaylistDefinitionId1");
b.ToTable("Songs");
});
modelBuilder.Entity("SongSuggestion", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<DateTime>("Date")
.HasColumnType("timestamp with time zone");
b.Property<bool>("HasUsedSuggestion")
.HasColumnType("boolean");
b.Property<int?>("SongId")
.HasColumnType("integer");
b.Property<int>("SuggestionHelperId")
.HasColumnType("integer");
b.Property<bool>("UserHasSubmitted")
.HasColumnType("boolean");
b.Property<int?>("UserId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("SongId");
b.HasIndex("SuggestionHelperId");
b.HasIndex("UserId");
b.ToTable("SongSuggestions");
});
modelBuilder.Entity("SuggestionHelper", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Description")
.HasColumnType("text");
b.Property<int?>("SmartPlaylistDefinitionId")
.HasColumnType("integer");
b.Property<string>("Title")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("SmartPlaylistDefinitionId");
b.ToTable("SuggestionHelpers");
});
modelBuilder.Entity("User", b =>
{
b.Property<int>("UserId")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("UserId"));
b.Property<bool>("AssociationInProgress")
.HasColumnType("boolean");
b.Property<bool>("IsIntroduced")
.HasColumnType("boolean");
b.Property<string>("LdapUserName")
.HasColumnType("text");
b.Property<string>("Name")
.HasColumnType("text");
b.Property<string>("NickName")
.HasColumnType("text");
b.Property<string>("SignalMemberId")
.HasColumnType("text");
b.Property<string>("SpotifyAuthAccessToken")
.HasColumnType("text");
b.Property<DateTime?>("SpotifyAuthCreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<int?>("SpotifyAuthExpiresAfterSeconds")
.HasColumnType("integer");
b.Property<string>("SpotifyAuthRefreshToken")
.HasColumnType("text");
b.Property<bool>("WasChosenForSuggestionThisRound")
.HasColumnType("boolean");
b.HasKey("UserId");
b.ToTable("Users");
});
modelBuilder.Entity("LikedSongs", b =>
{
b.HasOne("Song", null)
.WithMany()
.HasForeignKey("SongId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("User", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("SmartPlaylistDefinition", b =>
{
b.HasOne("User", "CreatedBy")
.WithMany()
.HasForeignKey("CreatedByUserId");
b.Navigation("CreatedBy");
});
modelBuilder.Entity("Song", b =>
{
b.HasOne("SmartPlaylistDefinition", null)
.WithMany("ExplicitlyExcludedSongs")
.HasForeignKey("SmartPlaylistDefinitionId");
b.HasOne("SmartPlaylistDefinition", null)
.WithMany("ExplicitlyIncludedSongs")
.HasForeignKey("SmartPlaylistDefinitionId1");
});
modelBuilder.Entity("SongSuggestion", b =>
{
b.HasOne("Song", "Song")
.WithMany()
.HasForeignKey("SongId");
b.HasOne("SuggestionHelper", "SuggestionHelper")
.WithMany()
.HasForeignKey("SuggestionHelperId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("User", "User")
.WithMany()
.HasForeignKey("UserId");
b.Navigation("Song");
b.Navigation("SuggestionHelper");
b.Navigation("User");
});
modelBuilder.Entity("SuggestionHelper", b =>
{
b.HasOne("SmartPlaylistDefinition", null)
.WithMany("Categories")
.HasForeignKey("SmartPlaylistDefinitionId");
});
modelBuilder.Entity("SmartPlaylistDefinition", b =>
{
b.Navigation("Categories");
b.Navigation("ExplicitlyExcludedSongs");
b.Navigation("ExplicitlyIncludedSongs");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -1,80 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace song_of_the_day.DataMigrations
{
/// <inheritdoc />
public partial class explicitlymodellikedsongsrelationship : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Songs_Users_UserId",
table: "Songs");
migrationBuilder.DropIndex(
name: "IX_Songs_UserId",
table: "Songs");
migrationBuilder.DropColumn(
name: "UserId",
table: "Songs");
migrationBuilder.CreateTable(
name: "LikedSongs",
columns: table => new
{
SongId = table.Column<int>(type: "integer", nullable: false),
UserId = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_LikedSongs", x => new { x.SongId, x.UserId });
table.ForeignKey(
name: "FK_LikedSongs_Songs_SongId",
column: x => x.SongId,
principalTable: "Songs",
principalColumn: "SongId",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_LikedSongs_Users_UserId",
column: x => x.UserId,
principalTable: "Users",
principalColumn: "UserId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_LikedSongs_UserId",
table: "LikedSongs",
column: "UserId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "LikedSongs");
migrationBuilder.AddColumn<int>(
name: "UserId",
table: "Songs",
type: "integer",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_Songs_UserId",
table: "Songs",
column: "UserId");
migrationBuilder.AddForeignKey(
name: "FK_Songs_Users_UserId",
table: "Songs",
column: "UserId",
principalTable: "Users",
principalColumn: "UserId");
}
}
}

View File

@ -21,21 +21,6 @@ namespace song_of_the_day.DataMigrations
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("LikedSongs", b =>
{
b.Property<int>("SongId")
.HasColumnType("integer");
b.Property<int>("UserId")
.HasColumnType("integer");
b.HasKey("SongId", "UserId");
b.HasIndex("UserId");
b.ToTable("LikedSongs");
});
modelBuilder.Entity("SmartPlaylistDefinition", b => modelBuilder.Entity("SmartPlaylistDefinition", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
@ -98,12 +83,17 @@ namespace song_of_the_day.DataMigrations
b.Property<string>("Url") b.Property<string>("Url")
.HasColumnType("text"); .HasColumnType("text");
b.Property<int?>("UserId")
.HasColumnType("integer");
b.HasKey("SongId"); b.HasKey("SongId");
b.HasIndex("SmartPlaylistDefinitionId"); b.HasIndex("SmartPlaylistDefinitionId");
b.HasIndex("SmartPlaylistDefinitionId1"); b.HasIndex("SmartPlaylistDefinitionId1");
b.HasIndex("UserId");
b.ToTable("Songs"); b.ToTable("Songs");
}); });
@ -214,21 +204,6 @@ namespace song_of_the_day.DataMigrations
b.ToTable("Users"); b.ToTable("Users");
}); });
modelBuilder.Entity("LikedSongs", b =>
{
b.HasOne("Song", null)
.WithMany()
.HasForeignKey("SongId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("User", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("SmartPlaylistDefinition", b => modelBuilder.Entity("SmartPlaylistDefinition", b =>
{ {
b.HasOne("User", "CreatedBy") b.HasOne("User", "CreatedBy")
@ -247,6 +222,10 @@ namespace song_of_the_day.DataMigrations
b.HasOne("SmartPlaylistDefinition", null) b.HasOne("SmartPlaylistDefinition", null)
.WithMany("ExplicitlyIncludedSongs") .WithMany("ExplicitlyIncludedSongs")
.HasForeignKey("SmartPlaylistDefinitionId1"); .HasForeignKey("SmartPlaylistDefinitionId1");
b.HasOne("User", null)
.WithMany("LikedSongs")
.HasForeignKey("UserId");
}); });
modelBuilder.Entity("SongSuggestion", b => modelBuilder.Entity("SongSuggestion", b =>
@ -287,6 +266,11 @@ namespace song_of_the_day.DataMigrations
b.Navigation("ExplicitlyIncludedSongs"); b.Navigation("ExplicitlyIncludedSongs");
}); });
modelBuilder.Entity("User", b =>
{
b.Navigation("LikedSongs");
});
#pragma warning restore 612, 618 #pragma warning restore 612, 618
} }
} }

View File

@ -8,6 +8,4 @@ public class Song
public string? Url { get; set; } public string? Url { get; set; }
public SongProvider? Provider { get; set; } public SongProvider? Provider { get; set; }
public string? SpotifyId { get; set; } public string? SpotifyId { get; set; }
public IList<User> LikedBy { get; set; }
} }

View File

@ -11,11 +11,8 @@
<th>Date</th> <th>Date</th>
<th>Song</th> <th>Song</th>
<th>Submitter</th> <th>Submitter</th>
@if(@User.Identity.IsAuthenticated) <th>Details</th>
{ <th></th>
<th>Details</th>
<th></th>
}
</tr> </tr>
@foreach(var songSuggestion in Model.SongSuggestions) @foreach(var songSuggestion in Model.SongSuggestions)
{ {
@ -29,21 +26,18 @@
<td>@songSuggestion?.Date.ToString("dd. MM. yyyy")</td> <td>@songSuggestion?.Date.ToString("dd. MM. yyyy")</td>
<td><a href="@songSuggestion?.Song.Url" target="_blank">@string.Format("{0} - {1}", songSuggestion?.Song.Name, songSuggestion?.Song.Artist)</a></td> <td><a href="@songSuggestion?.Song.Url" target="_blank">@string.Format("{0} - {1}", songSuggestion?.Song.Name, songSuggestion?.Song.Artist)</a></td>
<td>@displayName</td> <td>@displayName</td>
@if(@User.Identity.IsAuthenticated) <td><a href="/SongSubmission/@songSuggestion?.Id">View</a></td>
{ <td class="=viewLike">
<td><a href="/SongSubmission/@songSuggestion?.Id">View</a></td> @if(songSuggestion?.Song != null)
<td class="=viewLike"> {
@if(songSuggestion?.Song != null) var handler = Model.HasUserLikedThisSong(@songSuggestion.Song) ? "UnlikeSong" : "LikeSong";
{ var likebuttonText = Model.HasUserLikedThisSong(@songSuggestion.Song) ? "Unlike" : "Like";
var handler = Model.HasUserLikedThisSong(@songSuggestion.Song) ? "UnlikeSong" : "LikeSong"; <form method="post">
var likebuttonText = Model.HasUserLikedThisSong(@songSuggestion.Song) ? "Unlike" : "Like"; <input name="songId" value="@songSuggestion.Song.SongId" type="hidden" />
<form method="post"> <input type="submit" id="songlike" value="@likebuttonText" asp-page-handler="@handler" />
<input name="songId" value="@songSuggestion.Song.SongId" type="hidden" /> </form>
<input type="submit" id="songlike" value="@likebuttonText" asp-page-handler="@handler" /> }
</form> </td>
}
</td>
}
</tr> </tr>
} }
} }

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(AppConfiguration.Instance.UserCheckTimerSchedule, "Europe/Vienna", includingSeconds: false); var userCheckTimer = new CronTimer("*/1 * * * *", "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>();
@ -57,7 +57,6 @@ userCheckTimer.OnOccurence += async (s, ea) =>
LdapUserName = string.Empty, LdapUserName = string.Empty,
AssociationInProgress = false, AssociationInProgress = false,
WasChosenForSuggestionThisRound = false, WasChosenForSuggestionThisRound = false,
LikedSongs = new List<Song>()
}; };
dci.Users?.Add(newUser); dci.Users?.Add(newUser);
needsSaving = true; needsSaving = true;
@ -72,7 +71,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(AppConfiguration.Instance.LikePlaylistCheckTimerSchedule, "Europe/Vienna", includingSeconds: false); var likePlaylistCheckTimer = new CronTimer("*/30 * * * *", "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,24 +85,19 @@ likePlaylistCheckTimer.OnOccurence += async (s, ea) =>
{ {
if (!await spotifyApiClient.IsUserAuthenticatedAsync(user)) if (!await spotifyApiClient.IsUserAuthenticatedAsync(user))
{ {
logger.LogWarning($"User {user.LdapUserName} is not authorized with Spotify - skipping playlist sync"); continue;
} }
else var foundPlaylist = dci.SmartPlaylistDefinitions?.Where(p => p.CreatedBy == user).ToList().Where(p => p.IsThisUsersLikedSongsPlaylist).SingleOrDefault();
if (foundPlaylist == null)
{ {
var foundPlaylist = dci.SmartPlaylistDefinitions?.Where(p => p.CreatedBy == user).ToList().Where(p => p.IsThisUsersLikedSongsPlaylist).SingleOrDefault(); var title = $"{user.PreferredName}'s liked Songs";
if (foundPlaylist == null) 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
logger.LogWarning($"Creating liked songs playlist for user {user.LdapUserName}"); var newPlaylist = await (await spotifyApiClient.WithUserAuthorizationAsync(user)).CreateSpotifyPlaylist(title, description, false, true, user);
var title = $"{user.PreferredName}'s liked songs"; await playlistSynchronizer.SynchronizePlaylistAsync(newPlaylist);
var description = $"A collection of the songs liked by {user.PreferredName} on their 'Song of the day' server instance."; needsSaving = true;
// 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)
@ -114,7 +108,7 @@ likePlaylistCheckTimer.OnOccurence += async (s, ea) =>
}; };
logger.LogTrace("Setting up user intro timer"); logger.LogTrace("Setting up user intro timer");
var userIntroTimer = new CronTimer(AppConfiguration.Instance.UserIntroCheckTimerSchedule, "Europe/Vienna", includingSeconds: false); var userIntroTimer = new CronTimer("*/1 * * * *", "Europe/Vienna", includingSeconds: false);
userIntroTimer.OnOccurence += async (s, ea) => userIntroTimer.OnOccurence += async (s, ea) =>
{ {
var dci = DataContext.Instance; var dci = DataContext.Instance;
@ -143,7 +137,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(AppConfiguration.Instance.PickOfTheDayCheckTimerSchedule, "Europe/Vienna", includingSeconds: false); var pickOfTheDayTimer = new CronTimer("0 8 * * *", "Europe/Vienna", includingSeconds: false);
pickOfTheDayTimer.OnOccurence += async (s, ea) => pickOfTheDayTimer.OnOccurence += async (s, ea) =>
{ {
var dci = DataContext.Instance; var dci = DataContext.Instance;
@ -214,10 +208,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(AppConfiguration.Instance.LdapAssociationTimerSchedule, "Europe/Vienna", includingSeconds: false); var ldapAssociationTimer = new CronTimer("*/10 * * * *", "Europe/Vienna", includingSeconds: false);
ldapAssociationTimer.OnOccurence += async (s, ea) => ldapAssociationTimer.OnOccurence += async (s, ea) =>
{ {
var dci = DataContext.Instance; var dci = DataContext.Instance;
@ -246,7 +240,7 @@ ldapAssociationTimer.OnOccurence += async (s, ea) =>
}; };
logger.LogTrace("Setting up MessageSync timer"); logger.LogTrace("Setting up MessageSync timer");
var messageSyncTimer = new CronTimer(AppConfiguration.Instance.MessageSyncTimerSchedule, "Europe/Vienna", includingSeconds: false); var messageSyncTimer = new CronTimer("*/10 * * * *", "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) || string.IsNullOrEmpty(user.SpotifyAuthRefreshToken)) if (string.IsNullOrEmpty(user.SpotifyAuthAccessToken))
{ {
// 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.9 0.6.1