Skip to content

Commit

Permalink
Merge branch 'dev' into 898-PR
Browse files Browse the repository at this point in the history
  • Loading branch information
ywmoyue committed Oct 29, 2024
2 parents 47028ba + c4152b2 commit d49e8a5
Show file tree
Hide file tree
Showing 51 changed files with 815 additions and 274 deletions.
2 changes: 1 addition & 1 deletion document/install-readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

![](./_img/check-ps1-permission-02.drawio.png)

3. 执行命令`Set-ExecutionPolicy -ExecutionPolicy RemoteSigned`并按<kbd>Y</kbd>键启用脚本执行权限
3. 执行命令`Set-ExecutionPolicy -ExecutionPolicy RemoteSigned`并按<kbd>Y</kbd>键启用脚本执行权限, 如果执行命令后无任何输出表示执行成功可以进入下一步运行安装脚本

### 运行安装脚本

Expand Down
10 changes: 5 additions & 5 deletions document/new_version.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": "4.7.4",
"version_num": 40704,
"version_desc": "更新内容:\r\n\r\n- 新增自动跳过OP/ED功能,设置中开启 \r\n\r\n- 可选保存已下载视频数据到数据库 \r\n\r\n- 视频播放控件内新增章节看点列表 \r\n\r\n- 持续快进功能启用分档位快进 \r\n\r\n- 将外部合并视频帮助页移入内部,添加python批量合并脚本外链 \r\n\r\n- 更新证书 \r\n\r\n- sqlite数据库迁移更新 \r\n\r\n- 可设置优先播放器类型\r\n\r\n- 修复选集界面错误换行 \r\n\r\n- 捕获初始化下载视频错误 \r\n\r\n- 已下载番剧打开详情错误 \r\n\r\n\r\n\r\n\r\n 如果无法打开下载地址,请访问:https://github.com/ywmoyue/biliuwp-lite/releases",
"url": "https://github.com/ywmoyue/biliuwp-lite/releases",
"download_url": "https://github.com/ywmoyue/biliuwp-lite/releases"
"version": "4.7.6",
"version_num": 40706,
"version_desc": "更新内容:\r\n\r\n- 支持屏蔽彩色弹幕 \r\n\r\n- 完善快捷键自定义功能,新增快捷键行为:切换字幕开关 \r\n\r\n- 打开下载页时不重新加载下载项 \r\n\r\n- 打开图片时不再遮挡状态栏 \r\n\r\n- 全局mica半透明背景样式调整 \r\n\r\n- 去除多余的白色焦点边框 \r\n\r\n- 状态栏顶部拖拽窗口 \r\n\r\n- 修复sql脚本错误 \r\n\r\n- 修复FFmpegInterop播放器播放视频偶现播放中突然跳转视频 结尾或无声音 \r\n\r\n- 修复分区->番剧->连载动画页的港澳台番剧打开失败 \r\n\r\n- 安装教程补充 \r\n\r\n- 修复部分视频媒体流加载错误 \r\n\r\n- 修复UP主个人主页报错 \r\n\r\n- 开启使用下载索引设置项后下载视频无字幕 \r\n\r\n- 帮助页新增 Windows 11 24H2 杜比全景声无声说明 \r\n\r\n- 新标签页已设置背景图不存在时提示\r\n\r\n\r\n\r\n\r\n 如果无法打开下载地址,请访问:https://github.com/ywmoyue/biliuwp-lite/releases",
"url": "https://github.com/ywmoyue/biliuwp-lite/releases",
"download_url": "https://github.com/ywmoyue/biliuwp-lite/releases"
}
12 changes: 8 additions & 4 deletions src/BiliLite.UWP/BiliLite.UWP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -271,16 +271,19 @@
</Compile>
<Compile Include="Services\BiliLiteDbContext.cs" />
<Compile Include="Services\DownloadService.cs" />
<Compile Include="Services\PluginService.cs" />
<Compile Include="Services\SqlMigrateService.cs" />
<Compile Include="ViewModels\Common\MainPageViewModel.cs" />
<Compile Include="ViewModels\Common\PieControlViewModel.cs" />
<Compile Include="ViewModels\Plugins\WebSocketPluginViewModel.cs" />
<Compile Include="ViewModels\Settings\CDNServerItemViewModel.cs" />
<Compile Include="Pages\ISavablePage.cs" />
<Compile Include="Services\Biz\MediaListService.cs" />
<Compile Include="Services\ContentFilterService.cs" />
<Compile Include="Services\PlaySpeedMenuService.cs" />
<Compile Include="ViewModels\Comment\SendCommentDialogViewModel.cs" />
<Compile Include="ViewModels\Rank\RankRegionViewModel.cs" />
<Compile Include="ViewModels\Settings\DevSettingsControlViewModel.cs" />
<Compile Include="ViewModels\Settings\EditPlaySpeedMenuViewModel.cs" />
<Compile Include="ViewModels\Settings\FilterRuleViewModel.cs" />
<Compile Include="ViewModels\Settings\FilterSettingsViewModel.cs" />
Expand Down Expand Up @@ -1555,10 +1558,7 @@
<PackageReference Include="QRCoder">
<Version>1.4.3</Version>
</PackageReference>
<PackageReference Include="RestSharp">
<Version>107.3.0</Version>
</PackageReference>
<PackageReference Include="Simple.AES">
<PackageReference Include="Simple.AES.Core.Fork">
<Version>2.0.2</Version>
</PackageReference>
<PackageReference Include="SYEngine.uwp">
Expand All @@ -1567,6 +1567,9 @@
<PackageReference Include="Tomlyn">
<Version>0.17.0</Version>
</PackageReference>
<PackageReference Include="WebSocket4Net">
<Version>0.15.2</Version>
</PackageReference>
<PackageReference Include="Win2D.uwp">
<Version>1.26.0</Version>
</PackageReference>
Expand All @@ -1593,6 +1596,7 @@
</ItemGroup>
<ItemGroup>
<Folder Include="Assets\Tools\" />
<Folder Include="Models\Plugins\" />
<Folder Include="Models\Requests\Api\Grpc\" />
<Folder Include="Modules\User\SendDynamic\" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ static UserDynamicItemV2DataTemplateSelector()
{
Constants.DynamicTypes.DRAW, (selector, model) =>
{
if (model.Dynamic == null) return selector.OtherTemplate;
if (model.Dynamic.DynDraw.Items.Count == 1)
{
return selector.Draw1x1Template;
Expand Down
1 change: 1 addition & 0 deletions src/BiliLite.UWP/Controls/PlayerControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,7 @@ private async void DanmuTimer_Tick(object sender, object e)

private void PositionTimer_Tick(object sender, object e)
{
PluginCenter.BroadcastPosition(this, Player.Position);
if (!m_autoSkipOpEdFlag) return;
if (CurrentPlayItem == null) return;
if (CurrentPlayItem.EpisodeSkip == null) return;
Expand Down
47 changes: 47 additions & 0 deletions src/BiliLite.UWP/Controls/Settings/DevSettingsControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
xmlns:controls1="using:Microsoft.UI.Xaml.Controls"
xmlns:common="using:BiliLite.Models.Common"
xmlns:font="using:FontAwesome5"
xmlns:plugins="using:BiliLite.ViewModels.Plugins"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="400">
Expand Down Expand Up @@ -66,6 +67,12 @@
</ComboBox>
</controls:SettingsCard>

<controls:SettingsExpander Header="外置插件">
<controls:SettingsExpander.Items>
<Button Click="BtnSettingPlugin_OnClick">设置</Button>
</controls:SettingsExpander.Items>
</controls:SettingsExpander>

<controls:SettingsCard Header="迁移数据库"
Description="开发者调试用">
<controls:SettingsCard.HeaderIcon>
Expand Down Expand Up @@ -133,5 +140,45 @@
DisplayMemberPath="Name">
</ComboBox>
</controls:SettingsCard>

<ContentDialog x:Name="PluginsDialog"
Title="插件管理"
PrimaryButtonText="确认"
CloseButtonText="取消"
MinWidth="600">
<StackPanel Orientation="Vertical" Width="500">
<StackPanel>
<Button Click="BtnImportPluginInfo_OnClick">导入插件信息</Button>
</StackPanel>
<ScrollViewer Visibility="{x:Bind m_viewModel.ShowPluginList,Mode=OneWay}">
<ListView ItemsSource="{x:Bind m_viewModel.Plugins,Mode=OneWay}"
SelectionMode="None">
<ListView.ItemTemplate>
<DataTemplate x:DataType="plugins:WebSocketPluginViewModel">
<controls:SettingsExpander Header="{x:Bind Name,Mode=OneWay}">
<controls:SettingsExpander.Items>
<controls:SettingsCard Header="名称">
<TextBlock Text="{x:Bind Name}"></TextBlock>
</controls:SettingsCard>
<controls:SettingsCard Header="WS地址">
<TextBlock Text="{x:Bind WebSocketUrl,Mode=OneWay}"></TextBlock>
</controls:SettingsCard>
<controls:SettingsCard Header="Http地址">
<TextBlock Text="{x:Bind CheckUrl,Mode=OneWay}"></TextBlock>
</controls:SettingsCard>
<controls:SettingsCard Header="唤醒协议">
<TextBlock Text="{x:Bind WakeProto,Mode=OneWay}"></TextBlock>
</controls:SettingsCard>
<controls:SettingsCard Header="删除">
<Button Click="BtnDeletePlugin_OnClick">确认删除</Button>
</controls:SettingsCard>
</controls:SettingsExpander.Items>
</controls:SettingsExpander>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</ScrollViewer>
</StackPanel>
</ContentDialog>
</StackPanel>
</UserControl>
41 changes: 41 additions & 0 deletions src/BiliLite.UWP/Controls/Settings/DevSettingsControl.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.ObjectModel;
using System.Threading.Tasks;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
Expand All @@ -7,6 +8,13 @@
using BiliLite.Services;
using Microsoft.Extensions.DependencyInjection;
using Windows.ApplicationModel.Core;
using BiliLite.ViewModels.Settings;
using Windows.Storage.Pickers;
using Windows.Storage;
using BiliLite.ViewModels.Plugins;
using Microsoft.Toolkit.Uwp.Helpers;
using Newtonsoft.Json;
using IMapper = AutoMapper.IMapper;

//https://go.microsoft.com/fwlink/?LinkId=234236 上介绍了“用户控件”项模板

Expand All @@ -15,9 +23,17 @@ namespace BiliLite.Controls.Settings
public sealed partial class DevSettingsControl : UserControl
{
private static readonly ILogger _logger = GlobalLogger.FromCurrentType();
private readonly DevSettingsControlViewModel m_viewModel;
private readonly PluginService m_pluginService;
private readonly IMapper m_mapper;

public DevSettingsControl()
{
m_viewModel = App.ServiceProvider.GetRequiredService<DevSettingsControlViewModel>();
m_mapper = App.ServiceProvider.GetRequiredService<IMapper>();
m_pluginService = App.ServiceProvider.GetRequiredService<PluginService>();
m_viewModel.Plugins =
m_mapper.Map<ObservableCollection<WebSocketPluginViewModel>>(m_pluginService.GetPlugins());
this.InitializeComponent();
LoadDev();
}
Expand Down Expand Up @@ -217,5 +233,30 @@ private async void BtnMigrateDb_OnClick(object sender, RoutedEventArgs e)
var migrateService = App.ServiceProvider.GetRequiredService<SqlMigrateService>();
await migrateService.ExcuteAllMigrationScripts();
}

private async void BtnSettingPlugin_OnClick(object sender, RoutedEventArgs e)
{
await PluginsDialog.ShowAsync();
}

private async void BtnImportPluginInfo_OnClick(object sender, RoutedEventArgs e)
{
var filePicker = new FileOpenPicker();
filePicker.FileTypeFilter.Add(".json");
var file = await filePicker.PickSingleFileAsync();
if (file == null) return;
using var openFile = await file.OpenAsync(FileAccessMode.Read);
var text = await openFile.ReadTextAsync();
var plugin = JsonConvert.DeserializeObject<WebSocketPlugin>(text);
await m_pluginService.AddPlugin(plugin);
m_viewModel.AddPlugin(m_mapper.Map<WebSocketPluginViewModel>(plugin));
}

private async void BtnDeletePlugin_OnClick(object sender, RoutedEventArgs e)
{
if (!(sender is Button { DataContext: WebSocketPluginViewModel plugin })) return;
await m_pluginService.RemovePlugin(plugin.Name);
m_viewModel.RemovePlugin(plugin);
}
}
}
3 changes: 2 additions & 1 deletion src/BiliLite.UWP/Extensions/ApiModelExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using BiliLite.Models.Common;
using BiliLite.Models.Requests;
using BiliLite.Models.Responses;
using BiliLite.Services;
Expand All @@ -18,7 +19,7 @@ public static class ApiModelExtensions
public static async Task<HttpResults> Request(this ApiModel api, [CallerMemberName] string methodName = null)
{
_logger.Trace($"请求记录 {methodName} {api.baseUrl}");
if (api.method == RestSharp.Method.Get)
if (api.method == HttpMethods.Get)
{
if (api.need_redirect)
{
Expand Down
14 changes: 14 additions & 0 deletions src/BiliLite.UWP/Extensions/FileExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,19 @@ public static async Task<StorageFile> GetExportFile(string fileTypeChoiceKey, st
var file = await savePicker.PickSaveFileAsync();
return file;
}

public static async Task<bool> CheckFileExist(this string path)
{
try
{
var file = await StorageFile.GetFileFromPathAsync(path);
return file != null;
}
catch (Exception)
{
// 如果文件不存在或者路径无效,将捕获异常
return false;
}
}
}
}
3 changes: 3 additions & 0 deletions src/BiliLite.UWP/Extensions/MapperExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
using BiliLite.ViewModels.Comment;
using BiliLite.ViewModels.Download;
using BiliLite.ViewModels.Home;
using BiliLite.ViewModels.Plugins;
using BiliLite.ViewModels.Season;
using BiliLite.ViewModels.Settings;
using BiliLite.ViewModels.User;
Expand All @@ -46,6 +47,8 @@ public static IServiceCollection AddMapper(this IServiceCollection services)
{
var mapper = new Mapper(new MapperConfiguration(expression =>
{
expression.CreateMap<WebSocketPlugin, WebSocketPluginViewModel>()
.ReverseMap();
expression.CreateMap<DownloadedItemDTO, DownloadedItem>()
.ReverseMap();
expression.CreateMap<DownloadedSubItemDTO, DownloadedSubItem>()
Expand Down
1 change: 1 addition & 0 deletions src/BiliLite.UWP/Extensions/ViewModelExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public static IServiceCollection AddViewModels(this IServiceCollection services)
services.AddTransient<PlaySettingsControlViewModel>();
services.AddTransient<VideoDanmakuSettingsControlViewModel>();
services.AddTransient<ShortcutKeySettingsControlViewModel>();
services.AddTransient<DevSettingsControlViewModel>();
services.AddTransient<MainPageViewModel>();
return services;
}
Expand Down
9 changes: 9 additions & 0 deletions src/BiliLite.UWP/Models/Common/Enumerates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ public enum LogType
Necessary,
}

public enum HttpMethods
{
Get,
Post,
Put,
Patch,
Delete,
}

public enum LoginStatus
{
/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions src/BiliLite.UWP/Models/Common/SettingConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1063,6 +1063,8 @@ public class Other
public const string DEFAULT_REQUEST_BUILD = "75900200";

public const string SQL_DB_VERSION = "SqlDbVersion";

public const string PLUGIN_LIST = "PluginList";
}
}
}
Loading

0 comments on commit d49e8a5

Please sign in to comment.