diff --git a/.gitmodules b/.gitmodules index 6b477c90..5c94e873 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "tbclient.protobuf"] - path = tbclient.protobuf - url = git@github.com:n0099/tbclient.protobuf.git + path = tbclient.protobuf + url = git@github.com:n0099/tbclient.protobuf.git diff --git a/c#/crawler/src/Tieba/Crawl/Saver/SaverWithRevision.cs b/c#/crawler/src/Tieba/Crawl/Saver/SaverWithRevision.cs index 1b7409b7..53614a6a 100644 --- a/c#/crawler/src/Tieba/Crawl/Saver/SaverWithRevision.cs +++ b/c#/crawler/src/Tieba/Crawl/Saver/SaverWithRevision.cs @@ -62,9 +62,7 @@ public partial class SaverWithRevision } public partial class SaverWithRevision { - protected abstract NullFieldsBitMask GetRevisionNullFieldBitMask(string fieldName); - - protected IEnumerable> SaveNewEntities( + protected static IEnumerable> SaveNewEntities( CrawlerDbContext db, IReadOnlyCollection> maybeEntities) where TEntity : RowVersionedEntity @@ -76,7 +74,7 @@ protected IEnumerable> SaveNewEntities( .Select(entity => new ExistingAndNewEntity(entity.Existing!, entity.New)); } - protected void SaveExistingEntities( + protected static void SaveExistingEntities( CrawlerDbContext db, IEnumerable> existingAndNewEntities) where TEntity : RowVersionedEntity => @@ -103,6 +101,8 @@ on newNavigation.Metadata.Name equals existingNavigation.Metadata.Name .ForEach(prop => prop.IsModified = false); }); + protected abstract NullFieldsBitMask GetRevisionNullFieldBitMask(string fieldName); + protected void SaveExistingEntityRevisions( CrawlerDbContext db, Func revisionFactory, diff --git a/c#/shared/src/Db/TbmDbContext.cs b/c#/shared/src/Db/TbmDbContext.cs index 01a5396d..0f4ab596 100644 --- a/c#/shared/src/Db/TbmDbContext.cs +++ b/c#/shared/src/Db/TbmDbContext.cs @@ -144,6 +144,9 @@ public class TbmDbContext(ILogger ImageInReplies => Set(); public DbSet ReplyContentImages => Set(); + protected static void OnModelCreatingWithFid(ModelBuilder b, uint fid) => + b.Entity().ToTable($"tbmc_f{fid}_reply_content_image"); + [SuppressMessage("Naming", "CA1725:Parameter names should match base declaration")] [SuppressMessage("Critical Code Smell", "S927:Parameter names should match base declaration and other partial definitions")] [SuppressMessage("Style", "IDE0058:Expression value is never used")] @@ -176,9 +179,6 @@ protected override void OnModelCreating(ModelBuilder b) b.Entity().HasOne(e => e.ImageInReply).WithMany(); } - protected void OnModelCreatingWithFid(ModelBuilder b, uint fid) => - b.Entity().ToTable($"tbmc_f{fid}_reply_content_image"); - protected virtual void OnConfiguringNpgsql(NpgsqlDbContextOptionsBuilder builder) { } protected virtual void OnBuildingNpgsqlDataSource(NpgsqlDataSourceBuilder builder) { } diff --git a/c#/tbm.sln b/c#/tbm.sln index ca51ba54..9b4b2269 100644 --- a/c#/tbm.sln +++ b/c#/tbm.sln @@ -3,13 +3,13 @@ Microsoft Visual Studio Solution File, Format Version 12.00 VisualStudioVersion = 17.4.33213.308 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B0F531C7-9D14-4F81-B809-D6429D4103FC}" - ProjectSection(SolutionItems) = preProject - .editorconfig = .editorconfig - .gitignore = .gitignore - stylecop.json = stylecop.json - GlobalSuppressions.cs = GlobalSuppressions.cs - Directory.Build.props = Directory.Build.props - EndProjectSection + ProjectSection(SolutionItems) = preProject + .editorconfig = .editorconfig + .gitignore = .gitignore + stylecop.json = stylecop.json + GlobalSuppressions.cs = GlobalSuppressions.cs + Directory.Build.props = Directory.Build.props + EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TbClient", "tbClient\TbClient.csproj", "{4D782E36-9769-4B10-8D5F-F1F3648F8D74}" EndProject @@ -20,32 +20,32 @@ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "tbm.ImagePipeline", "imagePipeline\tbm.ImagePipeline.csproj", "{3DC9F1EC-5F76-4F78-9F00-99908CED450B}" EndProject Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {D7F086F7-6DBF-4C26-AB68-0093063FF755}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D7F086F7-6DBF-4C26-AB68-0093063FF755}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D7F086F7-6DBF-4C26-AB68-0093063FF755}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D7F086F7-6DBF-4C26-AB68-0093063FF755}.Release|Any CPU.Build.0 = Release|Any CPU - {3DAC21AE-4493-4CF2-B887-203A781C12AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3DAC21AE-4493-4CF2-B887-203A781C12AA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3DAC21AE-4493-4CF2-B887-203A781C12AA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3DAC21AE-4493-4CF2-B887-203A781C12AA}.Release|Any CPU.Build.0 = Release|Any CPU - {3DC9F1EC-5F76-4F78-9F00-99908CED450B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3DC9F1EC-5F76-4F78-9F00-99908CED450B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3DC9F1EC-5F76-4F78-9F00-99908CED450B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3DC9F1EC-5F76-4F78-9F00-99908CED450B}.Release|Any CPU.Build.0 = Release|Any CPU - {4D782E36-9769-4B10-8D5F-F1F3648F8D74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4D782E36-9769-4B10-8D5F-F1F3648F8D74}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4D782E36-9769-4B10-8D5F-F1F3648F8D74}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4D782E36-9769-4B10-8D5F-F1F3648F8D74}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {A136C5D5-62D8-4451-B139-33124D2A44E5} - EndGlobalSection + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D7F086F7-6DBF-4C26-AB68-0093063FF755}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D7F086F7-6DBF-4C26-AB68-0093063FF755}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D7F086F7-6DBF-4C26-AB68-0093063FF755}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D7F086F7-6DBF-4C26-AB68-0093063FF755}.Release|Any CPU.Build.0 = Release|Any CPU + {3DAC21AE-4493-4CF2-B887-203A781C12AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3DAC21AE-4493-4CF2-B887-203A781C12AA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3DAC21AE-4493-4CF2-B887-203A781C12AA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3DAC21AE-4493-4CF2-B887-203A781C12AA}.Release|Any CPU.Build.0 = Release|Any CPU + {3DC9F1EC-5F76-4F78-9F00-99908CED450B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3DC9F1EC-5F76-4F78-9F00-99908CED450B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3DC9F1EC-5F76-4F78-9F00-99908CED450B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3DC9F1EC-5F76-4F78-9F00-99908CED450B}.Release|Any CPU.Build.0 = Release|Any CPU + {4D782E36-9769-4B10-8D5F-F1F3648F8D74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4D782E36-9769-4B10-8D5F-F1F3648F8D74}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4D782E36-9769-4B10-8D5F-F1F3648F8D74}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4D782E36-9769-4B10-8D5F-F1F3648F8D74}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A136C5D5-62D8-4451-B139-33124D2A44E5} + EndGlobalSection EndGlobal diff --git a/c#/tbm.sln.DotSettings b/c#/tbm.sln.DotSettings index 89139de3..3179b1d6 100644 --- a/c#/tbm.sln.DotSettings +++ b/c#/tbm.sln.DotSettings @@ -1,6 +1,6 @@ - False - True + False + True True True True diff --git a/fe/src/api/index.ts b/fe/src/api/index.ts index 488e8705..9d7d77d9 100644 --- a/fe/src/api/index.ts +++ b/fe/src/api/index.ts @@ -88,9 +88,6 @@ const queryFunctionWithReCAPTCHA = async export type ApiErrorClass = ApiResponseError | FetchError; type QueryFunctions = typeof queryFunction | typeof queryFunctionWithReCAPTCHA; const useApi = < - - // https://github.com/typescript-eslint/typescript-eslint/issues/9706 - // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters TApi extends Api, TResponse = TApi['response'], TQueryParam extends ObjUnknown = TApi['queryParam']> @@ -128,9 +125,6 @@ const useApi = < return ret; }; const useApiWithCursor = < - - // https://github.com/typescript-eslint/typescript-eslint/issues/9706 - // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters TApi extends Api, TResponse extends CursorPagination = TApi['response'], TQueryParam extends ObjUnknown = TApi['queryParam']> diff --git a/fe/src/pages/posts.vue b/fe/src/pages/posts.vue index 146d86fe..1351f9be 100644 --- a/fe/src/pages/posts.vue +++ b/fe/src/pages/posts.vue @@ -76,8 +76,8 @@ watch([dataUpdatedAt, errorUpdatedAt], async (updatedAt: UnixTimestamp[]) => { const postCount = _.sum(Object.values(fetchedPage?.pages.matchQueryPostCount ?? {})); notyShow('success', `已加载${postCount}条记录 ${isQueryCached - ? '使用前端本地缓存' - : ` + ? '使用前端本地缓存' + : ` 前端耗时${_.round(renderDuration / 1000, 2)}s ${isQueriedBySSR ? '使用服务端渲染预请求' : ''} 后端+网络耗时${_.round(networkDuration / 1000, 2)}s`}`); diff --git a/fe/src/utils/echarts.ts b/fe/src/utils/echarts.ts index 5ac3a7d2..91f9c22e 100644 --- a/fe/src/utils/echarts.ts +++ b/fe/src/utils/echarts.ts @@ -5,7 +5,7 @@ import * as echarts from 'echarts/core'; import type { ColorPaletteOptionMixin } from 'echarts/types/src/util/types.d.ts'; export const useResizeableEcharts = (el: Parameters[0]) => - useResizeObserver(el, _.debounce((entries: Parameters[1]>[0]) => { // https://github.com/vueuse/vueuse/issues/4216 + useResizeObserver(el, _.debounce((entries: readonly ResizeObserverEntry[]) => { entries.forEach(entry => { echarts.getInstanceByDom(entry.target as HTMLElement)?.resize(); });