a fork of iceshrimp.net but a tweaked frontend to my personal liking. waow
fediverse social-media social iceshrimp fedi
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

[backend/database] Allow web sessions to optionally be children of Mastodon sessions

authored by

pancakes and committed by
Laura Hausmann
a1d1a564 14588ab9

+87 -1
+17
Iceshrimp.Backend/Core/Database/Migrations/DatabaseContextModelSnapshot.cs
··· 3951 3951 .HasColumnType("timestamp with time zone") 3952 3952 .HasColumnName("lastActiveDate"); 3953 3953 3954 + b.Property<string>("MastodonTokenId") 3955 + .HasMaxLength(32) 3956 + .HasColumnType("character varying(32)") 3957 + .HasColumnName("mastodonTokenId"); 3958 + 3954 3959 b.Property<string>("Token") 3955 3960 .IsRequired() 3956 3961 .HasMaxLength(64) ··· 3965 3970 .HasColumnName("userId"); 3966 3971 3967 3972 b.HasKey("Id"); 3973 + 3974 + b.HasIndex("MastodonTokenId") 3975 + .IsUnique(); 3968 3976 3969 3977 b.HasIndex("Token"); 3970 3978 ··· 5779 5787 5780 5788 modelBuilder.Entity("Iceshrimp.Backend.Core.Database.Tables.Session", b => 5781 5789 { 5790 + b.HasOne("Iceshrimp.Backend.Core.Database.Tables.OauthToken", "MastodonToken") 5791 + .WithOne("WebSession") 5792 + .HasForeignKey("Iceshrimp.Backend.Core.Database.Tables.Session", "MastodonTokenId") 5793 + .OnDelete(DeleteBehavior.Cascade); 5794 + 5782 5795 b.HasOne("Iceshrimp.Backend.Core.Database.Tables.User", "User") 5783 5796 .WithMany("Sessions") 5784 5797 .HasForeignKey("UserId") 5785 5798 .OnDelete(DeleteBehavior.Cascade) 5786 5799 .IsRequired(); 5800 + 5801 + b.Navigation("MastodonToken"); 5787 5802 5788 5803 b.Navigation("User"); 5789 5804 }); ··· 6101 6116 modelBuilder.Entity("Iceshrimp.Backend.Core.Database.Tables.OauthToken", b => 6102 6117 { 6103 6118 b.Navigation("PushSubscription"); 6119 + 6120 + b.Navigation("WebSession"); 6104 6121 }); 6105 6122 6106 6123 modelBuilder.Entity("Iceshrimp.Backend.Core.Database.Tables.Page", b =>
+54
Iceshrimp.Backend/Core/Database/Migrations/v2025.1-beta6/20250513105104_MastodonLinkedWebSession.cs
··· 1 + using Microsoft.EntityFrameworkCore.Migrations; 2 + using Microsoft.EntityFrameworkCore.Infrastructure; 3 + 4 + #nullable disable 5 + 6 + namespace Iceshrimp.Backend.Core.Database.Migrations 7 + { 8 + /// <inheritdoc /> 9 + [DbContext(typeof(DatabaseContext))] 10 + [Migration("20250513105104_MastodonLinkedWebSession")] 11 + public partial class MastodonLinkedWebSession : Migration 12 + { 13 + /// <inheritdoc /> 14 + protected override void Up(MigrationBuilder migrationBuilder) 15 + { 16 + migrationBuilder.AddColumn<string>( 17 + name: "mastodonTokenId", 18 + table: "session", 19 + type: "character varying(32)", 20 + maxLength: 32, 21 + nullable: true); 22 + 23 + migrationBuilder.CreateIndex( 24 + name: "IX_session_mastodonTokenId", 25 + table: "session", 26 + column: "mastodonTokenId", 27 + unique: true); 28 + 29 + migrationBuilder.AddForeignKey( 30 + name: "FK_session_oauth_token_mastodonTokenId", 31 + table: "session", 32 + column: "mastodonTokenId", 33 + principalTable: "oauth_token", 34 + principalColumn: "id", 35 + onDelete: ReferentialAction.Cascade); 36 + } 37 + 38 + /// <inheritdoc /> 39 + protected override void Down(MigrationBuilder migrationBuilder) 40 + { 41 + migrationBuilder.DropForeignKey( 42 + name: "FK_session_oauth_token_mastodonTokenId", 43 + table: "session"); 44 + 45 + migrationBuilder.DropIndex( 46 + name: "IX_session_mastodonTokenId", 47 + table: "session"); 48 + 49 + migrationBuilder.DropColumn( 50 + name: "mastodonTokenId", 51 + table: "session"); 52 + } 53 + } 54 + }
+3
Iceshrimp.Backend/Core/Database/Tables/OauthToken.cs
··· 74 74 [Column("isPleroma")] public bool IsPleroma { get; set; } 75 75 [Column("supportsInlineMedia")] public bool SupportsInlineMedia { get; set; } 76 76 77 + [InverseProperty(nameof(Session.MastodonToken))] 78 + public virtual Session? WebSession { get; set; } 79 + 77 80 [Column("lastActiveDate")] public DateTime? LastActiveDate { get; set; } 78 81 79 82 private class EntityTypeConfiguration : IEntityTypeConfiguration<OauthToken>
+13 -1
Iceshrimp.Backend/Core/Database/Tables/Session.cs
··· 40 40 [InverseProperty(nameof(Tables.User.Sessions))] 41 41 public virtual User User { get; set; } = null!; 42 42 43 + [Column("mastodonTokenId")] 44 + [StringLength(32)] 45 + public string? MastodonTokenId { get; set; } 46 + 47 + [ForeignKey(nameof(MastodonTokenId))] 48 + [InverseProperty(nameof(OauthToken.WebSession))] 49 + public virtual OauthToken? MastodonToken { get; set; } 50 + 43 51 [Column("lastActiveDate")] public DateTime? LastActiveDate { get; set; } 44 - 52 + 45 53 private class EntityTypeConfiguration : IEntityTypeConfiguration<Session> 46 54 { 47 55 public void Configure(EntityTypeBuilder<Session> entity) ··· 53 61 54 62 entity.HasOne(d => d.User) 55 63 .WithMany(p => p.Sessions) 64 + .OnDelete(DeleteBehavior.Cascade); 65 + 66 + entity.HasOne(d => d.MastodonToken) 67 + .WithOne(p => p.WebSession) 56 68 .OnDelete(DeleteBehavior.Cascade); 57 69 } 58 70 }