diff --git a/document/install-readme.md b/document/install-readme.md
index 4b6a29a83..ad9cf851c 100644
--- a/document/install-readme.md
+++ b/document/install-readme.md
@@ -46,7 +46,7 @@

-3. 执行命令`Set-ExecutionPolicy -ExecutionPolicy RemoteSigned`并按Y键启用脚本执行权限
+3. 执行命令`Set-ExecutionPolicy -ExecutionPolicy RemoteSigned`并按Y键启用脚本执行权限, 如果执行命令后无任何输出表示执行成功可以进入下一步运行安装脚本
### 运行安装脚本
diff --git a/document/new_version.json b/document/new_version.json
index d638c47f8..af08b6388 100644
--- a/document/new_version.json
+++ b/document/new_version.json
@@ -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"
}
diff --git a/src/BiliLite.UWP/BiliLite.UWP.csproj b/src/BiliLite.UWP/BiliLite.UWP.csproj
index 3aafeb4f8..2df7599c6 100644
--- a/src/BiliLite.UWP/BiliLite.UWP.csproj
+++ b/src/BiliLite.UWP/BiliLite.UWP.csproj
@@ -271,9 +271,11 @@
+
+
@@ -281,6 +283,7 @@
+
@@ -1555,10 +1558,7 @@
1.4.3
-
- 107.3.0
-
-
+
2.0.2
@@ -1567,6 +1567,9 @@
0.17.0
+
+ 0.15.2
+
1.26.0
@@ -1593,6 +1596,7 @@
+
diff --git a/src/BiliLite.UWP/Controls/DataTemplateSelectors/UserDynamicItemV2DataTemplateSelector.cs b/src/BiliLite.UWP/Controls/DataTemplateSelectors/UserDynamicItemV2DataTemplateSelector.cs
index 6147bf51d..0cfdf576e 100644
--- a/src/BiliLite.UWP/Controls/DataTemplateSelectors/UserDynamicItemV2DataTemplateSelector.cs
+++ b/src/BiliLite.UWP/Controls/DataTemplateSelectors/UserDynamicItemV2DataTemplateSelector.cs
@@ -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;
diff --git a/src/BiliLite.UWP/Controls/PlayerControl.xaml.cs b/src/BiliLite.UWP/Controls/PlayerControl.xaml.cs
index 3b0dac44a..eccd935bf 100644
--- a/src/BiliLite.UWP/Controls/PlayerControl.xaml.cs
+++ b/src/BiliLite.UWP/Controls/PlayerControl.xaml.cs
@@ -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;
diff --git a/src/BiliLite.UWP/Controls/Settings/DevSettingsControl.xaml b/src/BiliLite.UWP/Controls/Settings/DevSettingsControl.xaml
index ed02549fc..2d8bf9764 100644
--- a/src/BiliLite.UWP/Controls/Settings/DevSettingsControl.xaml
+++ b/src/BiliLite.UWP/Controls/Settings/DevSettingsControl.xaml
@@ -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">
@@ -66,6 +67,12 @@
+
+
+
+
+
+
@@ -133,5 +140,45 @@
DisplayMemberPath="Name">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/BiliLite.UWP/Controls/Settings/DevSettingsControl.xaml.cs b/src/BiliLite.UWP/Controls/Settings/DevSettingsControl.xaml.cs
index 9a1390502..c500a79ed 100644
--- a/src/BiliLite.UWP/Controls/Settings/DevSettingsControl.xaml.cs
+++ b/src/BiliLite.UWP/Controls/Settings/DevSettingsControl.xaml.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.ObjectModel;
using System.Threading.Tasks;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
@@ -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 上介绍了“用户控件”项模板
@@ -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();
+ m_mapper = App.ServiceProvider.GetRequiredService();
+ m_pluginService = App.ServiceProvider.GetRequiredService();
+ m_viewModel.Plugins =
+ m_mapper.Map>(m_pluginService.GetPlugins());
this.InitializeComponent();
LoadDev();
}
@@ -217,5 +233,30 @@ private async void BtnMigrateDb_OnClick(object sender, RoutedEventArgs e)
var migrateService = App.ServiceProvider.GetRequiredService();
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(text);
+ await m_pluginService.AddPlugin(plugin);
+ m_viewModel.AddPlugin(m_mapper.Map(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);
+ }
}
}
diff --git a/src/BiliLite.UWP/Extensions/ApiModelExtensions.cs b/src/BiliLite.UWP/Extensions/ApiModelExtensions.cs
index ee85e3294..0da00685a 100644
--- a/src/BiliLite.UWP/Extensions/ApiModelExtensions.cs
+++ b/src/BiliLite.UWP/Extensions/ApiModelExtensions.cs
@@ -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;
@@ -18,7 +19,7 @@ public static class ApiModelExtensions
public static async Task 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)
{
diff --git a/src/BiliLite.UWP/Extensions/FileExtensions.cs b/src/BiliLite.UWP/Extensions/FileExtensions.cs
index 9544f5232..05e365503 100644
--- a/src/BiliLite.UWP/Extensions/FileExtensions.cs
+++ b/src/BiliLite.UWP/Extensions/FileExtensions.cs
@@ -23,5 +23,19 @@ public static async Task GetExportFile(string fileTypeChoiceKey, st
var file = await savePicker.PickSaveFileAsync();
return file;
}
+
+ public static async Task CheckFileExist(this string path)
+ {
+ try
+ {
+ var file = await StorageFile.GetFileFromPathAsync(path);
+ return file != null;
+ }
+ catch (Exception)
+ {
+ // 如果文件不存在或者路径无效,将捕获异常
+ return false;
+ }
+ }
}
}
diff --git a/src/BiliLite.UWP/Extensions/MapperExtensions.cs b/src/BiliLite.UWP/Extensions/MapperExtensions.cs
index 818faf469..8c7df82f0 100644
--- a/src/BiliLite.UWP/Extensions/MapperExtensions.cs
+++ b/src/BiliLite.UWP/Extensions/MapperExtensions.cs
@@ -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;
@@ -46,6 +47,8 @@ public static IServiceCollection AddMapper(this IServiceCollection services)
{
var mapper = new Mapper(new MapperConfiguration(expression =>
{
+ expression.CreateMap()
+ .ReverseMap();
expression.CreateMap()
.ReverseMap();
expression.CreateMap()
diff --git a/src/BiliLite.UWP/Extensions/ViewModelExtensions.cs b/src/BiliLite.UWP/Extensions/ViewModelExtensions.cs
index 0af4875fa..8cd58aa53 100644
--- a/src/BiliLite.UWP/Extensions/ViewModelExtensions.cs
+++ b/src/BiliLite.UWP/Extensions/ViewModelExtensions.cs
@@ -51,6 +51,7 @@ public static IServiceCollection AddViewModels(this IServiceCollection services)
services.AddTransient();
services.AddTransient();
services.AddTransient();
+ services.AddTransient();
services.AddTransient();
return services;
}
diff --git a/src/BiliLite.UWP/Models/Common/Enumerates.cs b/src/BiliLite.UWP/Models/Common/Enumerates.cs
index ffc92e0a0..5619ef65e 100644
--- a/src/BiliLite.UWP/Models/Common/Enumerates.cs
+++ b/src/BiliLite.UWP/Models/Common/Enumerates.cs
@@ -11,6 +11,15 @@ public enum LogType
Necessary,
}
+ public enum HttpMethods
+ {
+ Get,
+ Post,
+ Put,
+ Patch,
+ Delete,
+ }
+
public enum LoginStatus
{
///
diff --git a/src/BiliLite.UWP/Models/Common/SettingConstants.cs b/src/BiliLite.UWP/Models/Common/SettingConstants.cs
index e8390fa7e..18e3cf0ba 100644
--- a/src/BiliLite.UWP/Models/Common/SettingConstants.cs
+++ b/src/BiliLite.UWP/Models/Common/SettingConstants.cs
@@ -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";
}
}
}
diff --git a/src/BiliLite.UWP/Models/Requests/Api/AccountApi.cs b/src/BiliLite.UWP/Models/Requests/Api/AccountApi.cs
index 1e32f484b..1ac1e6832 100644
--- a/src/BiliLite.UWP/Models/Requests/Api/AccountApi.cs
+++ b/src/BiliLite.UWP/Models/Requests/Api/AccountApi.cs
@@ -24,7 +24,7 @@ public ApiModel GetKey()
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = "https://passport.bilibili.com/x/passport-login/web/key"
};
return api;
@@ -38,7 +38,7 @@ public ApiModel LoginV2(string username, string password, string captcha = "", A
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = "https://passport.bilibili.com/api/oauth2/login",
body = $"username={Uri.EscapeDataString(username)}&password={Uri.EscapeDataString(password)}{(captcha == "" ? "" : "&captcha=" + captcha)}&" + ApiHelper.MustParameter(appKey)
};
@@ -54,7 +54,7 @@ public ApiModel LoginV3(string username, string password, ApiKeyInfo appKey)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = "https://passport.bilibili.com/x/passport-login/oauth2/login",
body = $"actionKey=appkey&channel=bili&device=phone&permission=ALL&subid=1&username={Uri.EscapeDataString(username)}&password={Uri.EscapeDataString(password)}&" + ApiHelper.MustParameter(appKey),
headers = ApiHelper.MustHeader(appKey),
@@ -71,7 +71,7 @@ public ApiModel Country()
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = "https://passport.bilibili.com/x/passport-login/country",
parameter = ApiHelper.MustParameter(AppKey)
};
@@ -83,7 +83,7 @@ public ApiModel SendSMS(string cid, string phone, string sessionId, ApiKeyInfo a
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = "https://passport.bilibili.com/x/passport-login/sms/send",
body = $"actionKey=appkey&cid={cid}&tel={phone}&login_session_id={sessionId}&" + ApiHelper.MustParameter(appKey),
headers = ApiHelper.MustHeader(appKey),
@@ -101,7 +101,7 @@ public ApiModel SendSMSWithCaptcha(string cid, string phone, string session_id,
var buvid = ApiHelper.GetBuvid();
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = "https://passport.bilibili.com/x/passport-login/sms/send",
body = $"buvid={buvid}&actionKey=appkey&cid={cid}&tel={phone}&login_session_id={session_id}&gee_seccode={seccode}&gee_validate={validate}&gee_challenge={challenge}&recaptcha_token={recaptchaToken}&" + ApiHelper.MustParameter(appKey),
headers = ApiHelper.MustHeader(appKey),
@@ -114,7 +114,7 @@ public ApiModel SMSLogin(string cid, string phone, string code, string sessionId
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = "https://passport.bilibili.com/x/passport-login/login/sms",
body = $"actionKey=appkey&cid={cid}&tel={phone}&login_session_id={sessionId}&captcha_key={captchaKey}&code={code}&" + ApiHelper.MustParameter(appKey),
headers = ApiHelper.MustHeader(appKey),
@@ -132,7 +132,7 @@ public ApiModel SSO(string accessKey)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://passport.bilibili.com/api/login/sso",
parameter = ApiHelper.MustParameter(AppKey, false) + $"&access_key={accessKey}",
headers = ApiHelper.GetDefaultHeaders()
@@ -149,7 +149,7 @@ public ApiModel Captcha()
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = "https://passport.bilibili.com/captcha",
headers = ApiHelper.GetDefaultHeaders(),
parameter = $"ts={TimeExtensions.GetTimestampS()}"
@@ -165,7 +165,7 @@ public ApiModel GeetestCaptcha()
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = "https://passport.bilibili.com/x/safecenter/captcha/pre"
};
return api;
@@ -179,7 +179,7 @@ public ApiModel FetchHideTel(string tmp_token)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = "https://api.bilibili.com/x/safecenter/user/info",
parameter = $"tmp_code={tmp_token}"
};
@@ -194,7 +194,7 @@ public ApiModel SendVerifySMS(string tmp_token, string recaptcha_token, string g
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = "https://passport.bilibili.com/x/safecenter/common/sms/send",
body = $"sms_type=loginTelCheck&tmp_code={tmp_token}&recaptcha_token={recaptcha_token}&gee_challenge={gee_challenge}&gee_gt={gee_gt}&gee_validate={geetest_validate}&gee_seccode={geetest_seccode}"
};
@@ -209,7 +209,7 @@ public ApiModel SubmitPwdLoginSMSCheck(string code, string tmp_token, string req
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = "https://passport.bilibili.com/x/safecenter/login/tel/verify",
body = $"type=loginTelCheck&code={code}&tmp_code={tmp_token}&request_id={request_id}&captcha_key={captcha_key}"
};
@@ -224,7 +224,7 @@ public ApiModel PwdLoginExchangeCookie(string code)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = "https://passport.bilibili.com/x/passport-login/web/exchange_cookie",
body = $"code={code}"
};
@@ -239,7 +239,7 @@ public ApiModel UserProfile()
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = "https://app.bilibili.com/x/v2/account/myinfo",
parameter = ApiHelper.MustParameter(AppKey, true)
};
@@ -256,7 +256,7 @@ public ApiModel MineProfile()
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = "https://app.bilibili.com/x/v2/account/mine",
parameter = ApiHelper.MustParameter(AppKey, true)
};
@@ -272,7 +272,7 @@ public ApiModel Space(string mid)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = "http://app.biliapi.net/x/v2/space",
parameter = ApiHelper.MustParameter(AppKey, true) + $"&vmid={mid}"
};
@@ -284,7 +284,7 @@ public ApiModel History(int pn = 1, int ps = 24)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/v2/history",
parameter = ApiHelper.MustParameter(AppKey, true) + $"&pn={pn}&ps={ps}"
};
@@ -304,7 +304,7 @@ public ApiModel HistoryWbi(HistoryCursor cursor)
}
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/web-interface/history/cursor",
parameter = $"max={cursor.Max}&view_at={cursor.ViewAt}&business=",
need_cookie = true,
@@ -317,7 +317,7 @@ public ApiModel SearchHistory(string keyword, int page)
var kw = keyword.UrlEncode();
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/web-goblin/history/search",
parameter = $"pn={page}&ps=20&keyword={kw}&business=all",
need_cookie = true,
@@ -329,7 +329,7 @@ public ApiModel DelHistory(string id)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/v2/history/delete",
body = ApiHelper.MustParameter(AppKey, true) + $"&kid={id}"
};
@@ -346,7 +346,7 @@ public ApiModel QRLoginAuthCodeTV(string local_id, ApiKeyInfo appkey)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = "https://passport.bilibili.com/x/passport-tv-login/qrcode/auth_code",
body = $"appkey={appkey.Appkey}&local_id={local_id}&ts={TimeExtensions.GetTimestampS()}&mobi_app=ios",
headers = ApiHelper.MustHeader(appkey),
@@ -364,7 +364,7 @@ public ApiModel QRLoginPollTV(string auth_code, string local_id, ApiKeyInfo appk
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = "https://passport.bilibili.com/x/passport-tv-login/qrcode/poll",
body = $"appkey={appkey.Appkey}&auth_code={auth_code}&local_id={local_id}&ts={TimeExtensions.GetTimestampS()}&mobi_app=ios",
headers = ApiHelper.MustHeader(appkey),
@@ -381,7 +381,7 @@ public ApiModel QRLoginAuthCode()
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = "https://passport.bilibili.com/x/passport-login/web/qrcode/generate",
};
return api;
@@ -396,7 +396,7 @@ public ApiModel QRLoginPoll(string auth_code)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = "https://passport.bilibili.com/x/passport-login/web/qrcode/poll",
parameter = $"qrcode_key={auth_code}"
};
@@ -412,7 +412,7 @@ public ApiModel GetCookieToAccessKey(ApiKeyInfo appKey)
var apiBody = "api=http://link.acg.tv/forum.php";
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = "https://passport.bilibili.com/login/app/third",
parameter = $"appkey={appKey.Appkey}&{apiBody}",
need_cookie = true,
@@ -429,7 +429,7 @@ public ApiModel GetCookieToAccessKey(string url)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = url,
need_cookie = true,
need_redirect = true,
@@ -445,7 +445,7 @@ public ApiModel GetOAuth2Info()
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = "https://passport.bilibili.com/api/oauth2/info",
parameter = ApiHelper.MustParameter(AppKey) + "&access_token=" + SettingService.Account.AccessKey
};
@@ -461,7 +461,7 @@ public ApiModel RefreshToken(ApiKeyInfo appKey)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = "https://passport.bilibili.com/api/oauth2/refreshToken",
body = ApiHelper.MustParameter(appKey) + $"&access_token={SettingService.Account.AccessKey}&refresh_token={SettingService.GetValue(SettingConstants.Account.REFRESH_KEY, "")}"
};
@@ -478,7 +478,7 @@ public ApiModel CheckCookies()
var csrf = m_cookieService.GetCSRFToken();
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = "https://passport.bilibili.com/x/passport-login/web/cookie/info",
parameter = $"csrf={csrf}",
need_cookie = true,
@@ -494,7 +494,7 @@ public ApiModel RefreshCsrf(string correspondPath)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://www.bilibili.com/correspond/1/{correspondPath}",
need_cookie = true,
};
@@ -510,7 +510,7 @@ public ApiModel RefreshCookie(string refreshCsrf,string refreshToken)
var csrf = m_cookieService.GetCSRFToken();
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"https://passport.bilibili.com/x/passport-login/web/cookie/refresh",
body = $"csrf={csrf}&refresh_csrf={refreshCsrf}&source=main_web&refresh_token={refreshToken}",
need_cookie = true,
@@ -527,7 +527,7 @@ public ApiModel ConfirmRefreshCookie(string refreshToken)
var csrf = m_cookieService.GetCSRFToken();
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"https://passport.bilibili.com/x/passport-login/web/confirm/refresh",
body = $"csrf={csrf}&refresh_token={refreshToken}",
need_cookie = true,
@@ -539,7 +539,7 @@ public ApiModel Nav()
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = "https://api.bilibili.com/x/web-interface/nav"
};
return api;
@@ -549,7 +549,7 @@ public ApiModel Buvid()
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = "https://api.bilibili.com/x/web-frontend/getbuvid"
};
return api;
@@ -559,7 +559,7 @@ public ApiModel Buvid4()
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = "https://api.bilibili.com/x/frontend/finger/spi"
};
return api;
@@ -569,7 +569,7 @@ public ApiModel BNut()
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = "https://www.bilibili.com/",
need_cookie = true,
};
@@ -583,7 +583,7 @@ public ApiModel BiliTicket()
var hexSign = ApiHelper.GetHMACSHA256("XgwSnGZ1p", $"ts{ts}");
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = "https://api.bilibili.com/bapis/bilibili.api.ticket.v1.Ticket/GenWebTicket",
parameter= $"key_id=ec02&hexsign={hexSign}&context[ts]={ts}&csrf={csrf}",
need_cookie = true,
@@ -596,7 +596,7 @@ public ApiModel CaptchaRegister(string voucher)
var csrf = m_cookieService.GetCSRFToken();
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = "https://api.bilibili.com/x/gaia-vgate/v1/register",
body = $"csrf={csrf}&v_voucher={voucher}",
need_cookie = true,
diff --git a/src/BiliLite.UWP/Models/Requests/Api/CommentApi.cs b/src/BiliLite.UWP/Models/Requests/Api/CommentApi.cs
index fc9cd8fa1..2bc10148c 100644
--- a/src/BiliLite.UWP/Models/Requests/Api/CommentApi.cs
+++ b/src/BiliLite.UWP/Models/Requests/Api/CommentApi.cs
@@ -46,7 +46,7 @@ public ApiModel Comment(string oid, CommentSort sort, int pn, int type, int ps =
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/v2/reply",
parameter = $"oid={oid}&plat=2&pn={pn}&ps={ps}&sort={(int)sort}&type={type}",
need_cookie = true,
@@ -76,7 +76,7 @@ public ApiModel CommentV2(string oid, CommentSort sort, int pn, int type, int ps
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/v2/reply/main",
parameter = $"oid={oid}&ps={ps}&mode={mode}&type={type}&csrf={csrf}&pagination_str={paginationStr}",
need_cookie = true,
@@ -89,7 +89,7 @@ public ApiModel Reply(string oid, string root, int pn, int type, int ps = 30)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/v2/reply/reply",
parameter = $"oid={oid}&plat=2&pn={pn}&ps={ps}&root={root}&type={type}",
need_cookie = true,
@@ -103,7 +103,7 @@ public ApiModel Like(string oid, string root, int action, int type)
var csrf = m_cookieService.GetCSRFToken();
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/v2/reply/action",
body = $"&oid={oid}&rpid={root}&action={action}&type={type}&csrf={csrf}",
need_cookie = true,
@@ -117,7 +117,7 @@ public ApiModel ReplyComment(string oid, string root, string parent, string mess
var csrf = m_cookieService.GetCSRFToken();
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/v2/reply/add",
body = $"&oid={oid}&root={root}&parent={parent}&type={type}&message={message}&csrf={csrf}",
need_cookie = true,
@@ -131,7 +131,7 @@ public ApiModel DeleteComment(string oid, string rpid, int type)
var csrf = m_cookieService.GetCSRFToken();
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/v2/reply/del",
body = $"&oid={oid}&rpid={rpid}&type={type}&csrf={csrf}",
need_cookie = true,
@@ -145,7 +145,7 @@ public ApiModel AddComment(string oid, CommentType type, string message, List()
{
diff --git a/src/BiliLite.UWP/Models/Requests/Api/EmoteApi.cs b/src/BiliLite.UWP/Models/Requests/Api/EmoteApi.cs
index fb854adb7..8f4befa1c 100644
--- a/src/BiliLite.UWP/Models/Requests/Api/EmoteApi.cs
+++ b/src/BiliLite.UWP/Models/Requests/Api/EmoteApi.cs
@@ -1,4 +1,5 @@
-using BiliLite.Services;
+using BiliLite.Models.Common;
+using BiliLite.Services;
namespace BiliLite.Models.Requests.Api
{
@@ -21,7 +22,7 @@ public ApiModel UserEmote(EmoteBusiness business)
var type = business.ToString();
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/emote/user/panel/web",
parameter = ApiHelper.MustParameter(AppKey) + $"&business={type}",
headers = ApiHelper.GetAuroraHeaders(),
diff --git a/src/BiliLite.UWP/Models/Requests/Api/GitApi.cs b/src/BiliLite.UWP/Models/Requests/Api/GitApi.cs
index 4a6cdeb5b..cc001cf24 100644
--- a/src/BiliLite.UWP/Models/Requests/Api/GitApi.cs
+++ b/src/BiliLite.UWP/Models/Requests/Api/GitApi.cs
@@ -17,7 +17,7 @@ public ApiModel CheckUpdate()
updateJsonAddress = updateJsonAddress.Replace("\"", ""); // 解决取出的值有奇怪的转义符
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{updateJsonAddress}/document/new_version.json",
parameter = $"ts={TimeExtensions.GetTimestampS()}"
};
@@ -32,7 +32,7 @@ public ApiModel FindMoreEntrance()
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{ApiHelper.GIT_RAW_URL}/document/entrance.json",
parameter = $"ts={TimeExtensions.GetTimestampS()}"
};
diff --git a/src/BiliLite.UWP/Models/Requests/Api/Home/AnimeAPI.cs b/src/BiliLite.UWP/Models/Requests/Api/Home/AnimeAPI.cs
index ddd170e8b..6526100a7 100644
--- a/src/BiliLite.UWP/Models/Requests/Api/Home/AnimeAPI.cs
+++ b/src/BiliLite.UWP/Models/Requests/Api/Home/AnimeAPI.cs
@@ -10,7 +10,7 @@ public ApiModel BangumiHome()
var baseUrl = SettingService.GetValue(SettingConstants.Other.BILI_LITE_WEB_API_BASE_URL, ApiConstants.BILI_LITE_WEB_API_DEFAULT_BASE_URL);
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{baseUrl}api/anime/bangumi"
};
return api;
@@ -21,7 +21,7 @@ public ApiModel GuochuangHome()
var baseUrl = SettingService.GetValue(SettingConstants.Other.BILI_LITE_WEB_API_BASE_URL, ApiConstants.BILI_LITE_WEB_API_DEFAULT_BASE_URL);
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{baseUrl}api/anime/guochuang"
};
return api;
@@ -32,7 +32,7 @@ public ApiModel Timeline(int type)
var baseUrl = SettingService.GetValue(SettingConstants.Other.BILI_LITE_WEB_API_BASE_URL, ApiConstants.BILI_LITE_WEB_API_DEFAULT_BASE_URL);
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{baseUrl}api/anime/timeline",
parameter = "type=" + type
};
@@ -44,7 +44,7 @@ public ApiModel AnimeFallMore(int wid, long cursor = 0)
var baseUrl = SettingService.GetValue(SettingConstants.Other.BILI_LITE_WEB_API_BASE_URL, ApiConstants.BILI_LITE_WEB_API_DEFAULT_BASE_URL);
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{baseUrl}api/anime/bangumiFalls",
parameter = $"wid={wid}&cursor={cursor}"
};
diff --git a/src/BiliLite.UWP/Models/Requests/Api/Home/CinemaAPI.cs b/src/BiliLite.UWP/Models/Requests/Api/Home/CinemaAPI.cs
index b7d2e932e..5c1747eb6 100644
--- a/src/BiliLite.UWP/Models/Requests/Api/Home/CinemaAPI.cs
+++ b/src/BiliLite.UWP/Models/Requests/Api/Home/CinemaAPI.cs
@@ -10,7 +10,7 @@ public ApiModel CinemaHome()
var baseUrl = SettingService.GetValue(SettingConstants.Other.BILI_LITE_WEB_API_BASE_URL, ApiConstants.BILI_LITE_WEB_API_DEFAULT_BASE_URL);
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{baseUrl}api/cinema/home"
};
return api;
@@ -20,7 +20,7 @@ public ApiModel CinemaFallMore(int wid, long cursor = 0)
var baseUrl = SettingService.GetValue(SettingConstants.Other.BILI_LITE_WEB_API_BASE_URL, ApiConstants.BILI_LITE_WEB_API_DEFAULT_BASE_URL);
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{baseUrl}api/cinema/falls",
parameter = $"wid={wid}&cursor={cursor}"
};
diff --git a/src/BiliLite.UWP/Models/Requests/Api/Home/HotApi.cs b/src/BiliLite.UWP/Models/Requests/Api/Home/HotApi.cs
index ca62e3ec3..2e2d0ac7b 100644
--- a/src/BiliLite.UWP/Models/Requests/Api/Home/HotApi.cs
+++ b/src/BiliLite.UWP/Models/Requests/Api/Home/HotApi.cs
@@ -1,4 +1,5 @@
-using BiliLite.Services;
+using BiliLite.Models.Common;
+using BiliLite.Services;
namespace BiliLite.Models.Requests.Api.Home
{
@@ -8,7 +9,7 @@ public ApiModel Popular(string idx = "0", string last_param = "")
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://app.bilibili.com/x/v2/show/popular/index",
parameter = ApiHelper.MustParameter(AppKey, true) + $"&idx={idx}&last_param={last_param}"
};
diff --git a/src/BiliLite.UWP/Models/Requests/Api/Home/LiveAPI.cs b/src/BiliLite.UWP/Models/Requests/Api/Home/LiveAPI.cs
index 365a55e08..2cd93b3fa 100644
--- a/src/BiliLite.UWP/Models/Requests/Api/Home/LiveAPI.cs
+++ b/src/BiliLite.UWP/Models/Requests/Api/Home/LiveAPI.cs
@@ -1,4 +1,5 @@
-using BiliLite.Services;
+using BiliLite.Models.Common;
+using BiliLite.Services;
namespace BiliLite.Models.Requests.Api.Home
{
@@ -8,7 +9,7 @@ public ApiModel LiveHome()
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = "https://api.live.bilibili.com/xlive/app-interface/v2/index/getAllList",
parameter = ApiHelper.MustParameter(AppKey, true) + "&device=android&rec_page=1&relation_page=1&scale=xxhdpi",
};
@@ -21,7 +22,7 @@ public ApiModel LiveHomeItems()
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = "https://api.live.bilibili.com/xlive/web-interface/v1/index/getList",
parameter = "platform=web"
};
diff --git a/src/BiliLite.UWP/Models/Requests/Api/Home/RecommendAPI.cs b/src/BiliLite.UWP/Models/Requests/Api/Home/RecommendAPI.cs
index b47a811d0..ee53a0cdd 100644
--- a/src/BiliLite.UWP/Models/Requests/Api/Home/RecommendAPI.cs
+++ b/src/BiliLite.UWP/Models/Requests/Api/Home/RecommendAPI.cs
@@ -1,4 +1,5 @@
-using BiliLite.Services;
+using BiliLite.Models.Common;
+using BiliLite.Services;
namespace BiliLite.Models.Requests.Api.Home
{
@@ -8,7 +9,7 @@ public ApiModel Recommend(string idx = "0")
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://app.bilibili.com/x/v2/feed/index",
parameter = ApiHelper.MustParameter(AppKey, true) + $"&flush=0&idx={idx}&login_event=2&network=wifi&open_event=&pull={(idx == "0").ToString().ToLower()}&qn=32&style=2",
headers = ApiHelper.GetAuroraHeaders()
@@ -21,7 +22,7 @@ public ApiModel Dislike(RecommondFeedbackParams feedbackParams)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://app.biliapi.net/x/feed/dislike",
parameter = ApiHelper.MustParameter(AppKey, true)
+ $"&goto={feedbackParams.GoTo}&id={feedbackParams.Id}&mid={feedbackParams.Mid}&reason_id={feedbackParams.ReasonId}&rid={feedbackParams.Rid}&tag_id={feedbackParams.TagId}"
@@ -33,7 +34,7 @@ public ApiModel Feedback(RecommondFeedbackParams feedbackParams)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://app.biliapi.net/x/feed/dislike",
parameter = ApiHelper.MustParameter(AppKey, true) +
$"&goto={feedbackParams.GoTo}&id={feedbackParams.Id}&mid={feedbackParams.Mid}&feedback_id={feedbackParams.ReasonId}&rid={feedbackParams.Rid}&tag_id={feedbackParams.TagId}"
diff --git a/src/BiliLite.UWP/Models/Requests/Api/Live/LiveAreaAPI.cs b/src/BiliLite.UWP/Models/Requests/Api/Live/LiveAreaAPI.cs
index d8a4390da..f5e9112d1 100644
--- a/src/BiliLite.UWP/Models/Requests/Api/Live/LiveAreaAPI.cs
+++ b/src/BiliLite.UWP/Models/Requests/Api/Live/LiveAreaAPI.cs
@@ -1,4 +1,5 @@
-using BiliLite.Services;
+using BiliLite.Models.Common;
+using BiliLite.Services;
namespace BiliLite.Models.Requests.Api.Live
{
@@ -8,7 +9,7 @@ public ApiModel LiveAreaList()
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://api.live.bilibili.com/room/v1/Area/getList",
parameter = ApiHelper.MustParameter(AppKey, true) + $"&actionKey=appkey&need_entrance=1&parent_id=0"
};
@@ -20,7 +21,7 @@ public ApiModel LiveAreaRoomList(int area_id = 0, int parent_area_id = 0, int pa
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://api.live.bilibili.com/room/v3/Area/getRoomList",
parameter = ApiHelper.MustParameter(AppKey, true) + $"&actionKey=appkey&area_id={area_id}&cate_id=0&parent_area_id={parent_area_id}&page={page}&page_size=36&sort_type={sort_type}"
};
diff --git a/src/BiliLite.UWP/Models/Requests/Api/Live/LiveCenterAPI.cs b/src/BiliLite.UWP/Models/Requests/Api/Live/LiveCenterAPI.cs
index 1f4c4adba..8fefdf486 100644
--- a/src/BiliLite.UWP/Models/Requests/Api/Live/LiveCenterAPI.cs
+++ b/src/BiliLite.UWP/Models/Requests/Api/Live/LiveCenterAPI.cs
@@ -1,4 +1,5 @@
-using BiliLite.Services;
+using BiliLite.Models.Common;
+using BiliLite.Services;
namespace BiliLite.Models.Requests.Api.Live
{
@@ -8,7 +9,7 @@ public ApiModel FollowLive()
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = "https://api.live.bilibili.com/xlive/app-interface/v1/relation/liveAnchor",
parameter = ApiHelper.MustParameter(AppKey, true) + "&qn=0&sortRule=0&filterRule=0",
};
@@ -20,7 +21,7 @@ public ApiModel FollowUnLive(int page)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = "https://api.live.bilibili.com/xlive/app-interface/v1/relation/unliveAnchor",
parameter = ApiHelper.MustParameter(AppKey, true) + $"&page={page}&pagesize=30",
};
@@ -32,7 +33,7 @@ public ApiModel History(int page)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = "https://app.bilibili.com/x/v2/history/liveList",
parameter = ApiHelper.MustParameter(AppKey, true) + $"&pn={page}&ps=20",
};
@@ -44,7 +45,7 @@ public ApiModel SignInfo()
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = "https://api.live.bilibili.com/rc/v2/Sign/getSignInfo",
parameter = ApiHelper.MustParameter(AppKey, true) + "&actionKey=appkey",
};
@@ -56,7 +57,7 @@ public ApiModel DoSign()
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://api.live.bilibili.com/rc/v1/Sign/doSign",
parameter = ApiHelper.MustParameter(AppKey, true) + "&actionKey=appkey"
};
diff --git a/src/BiliLite.UWP/Models/Requests/Api/Live/LiveRecommendAPI.cs b/src/BiliLite.UWP/Models/Requests/Api/Live/LiveRecommendAPI.cs
index 85e967efd..564b912ef 100644
--- a/src/BiliLite.UWP/Models/Requests/Api/Live/LiveRecommendAPI.cs
+++ b/src/BiliLite.UWP/Models/Requests/Api/Live/LiveRecommendAPI.cs
@@ -1,4 +1,5 @@
-using BiliLite.Services;
+using BiliLite.Models.Common;
+using BiliLite.Services;
namespace BiliLite.Models.Requests.Api.Live
{
@@ -14,7 +15,7 @@ public ApiModel LiveRoomList(int page = 1, string sort_type = "online")
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://api.live.bilibili.com/room/v3/Area/getRoomList",
parameter = ApiHelper.MustParameter(AppKey, true) + $"&actionKey=appkey&area_id=0&cate_id=0&parent_area_id=0&page={page}&page_size=36&sort_type={sort_type}"
};
diff --git a/src/BiliLite.UWP/Models/Requests/Api/Live/LiveRoomAPI.cs b/src/BiliLite.UWP/Models/Requests/Api/Live/LiveRoomAPI.cs
index 4a4e7456a..bdff23e0c 100644
--- a/src/BiliLite.UWP/Models/Requests/Api/Live/LiveRoomAPI.cs
+++ b/src/BiliLite.UWP/Models/Requests/Api/Live/LiveRoomAPI.cs
@@ -3,6 +3,7 @@
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
+using BiliLite.Models.Common;
namespace BiliLite.Models.Requests.Api.Live
{
@@ -24,7 +25,7 @@ public ApiModel LiveRoomInfo(string roomid)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://api.live.bilibili.com/xlive/app-room/v1/index/getInfoByRoom",
parameter = ApiHelper.MustParameter(AppKey, true) + $"&actionKey=appkey&room_id={roomid}&device=android"
};
@@ -39,7 +40,7 @@ public ApiModel MyWallet()
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://api.live.bilibili.com/pay/v2/Pay/myWallet",
parameter = ApiHelper.MustParameter(AppKey, true) + $"&actionKey=appkey"
};
@@ -55,7 +56,7 @@ public ApiModel LiveTitles()
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://api.live.bilibili.com/rc/v1/Title/getTitle",
parameter = ApiHelper.MustParameter(AppKey, true) + $"&actionKey=appkey"
};
@@ -71,7 +72,7 @@ public ApiModel GiftList(int area_v2_id, int area_v2_parent_id, int roomId)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://api.live.bilibili.com/gift/v4/Live/giftConfig",
parameter = ApiHelper.MustParameter(AppKey, true) + $"&actionKey=appkey&area_v2_id={area_v2_id}&area_v2_parent_id={area_v2_parent_id}&roomid={roomId}"
};
@@ -87,7 +88,7 @@ public ApiModel BagList(int roomId)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://api.live.bilibili.com/xlive/app-room/v1/gift/bag_list",
parameter = ApiHelper.MustParameter(AppKey, true) + $"&actionKey=appkey&roomid={roomId}"
};
@@ -103,7 +104,7 @@ public ApiModel RoomGifts(int area_v2_id, int area_v2_parent_id, int roomId)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://api.live.bilibili.com/gift/v3/live/room_gift_list",
parameter = ApiHelper.MustParameter(AppKey, true) + $"&actionKey=appkey&area_v2_id={area_v2_id}&area_v2_parent_id={area_v2_parent_id}&roomid={roomId}"
};
@@ -119,7 +120,7 @@ public ApiModel FreeSilverTime()
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://api.live.bilibili.com/mobile/freeSilverCurrentTask",
parameter = ApiHelper.MustParameter(AppKey, true) + $"&actionKey=appkey"
};
@@ -134,7 +135,7 @@ public ApiModel GetFreeSilver()
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://api.live.bilibili.com/mobile/freeSilverAward",
parameter = ApiHelper.MustParameter(AppKey, true) + $"&actionKey=appkey"
};
@@ -150,7 +151,7 @@ public ApiModel SendBagGift(long ruid, int giftId, int num, int bagId, int roomI
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"https://api.live.bilibili.com/xlive/revenue/v1/gift/sendBag",
body = ApiHelper.MustParameter(AppKey, true) + $"&actionKey=appkey",
need_cookie = true,
@@ -168,7 +169,7 @@ public ApiModel SendGift(long ruid, int giftId, string coinType, int num, int ro
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"https://api.live.bilibili.com/xlive/revenue/v1/gift/send{char.ToUpper(coinType[0]) + coinType.Substring(1)}",
body = ApiHelper.MustParameter(AppKey, true) + $"&actionKey=appkey",
need_cookie = true,
@@ -187,7 +188,7 @@ public ApiModel SendDanmu(string text, int roomId)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"https://api.live.bilibili.com/api/sendmsg",
parameter = ApiHelper.MustParameter(AppKey, true) + $"&actionKey=appkey",
};
@@ -204,7 +205,7 @@ public ApiModel AnchorProfile(long uid)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://api.live.bilibili.com/live_user/v1/card/card_up",
parameter = ApiHelper.MustParameter(AppKey, true) + $"&actionKey=appkey&uid={uid}",
};
@@ -224,7 +225,7 @@ public ApiModel GuardList(long ruid, int roomId, int page)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://api.live.bilibili.com/xlive/app-room/v1/guardTab/topList",
parameter = ApiHelper.MustParameter(AppKey, true) + $"&actionKey=appkey&page={page}&page_size=20&roomid={roomId}&ruid={ruid}",
};
@@ -243,7 +244,7 @@ public ApiModel FansList(long ruid, int roomId, int page)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://api.live.bilibili.com/rankdb/v2/RoomRank/mobileMedalRank",
parameter = ApiHelper.MustParameter(AppKey, true) + $"&actionKey=appkey&page={page}&roomid={roomId}&ruid={ruid}",
};
@@ -264,7 +265,7 @@ public ApiModel RoomRankList(long ruid, int roomId, string rank_type, string swi
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://api.live.bilibili.com/xlive/general-interface/v1/rank/queryContributionRank",
parameter = ApiHelper.MustParameter(AppKey, true) + $"&actionKey=appkey&room_id={roomId}&ruid={ruid}&type={rank_type}&switch={switch_type}",
};
@@ -281,7 +282,7 @@ public ApiModel RoomLotteryInfo(int roomId)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://api.live.bilibili.com/xlive/lottery-interface/v1/lottery/getLotteryInfo",
parameter = ApiHelper.MustParameter(AppKey, true) + $"&actionKey=appkey&roomid={roomId}",
need_cookie = true,
@@ -299,7 +300,7 @@ public ApiModel RoomSuperChat(int roomId)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://api.live.bilibili.com/av/v1/SuperChat/getMessageList",
parameter = ApiHelper.MustParameter(AppKey, true) + $"&actionKey=appkey&room_id={roomId}",
};
@@ -315,7 +316,7 @@ public ApiModel RoomEntryAction(int roomId)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"https://api.live.bilibili.com/room/v1/Room/room_entry_action",
body = ApiHelper.MustParameter(AppKey, true) + $"&actionKey=appkey&room_id={roomId}",
};
@@ -332,7 +333,7 @@ public ApiModel GetDanmuInfo(int roomId)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://api.live.bilibili.com/xlive/web-room/v1/index/getDanmuInfo",
parameter = $"?id={roomId}",
need_cookie = true
@@ -348,7 +349,7 @@ public ApiModel GetBuvid()
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = "https://api.bilibili.com/x/frontend/finger/spi",
need_cookie = true
};
@@ -366,7 +367,7 @@ public ApiModel JoinAnchorLottery(int roomId, int lottery_id, string buvid3, int
var csrf = m_cookieService.GetCSRFToken();
var api = new ApiModel
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = "https://api.live.bilibili.com/xlive/lottery-interface/v1/Anchor/Join",
body = $"room_id={roomId}&id={lottery_id}&platform=pc&csrf={csrf}",
need_cookie = true,
@@ -390,7 +391,7 @@ public ApiModel JoinRedPocketLottery(long uid, int room_id, long ruid, int lot_i
var csrf = m_cookieService.GetCSRFToken();
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = "https://api.live.bilibili.com/xlive/lottery-interface/v1/popularityRedPocket/RedPocketDraw",
parameter = $"csrf={csrf}",
body = $"uid={uid}&room_id={room_id}&ruid={ruid}&lot_id={lot_id}&ts={TimeExtensions.GetTimestampS()}",
diff --git a/src/BiliLite.UWP/Models/Requests/Api/PlayerAPI.cs b/src/BiliLite.UWP/Models/Requests/Api/PlayerAPI.cs
index 497681965..2e4966f49 100644
--- a/src/BiliLite.UWP/Models/Requests/Api/PlayerAPI.cs
+++ b/src/BiliLite.UWP/Models/Requests/Api/PlayerAPI.cs
@@ -19,7 +19,7 @@ public ApiModel VideoPlayUrl(string aid, string cid, int qn, bool dash, bool pro
}
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{baseUrl}/x/player/playurl",
parameter = $"avid={aid}&cid={cid}&qn={qn}&type=&otype=json&mid={(SettingService.Account.Logined ? SettingService.Account.Profile.mid.ToString() : "")}",
need_cookie = true,
@@ -42,7 +42,7 @@ public ApiModel SeasonPlayUrl(string aid, string cid, string ep_id, int qn, int
}
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{baseUrl}/pgc/player/web/playurl",
parameter = $"appkey={AppKey.Appkey}&cid={cid}&ep_id={ep_id}&qn={qn}&type=&otype=json&module=bangumi&season_type={season_type}"
};
@@ -68,7 +68,7 @@ public ApiModel SeasonAndroidPlayUrl(string aid, string cid, int qn, int season_
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{ApiHelper.API_BASE_URL}/pgc/player/web/playurl",
parameter = $"appkey={AppKey.Appkey}&cid={cid}&qn={qn}&type=&otype=json&module=bangumi&season_type={season_type}"
};
@@ -86,7 +86,7 @@ public ApiModel LivePlayUrl(string room_id, int qn = 0)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://api.live.bilibili.com/xlive/web-room/v2/index/getRoomPlayInfo",
parameter = $"room_id={room_id}&qn={qn}&protocol=0,1&format=0,2&codec=0,1", //"cid={cid}&qn={qn}&platform=web"
need_cookie = true
@@ -106,7 +106,7 @@ public ApiModel InteractionEdgeInfo(string aid, int graph_version, int edge_id =
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/stein/edgeinfo_v2",
parameter = ApiHelper.MustParameter(AppKey, true) + $"&aid={aid}&graph_version={graph_version}&edge_id={edge_id}"
};
@@ -128,7 +128,7 @@ public ApiModel SeasonHistoryReport(string aid, string cid, int progress, int si
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/v2/history/report",
body = ApiHelper.MustParameter(AppKey, true) + $"&aid={aid}&cid={cid}&epid={epid}&sid={sid}&progress={progress}&realtime={progress}&sub_type=1&type={type}"
};
@@ -151,7 +151,7 @@ public ApiModel SendDanmu(string aid, string cid, string color, string msg, int
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/v2/dm/post",
parameter = ApiHelper.MustParameter(AppKey, true) + $"&aid={aid}",
body = $"msg={Uri.EscapeDataString(msg)}&mode={mode}&screen_state=1&color={color}&pool=0&progress={Convert.ToInt32(position * 1000)}&fontsize=25&rnd={TimeExtensions.GetTimestampS()}&from=7&oid={cid}&plat={plat}&type=1"
@@ -170,7 +170,7 @@ public async Task GetPlayerInfo(string aid, string cid, string bvid)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/player/wbi/v2",
parameter = $"cid={cid}&aid={aid}&bvid={bvid}",
need_cookie = true,
@@ -189,7 +189,7 @@ public ApiModel GetPlayerOnline(string aid, string cid, string bvid)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/player/online/total",
parameter = $"cid={cid}&aid={aid}&bvid={bvid}",
};
@@ -204,7 +204,7 @@ public ApiModel GetDanmuFilterWords()
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/dm/filter/user",
parameter = ApiHelper.MustParameter(AppKey, true)
};
@@ -222,7 +222,7 @@ public ApiModel AddDanmuFilterWord(string word, int type)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/dm/filter/user/add",
body = ApiHelper.MustParameter(AppKey, true) + $"&filter={Uri.EscapeDataString(word)}&type={type}"
};
@@ -240,7 +240,7 @@ public ApiModel SegDanmaku(string oid, int segment_index)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"http://api.bilibili.com/x/v2/dm/list/seg.so",
parameter = $"type=1&oid={oid}&segment_index={segment_index}&{ApiHelper.MustParameter(AppKey, true)}",
};
diff --git a/src/BiliLite.UWP/Models/Requests/Api/RankAPI.cs b/src/BiliLite.UWP/Models/Requests/Api/RankAPI.cs
index 4ef8f9e19..122cc8f30 100644
--- a/src/BiliLite.UWP/Models/Requests/Api/RankAPI.cs
+++ b/src/BiliLite.UWP/Models/Requests/Api/RankAPI.cs
@@ -1,4 +1,5 @@
using System.Threading.Tasks;
+using BiliLite.Models.Common;
using BiliLite.Services;
namespace BiliLite.Models.Requests.Api
@@ -9,7 +10,7 @@ public class RankAPI
//{
// var api = new ApiModel()
// {
- // method = RestSharp.Method.Get,
+ // method = HttpMethods.Get,
// baseUrl = $"{ApiHelper.baseUrl}/api/rank/RankRegion"
// };
// return api;
@@ -24,7 +25,7 @@ public async Task Rank(int rid, string type)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/web-interface/ranking/v2",
parameter = $"rid={rid}&type={type}",
};
@@ -45,7 +46,7 @@ public ApiModel SeasonRank(int type)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{ApiHelper.API_BASE_URL}/pgc/season/rank/list",
parameter = $"season_type={type}"
};
diff --git a/src/BiliLite.UWP/Models/Requests/Api/RegionAPI.cs b/src/BiliLite.UWP/Models/Requests/Api/RegionAPI.cs
index 276dacf90..32ebea3ad 100644
--- a/src/BiliLite.UWP/Models/Requests/Api/RegionAPI.cs
+++ b/src/BiliLite.UWP/Models/Requests/Api/RegionAPI.cs
@@ -1,4 +1,5 @@
-using BiliLite.Services;
+using BiliLite.Models.Common;
+using BiliLite.Services;
namespace BiliLite.Models.Requests.Api
{
@@ -8,7 +9,7 @@ public ApiModel Regions()
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://app.bilibili.com/x/v2/region/index",
parameter = ApiHelper.MustParameter(AppKey, true)
};
@@ -20,7 +21,7 @@ public ApiModel RegionDynamic(int rid)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://app.bilibili.com/x/v2/region/dynamic",
parameter = ApiHelper.MustParameter(AppKey, false) + $"&rid={rid}"
};
@@ -31,7 +32,7 @@ public ApiModel RegionDynamic(int rid, string next_aid)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://app.biliapi.net/x/v2/region/dynamic/list",
parameter = ApiHelper.MustParameter(AppKey, false) + $"&rid={rid}&ctime={next_aid}&pull=false"
};
@@ -44,7 +45,7 @@ public ApiModel RegionChildDynamic(int rid, int tag_id = 0)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://app.biliapi.net/x/v2/region/dynamic/child",
parameter = ApiHelper.MustParameter(AppKey, false) + $"&rid={rid}&tag_id={tag_id}&pull=true"
};
@@ -56,7 +57,7 @@ public ApiModel RegionChildDynamic(int rid, string next, int tag_id = 0)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://app.bilibili.com/x/v2/region/dynamic/child/list",
parameter = ApiHelper.MustParameter(AppKey, false) + $"&rid={rid}&tag_id={tag_id}&pull=false&ctime={next}"
};
@@ -67,7 +68,7 @@ public ApiModel RegionChildList(int rid, string order, int page, int tag_id = 0)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://app.biliapi.net/x/v2/region/show/child/list",
parameter = ApiHelper.MustParameter(AppKey, false) + $"&order={order}&pn={page}&ps=20&rid={rid}&tag_id={tag_id}"
};
diff --git a/src/BiliLite.UWP/Models/Requests/Api/SearchAPI.cs b/src/BiliLite.UWP/Models/Requests/Api/SearchAPI.cs
index 974a380f9..49def9923 100644
--- a/src/BiliLite.UWP/Models/Requests/Api/SearchAPI.cs
+++ b/src/BiliLite.UWP/Models/Requests/Api/SearchAPI.cs
@@ -2,6 +2,7 @@
using BiliLite.Services;
using System;
using System.Collections.Generic;
+using BiliLite.Models.Common;
namespace BiliLite.Models.Requests.Api
{
@@ -21,7 +22,7 @@ public ApiModel Search(string keyword, string order = "", int duration = 0, int
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://app.bilibili.com/x/v2/search",
parameter = ApiHelper.MustParameter(AppKey, true) + "&fnval=16&fnver=0&force_host=0&fourk=1&from_source=app_search&highlight=0&is_org_query=0&qn=112&recommend=1"
};
@@ -51,7 +52,7 @@ public ApiModel WebSearchVideo(string keyword, int pn = 1, string order = "", st
}
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
need_cookie = true,
baseUrl = $"{baseUrl}/x/web-interface/search/type",
parameter = $"context=&search_type=video&page={pn}&order={order}&keyword={Uri.EscapeDataString(keyword)}&duration={duration}&category_id=&tids_2=&__refresh__=true&tids={region}&highlight=1&single_column=0"
@@ -72,7 +73,7 @@ public ApiModel WebSearchAnime(string keyword, int pn = 1, string area = "")
}
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
need_cookie = true,
baseUrl = $"{baseUrl}/x/web-interface/search/type",
parameter = $"context=&search_type=media_bangumi&page={pn}&order=&keyword={Uri.EscapeDataString(keyword)}&category_id=&__refresh__=true&highlight=1&single_column=0"
@@ -93,7 +94,7 @@ public ApiModel WebSearchMovie(string keyword, int pn = 1, string area = "")
}
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
need_cookie = true,
baseUrl = $"{baseUrl}/x/web-interface/search/type",
parameter = $"context=&search_type=media_ft&page={pn}&order=&keyword={Uri.EscapeDataString(keyword)}&category_id=&__refresh__=true&highlight=1&single_column=0"
@@ -114,7 +115,7 @@ public ApiModel WebSearchUser(string keyword, int pn = 1, string order = "&order
}
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
need_cookie = true,
baseUrl = $"{baseUrl}/x/web-interface/search/type",
parameter = $"context=&search_type=bili_user&page={pn}&keyword={Uri.EscapeDataString(keyword)}{order}{type}&__refresh__=true&changing=mid&highlight=1&single_column=0&category_id="
@@ -135,7 +136,7 @@ public ApiModel WebSearchLive(string keyword, int pn = 1, string area = "")
}
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
need_cookie = true,
baseUrl = $"{baseUrl}/x/web-interface/search/type",
parameter = $"context=&search_type=live&cover_type=user_cover&page={pn}&keyword={Uri.EscapeDataString(keyword)}&__refresh__=true&changing=mid&highlight=1&single_column=0"
@@ -156,7 +157,7 @@ public ApiModel WebSearchArticle(string keyword, int pn = 1, string order = "tot
}
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
need_cookie = true,
baseUrl = $"{baseUrl}/x/web-interface/search/type",
parameter = $"context=&search_type=article&page={pn}&order={order}&keyword={Uri.EscapeDataString(keyword)}&category_id={region}&__refresh__=true&highlight=1&single_column=0"
@@ -177,7 +178,7 @@ public ApiModel WebSearchTopic(string keyword, int pn = 1, string area = "")
}
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
need_cookie = true,
baseUrl = $"{baseUrl}/x/web-interface/search/type",
parameter = $"context=&search_type=topic&page={pn}&order=&keyword={Uri.EscapeDataString(keyword)}&category_id=&__refresh__=true&highlight=1&single_column=0"
@@ -194,7 +195,7 @@ public ApiModel SearchSuggest(string content)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://s.search.bilibili.com/main/suggest",
parameter = $"term={content}&main_ver=v1"
};
diff --git a/src/BiliLite.UWP/Models/Requests/Api/SeasonApi.cs b/src/BiliLite.UWP/Models/Requests/Api/SeasonApi.cs
index 15e9e370f..809d63149 100644
--- a/src/BiliLite.UWP/Models/Requests/Api/SeasonApi.cs
+++ b/src/BiliLite.UWP/Models/Requests/Api/SeasonApi.cs
@@ -1,7 +1,6 @@
using BiliLite.Services;
using System;
using BiliLite.Models.Common;
-using Bilibili.App.View.V1;
namespace BiliLite.Models.Requests.Api
{
@@ -20,7 +19,7 @@ public ApiModel Detail(string id, SeasonIdType type = SeasonIdType.SeasonId, boo
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{baseUrl}/pgc/view/v2/app/season",
parameter = ApiHelper.MustParameter(AppKey, true),
};
@@ -47,7 +46,7 @@ public ApiModel ShortReview(int media_id, string next = "", int sort = 0)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{ApiHelper.API_BASE_URL}/pgc/review/short/list",
parameter = $"media_id={media_id}&ps=20&sort={sort}&cursor={next}"
};
@@ -66,7 +65,7 @@ public ApiModel LikeReview(int media_id, int review_id, ReviewType review_type =
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"https://bangumi.bilibili.com/review/api/like",
body = $"{ApiHelper.MustParameter(AppKey, true)}&media_id={media_id}&review_id={review_id}&review_type={(int)review_type}"
};
@@ -82,7 +81,7 @@ public ApiModel DislikeReview(int media_id, int review_id, ReviewType review_typ
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"https://bangumi.bilibili.com/review/api/dislike",
body = $"{ApiHelper.MustParameter(AppKey, true)}&media_id={media_id}&review_id={review_id}&review_type={(int)review_type}"
};
@@ -101,7 +100,7 @@ public ApiModel SendShortReview(int media_id, string content, bool share_feed, i
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"https://bangumi.bilibili.com/review/api/short/post",
body = $"{ApiHelper.MustParameter(AppKey, true)}&media_id={media_id}&content={Uri.EscapeDataString(content)}&share_feed={(share_feed ? 1 : 0)}&score={score}"
};
diff --git a/src/BiliLite.UWP/Models/Requests/Api/SeasonIndexAPI.cs b/src/BiliLite.UWP/Models/Requests/Api/SeasonIndexAPI.cs
index 4ccca7ca2..6f7796111 100644
--- a/src/BiliLite.UWP/Models/Requests/Api/SeasonIndexAPI.cs
+++ b/src/BiliLite.UWP/Models/Requests/Api/SeasonIndexAPI.cs
@@ -1,4 +1,5 @@
-using BiliLite.Services;
+using BiliLite.Models.Common;
+using BiliLite.Services;
namespace BiliLite.Models.Requests.Api
{
@@ -13,7 +14,7 @@ public ApiModel Condition(int season_type)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{ApiHelper.API_BASE_URL}/pgc/season/index/condition",//$"https://bangumi.bilibili.com/media/api/search/v2/condition",
parameter = ApiHelper.MustParameter(AppKey, false) + $"&season_type={season_type}&type=0"
};
@@ -33,7 +34,7 @@ public ApiModel Result(int page, int season_type, string condition, int pagesize
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{ApiHelper.API_BASE_URL}/pgc/season/index/result",
parameter = ApiHelper.MustParameter(AppKey, false) + condition + $"&page={page}&pagesize={pagesize}&season_type={season_type}&type=0"
};
diff --git a/src/BiliLite.UWP/Models/Requests/Api/User/AtAPI.cs b/src/BiliLite.UWP/Models/Requests/Api/User/AtAPI.cs
index bb80a8162..5651b2ae0 100644
--- a/src/BiliLite.UWP/Models/Requests/Api/User/AtAPI.cs
+++ b/src/BiliLite.UWP/Models/Requests/Api/User/AtAPI.cs
@@ -1,5 +1,6 @@
using BiliLite.Services;
using System;
+using BiliLite.Models.Common;
namespace BiliLite.Models.Requests.Api.User
{
@@ -9,7 +10,7 @@ public ApiModel RecommendAt(int page = 1, int pagesize = 20)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = "https://api.vc.bilibili.com/dynamic_mix/v1/dynamic_mix/rcmd_at",
parameter = ApiHelper.MustParameter(AppKey, true) + $"&need_attention=1&need_recent_at=1&page={page}&pagesize={pagesize}&teenagers_mode=0",
};
@@ -21,7 +22,7 @@ public ApiModel SearchUser(string keyword, int page = 1, int pagesize = 20)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = "https://app.bilibili.com/x/v2/search/user",
parameter = ApiHelper.MustParameter(AppKey, true) + $"&keyword={Uri.EscapeDataString(keyword)}&order=totalrank&order_sort=0&pn={page}&ps={pagesize}",
};
diff --git a/src/BiliLite.UWP/Models/Requests/Api/User/DynamicAPI.cs b/src/BiliLite.UWP/Models/Requests/Api/User/DynamicAPI.cs
index d8e03522c..e12e89a23 100644
--- a/src/BiliLite.UWP/Models/Requests/Api/User/DynamicAPI.cs
+++ b/src/BiliLite.UWP/Models/Requests/Api/User/DynamicAPI.cs
@@ -1,5 +1,6 @@
using BiliLite.Services;
using System;
+using BiliLite.Models.Common;
using BiliLite.Models.Common.UserDynamic;
namespace BiliLite.Models.Requests.Api.User
@@ -33,13 +34,13 @@ public ApiModel DyanmicNew(UserDynamicType type)
}
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = "https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/dynamic_new",
parameter = $"type_list={Uri.EscapeDataString(typeList)}&uid={SettingService.Account.UserID}",
};
//var api = new ApiModel()
//{
- // method = RestSharp.Method.Get,
+ // method = HttpMethods.Get,
// baseUrl = "https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/space_history",
// parameter = $"host_uid={SettingService.Account.UserID}&visitor_uid={SettingService.Account.UserID}",
//};
@@ -57,7 +58,7 @@ public ApiModel DynamicDetail(string id)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = "https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/get_dynamic_detail",
parameter = $"dynamic_id={id}",
};
@@ -75,7 +76,7 @@ public ApiModel DynamicRepost(string id, string offset = "")
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = "https://api.vc.bilibili.com/dynamic_repost/v1/dynamic_repost/repost_detail",
parameter = $"dynamic_id={id}&offset={offset}",
};
@@ -110,7 +111,7 @@ public ApiModel HistoryDynamic(string dynamic_id, UserDynamicType type)
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/dynamic_history",
parameter = $"offset_dynamic_id={dynamic_id}&type_list={Uri.EscapeDataString(typeList)}&uid={SettingService.Account.UserID}"
};//使用Web的API
@@ -127,7 +128,7 @@ public ApiModel SpaceHistory(string mid, string dynamic_id = "")
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/space_history",
parameter = $"offset_dynamic_id={dynamic_id}&visitor_uid={SettingService.Account.UserID}&host_uid={mid}&need_top=1"
};
@@ -144,7 +145,7 @@ public ApiModel SpaceHistoryV2(string mid, string offset = "")
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/space",
parameter = $"offset={offset}&host_mid={mid}",
need_cookie = true,
@@ -162,7 +163,7 @@ public ApiModel Article(string updateBaseline,string type="article")
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/nav",
parameter = $"type={type}&update_baseline={updateBaseline}",
need_cookie = true,
@@ -179,7 +180,7 @@ public ApiModel RecommendTopic()
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = "https://api.vc.bilibili.com/topic_svr/v1/topic_svr/get_rcmd_topic",
parameter = ApiHelper.MustParameter(AppKey, true),
};
@@ -196,7 +197,7 @@ public ApiModel CreateDynamicPhoto(string imgs, string content, string at_uids,
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/create_draw",
parameter = ApiHelper.MustParameter(AppKey, true),
body = $"uid={SettingService.Account.UserID}&category=3&pictures={Uri.EscapeDataString(imgs)}&description={Uri.EscapeDataString(content)}&content={Uri.EscapeDataString(content)}&setting=%7B%22copy_forbidden%22%3A0%7D&at_uids={Uri.EscapeDataString(at_uids)}&at_control={Uri.EscapeDataString(at_control)}&extension=%7B%22emoji_type%22%3A1%7D"
@@ -213,7 +214,7 @@ public ApiModel CreateDynamicText(string content, string at_uids, string at_cont
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/create",
parameter = ApiHelper.MustParameter(AppKey, true),
body = $"uid={SettingService.Account.UserID}&dynamic_id=0&type=4&content={Uri.EscapeDataString(content)}&setting=%7B%22copy_forbidden%22%3A0%7D&at_uids={Uri.EscapeDataString(at_uids)}&at_control={Uri.EscapeDataString(at_control)}&jumpfrom=110&extension=%7B%22emoji_type%22%3A1%7D"
@@ -230,7 +231,7 @@ public ApiModel RepostDynamic(string dynamic_id, string content, string at_uids,
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"https://api.vc.bilibili.com/dynamic_repost/v1/dynamic_repost/repost",
parameter = ApiHelper.MustParameter(AppKey, true),
body = $"uid={SettingService.Account.UserID}&dynamic_id={dynamic_id}&content={Uri.EscapeDataString(content)}&at_uids={Uri.EscapeDataString(at_uids)}&at_control={Uri.EscapeDataString(at_control)}&extension=%7B%22emoji_type%22%3A1%7D"
@@ -249,7 +250,7 @@ public ApiModel Like(string dynamic_id, int up)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"https://api.vc.bilibili.com/dynamic_like/v1/dynamic_like/thumb",
body = ApiHelper.MustParameter(AppKey, true) + $"&dynamic_id={dynamic_id}&uid={SettingService.Account.UserID}&up={up}"
};
@@ -265,7 +266,7 @@ public ApiModel Delete(string dynamic_id)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/rm_dynamic",
body = ApiHelper.MustParameter(AppKey, true) + $"&dynamic_id={dynamic_id}"
};
@@ -282,7 +283,7 @@ public ApiModel UploadImage()
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://api.vc.bilibili.com/api/v1/drawImage/upload",
parameter = ApiHelper.MustParameter(AppKey, true)
};
diff --git a/src/BiliLite.UWP/Models/Requests/Api/User/FavoriteAPI.cs b/src/BiliLite.UWP/Models/Requests/Api/User/FavoriteAPI.cs
index 57679c580..c9c3e80a1 100644
--- a/src/BiliLite.UWP/Models/Requests/Api/User/FavoriteAPI.cs
+++ b/src/BiliLite.UWP/Models/Requests/Api/User/FavoriteAPI.cs
@@ -1,6 +1,7 @@
using BiliLite.Services;
using System;
using System.Collections.Generic;
+using BiliLite.Models.Common;
namespace BiliLite.Models.Requests.Api.User
{
@@ -17,7 +18,7 @@ public ApiModel MyFavorite()
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/v3/fav/folder/space/v2",
parameter = ApiHelper.MustParameter(AppKey, true) + $"&up_mid={SettingService.Account.UserID}"
};
@@ -28,7 +29,7 @@ public ApiModel MyCreatedFavoriteList(int page)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/v3/fav/folder/created/list",
parameter = ApiHelper.MustParameter(AppKey, true) + $"&up_mid={SettingService.Account.UserID}&pn={page}&ps=20"
};
@@ -43,7 +44,7 @@ public ApiModel MyCreatedFavorite(string aid)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{ApiHelper.API_BASE_URL}/medialist/gateway/base/created",
parameter = ApiHelper.MustParameter(AppKey, true) + $"&rid={aid}&up_mid={SettingService.Account.UserID}&type=2&pn=1&ps=100"
};
@@ -65,7 +66,7 @@ public ApiModel AddFavorite(List favIds, string avid)
ids = Uri.EscapeDataString(ids.TrimEnd(','));
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"{ApiHelper.API_BASE_URL}/medialist/gateway/coll/resource/deal",
body = ApiHelper.MustParameter(AppKey, true) + $"&add_media_ids={ids}&rid={avid}&type=2"
};
@@ -93,7 +94,7 @@ public ApiModel UpdateFavorite(List addFavIds,List delFavIds, st
delIds = Uri.EscapeDataString(delIds.TrimEnd(','));
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"{ApiHelper.API_BASE_URL}/medialist/gateway/coll/resource/deal",
body = ApiHelper.MustParameter(AppKey, true) + $"&add_media_ids={addIds}&del_media_ids={delIds}&rid={avid}&type=2"
};
@@ -109,7 +110,7 @@ public ApiModel CollectFavorite(string media_id)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/v3/fav/folder/fav",
body = ApiHelper.MustParameter(AppKey, true) + $"&media_id={media_id}"
};
@@ -124,7 +125,7 @@ public ApiModel CacnelCollectFavorite(string media_id)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/v3/fav/folder/unfav",
body = ApiHelper.MustParameter(AppKey, true) + $"&media_id={media_id}"
};
@@ -143,7 +144,7 @@ public ApiModel CreateFavorite(string title, string intro, bool isOpen)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/v3/fav/folder/add",
body = ApiHelper.MustParameter(AppKey, true) + $"&privacy={(isOpen ? 0 : 1)}&title={Uri.EscapeDataString(title)}&intro={Uri.EscapeDataString(intro)}"
};
@@ -162,7 +163,7 @@ public ApiModel EditFavorite(string title, string intro, bool isOpen, string med
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/v3/fav/folder/edit",
body = ApiHelper.MustParameter(AppKey, true) + $"&privacy={(isOpen ? 0 : 1)}&title={Uri.EscapeDataString(title)}&intro={Uri.EscapeDataString(intro)}&media_id={media_id}"
};
@@ -179,7 +180,7 @@ public ApiModel DelFavorite(string media_id)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/v3/fav/folder/del",
body = ApiHelper.MustParameter(AppKey, true) + $"&media_ids={media_id}"
};
@@ -195,7 +196,7 @@ public ApiModel FavoriteInfo(string fid, string keyword, int page = 1)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/v3/fav/resource/list",
parameter = $"media_id={fid}&mid={SettingService.Account.UserID}&keyword={Uri.EscapeDataString(keyword)}&pn={page}&ps=20&platform=web",
need_cookie = true,
@@ -207,7 +208,7 @@ public ApiModel FavoriteSeasonInfo(string season_id, string keyword, int page =
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/space/fav/season/list",
parameter = ApiHelper.MustParameter(AppKey, true) + $"&season_id={season_id}&mid={SettingService.Account.UserID}&keyword={Uri.EscapeDataString(keyword)}&pn={page}&ps=20"
};
@@ -229,7 +230,7 @@ public ApiModel Delete(string media_id, List video_ids)
ids = Uri.EscapeDataString(ids.TrimEnd(','));
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/v3/fav/resource/batch-del",
body = ApiHelper.MustParameter(AppKey, true) + $"&media_id={media_id}&resources={ids}"
};
@@ -250,7 +251,7 @@ public ApiModel Copy(string src_media_id, string tar_media_id, List vide
ids = Uri.EscapeDataString(ids.TrimEnd(','));
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/v3/fav/resource/copy",
body = ApiHelper.MustParameter(AppKey, true) + $"&src_media_id={src_media_id}&tar_media_id={tar_media_id}&resources={ids}&mid={mid}"
};
@@ -271,7 +272,7 @@ public ApiModel Move(string src_media_id, string tar_media_id, List vide
ids = Uri.EscapeDataString(ids.TrimEnd(','));
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/v3/fav/resource/move",
body = ApiHelper.MustParameter(AppKey, true) + $"&src_media_id={src_media_id}&tar_media_id={tar_media_id}&resources={ids}"
};
@@ -286,7 +287,7 @@ public ApiModel Clean(string media_id)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/v3/fav/resource/clean",
body = ApiHelper.MustParameter(AppKey, true) + $"&media_id={media_id}"
};
@@ -299,7 +300,7 @@ public ApiModel Sort(List favIdList)
var sort = string.Join(',', favIdList);
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/v3/fav/folder/sort",
body = ApiHelper.MustParameter(AppKey, true) + $"&sort={sort}"
};
@@ -315,7 +316,7 @@ public ApiModel SortResource(string mediaId, string sourceId, string targetId)
sort = string.IsNullOrEmpty(targetId) ? $"0:0:{sourceId}:2" : $"{targetId}:2:{sourceId}:2";
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/v3/fav/resource/sort",
body = ApiHelper.MustParameter(AppKey, true) + $"&media_id={mediaId}&sort={sort}"
};
@@ -327,7 +328,7 @@ public ApiModel GetCollected(int page=1,int pageCount=20)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/v3/fav/folder/collected/list",
parameter = $"up_mid={SettingService.Account.UserID}&pn={page}&ps={pageCount}&platform=web",
need_cookie = true,
@@ -339,7 +340,7 @@ public ApiModel UnFavCollected(string seasonId)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/v3/fav/season/unfav",
body = ApiHelper.MustParameter(AppKey, true) + $"&season_id={seasonId}"
};
diff --git a/src/BiliLite.UWP/Models/Requests/Api/User/FollowAPI.cs b/src/BiliLite.UWP/Models/Requests/Api/User/FollowAPI.cs
index f9ea4b532..c44f73136 100644
--- a/src/BiliLite.UWP/Models/Requests/Api/User/FollowAPI.cs
+++ b/src/BiliLite.UWP/Models/Requests/Api/User/FollowAPI.cs
@@ -1,4 +1,5 @@
-using BiliLite.Services;
+using BiliLite.Models.Common;
+using BiliLite.Services;
namespace BiliLite.Models.Requests.Api.User
{
@@ -15,7 +16,7 @@ public ApiModel MyFollowBangumi(int page = 1, int status = 0, int pagesize = 20)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{ApiHelper.API_BASE_URL}/pgc/app/follow/v2/bangumi",
parameter = ApiHelper.MustParameter(AppKey, true) + $"&pn={page}&ps={pagesize}&status={status}",
headers = ApiHelper.GetAuroraHeaders()
@@ -34,7 +35,7 @@ public ApiModel MyFollowCinema(int page = 1, int status = 0, int pagesize = 20)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{ApiHelper.API_BASE_URL}/pgc/app/follow/v2/cinema",
parameter = ApiHelper.MustParameter(AppKey, true) + $"&pn={page}&ps={pagesize}&status={status}",
};
@@ -49,7 +50,7 @@ public ApiModel FollowSeason(string season_id)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"{ApiHelper.API_BASE_URL}/pgc/app/follow/add",
body = ApiHelper.MustParameter(AppKey, true) + $"&season_id={season_id}"
};
@@ -64,7 +65,7 @@ public ApiModel CancelFollowSeason(string season_id)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"{ApiHelper.API_BASE_URL}/pgc/app/follow/del",
body = ApiHelper.MustParameter(AppKey, true) + $"&season_id={season_id}"
};
@@ -80,7 +81,7 @@ public ApiModel SetSeasonStatus(string season_id, int status)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"{ApiHelper.API_BASE_URL}/pgc/app/follow/status/update",
body = ApiHelper.MustParameter(AppKey, true) + $"&season_id={season_id}&status={status}"
};
@@ -99,7 +100,7 @@ public ApiModel Attention(string mid, string mode)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/relation/modify",
body = ApiHelper.MustParameter(AppKey, true) + $"&act={mode}&fid={mid}&re_src=32"
};
@@ -116,7 +117,7 @@ public ApiModel GetAttention(string mid)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/relation",
parameter = $"fid={mid}",
need_cookie = true
diff --git a/src/BiliLite.UWP/Models/Requests/Api/User/UserDetailAPI.cs b/src/BiliLite.UWP/Models/Requests/Api/User/UserDetailAPI.cs
index a2850d0bc..a0bd912df 100644
--- a/src/BiliLite.UWP/Models/Requests/Api/User/UserDetailAPI.cs
+++ b/src/BiliLite.UWP/Models/Requests/Api/User/UserDetailAPI.cs
@@ -2,6 +2,7 @@
using System.Linq;
using BiliLite.Services;
using System.Threading.Tasks;
+using BiliLite.Models.Common;
using Microsoft.Extensions.DependencyInjection;
namespace BiliLite.Models.Requests.Api.User
@@ -24,7 +25,7 @@ public async Task UserInfo(string mid)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/space/wbi/acc/info",
parameter = $"mid={mid}",
need_cookie = true
@@ -41,7 +42,7 @@ public ApiModel Space(string mid)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = "https://app.bilibili.com/x/v2/space",
parameter = ApiHelper.MustParameter(AppKey, needAccesskey: true) + $"&vmid={mid}",
};
@@ -57,7 +58,7 @@ public ApiModel UserStat(string mid)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/relation/stat",
parameter = $"vmid={mid}",
};
@@ -76,7 +77,7 @@ public async Task SubmitVideos(string mid, int page = 1, int pagesize
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/space/wbi/arc/search",
parameter = $"mid={mid}&ps={pagesize}&tid={tid}&pn={page}&keyword={keyword}&order={order.ToString()}",
need_cookie = true,
@@ -89,7 +90,7 @@ public ApiModel SubmitVideosCursor(string mid, int pagesize = 30, SubmitVideoOrd
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://app.bilibili.com/x/v2/space/archive/cursor",
parameter =
$"{ApiHelper.MustParameter(AppKey, true)}&vmid={mid}&ps={pagesize}&order={order.ToString()}&aid={cursor}",
@@ -109,7 +110,7 @@ public ApiModel SubmitArticles(string mid, int page = 1, int pagesize = 30, Subm
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/space/article",
parameter = $"mid={mid}&ps={pagesize}&pn={page}&sort={order.ToString()}",
};
@@ -120,7 +121,7 @@ public ApiModel SubmitCollections(string mid, int pageNum)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://app.bilibili.com/x/polymer/space/seasons_series_list_mobile",
parameter = $"{ApiHelper.MustParameter(AppKey, true)}&mid={mid}&page_num={pageNum}&page_size=20",
};
@@ -136,7 +137,7 @@ public ApiModel FollowingsTag()
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/relation/tags",
parameter = ApiHelper.MustParameter(AppKey, true)
};
@@ -152,7 +153,7 @@ public ApiModel FollowingTagUser(long targetUserId)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/relation/tag/user",
parameter = $"fid={targetUserId}&" + ApiHelper.MustParameter(AppKey, true)
};
@@ -168,7 +169,7 @@ public ApiModel CreateFollowingTag(long tag)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/relation/tag/create",
body = $"tag={tag}&" + ApiHelper.MustParameter(AppKey, true)
};
@@ -194,7 +195,7 @@ public ApiModel AddFollowingTagUsers(List targetUserIdList,List tagI
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/relation/tags/addUsers",
body = $"fids={fids}&tagids={tagids}&csrf={csrf}",// + ApiHelper.MustParameter(AppKey, true)
need_cookie = true,
@@ -214,7 +215,7 @@ public async Task Followings(string mid, int page = 1, int pagesize =
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/relation/followings",
parameter = $"vmid={mid}&ps={pagesize}&pn={page}&order=desc&order_type={(order == FollowingsOrder.attention ? "attention" : "")}",
need_cookie = true,
@@ -244,7 +245,7 @@ public ApiModel Followers(string mid, int page = 1, int pagesize = 30)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/relation/followers",
parameter = $"vmid={mid}&ps={pagesize}&pn={page}&order=desc",
need_cookie = true,
@@ -261,7 +262,7 @@ public ApiModel Favlist(string mid)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/v3/fav/folder/created/list-all",
parameter = $"up_mid={mid}",
};
diff --git a/src/BiliLite.UWP/Models/Requests/Api/User/WatchLaterAPI.cs b/src/BiliLite.UWP/Models/Requests/Api/User/WatchLaterAPI.cs
index 5ca01f955..3f0581ece 100644
--- a/src/BiliLite.UWP/Models/Requests/Api/User/WatchLaterAPI.cs
+++ b/src/BiliLite.UWP/Models/Requests/Api/User/WatchLaterAPI.cs
@@ -1,4 +1,5 @@
-using BiliLite.Services;
+using BiliLite.Models.Common;
+using BiliLite.Services;
namespace BiliLite.Models.Requests.Api.User
{
@@ -8,7 +9,7 @@ public ApiModel Add(string aid)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/v2/history/toview/add",
body = ApiHelper.MustParameter(AppKey, true) + $"&aid={aid}"
};
@@ -19,7 +20,7 @@ public ApiModel Watchlater()
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/v2/history/toview",
parameter = ApiHelper.MustParameter(AppKey, true) + $"&ps=100"
};
@@ -30,7 +31,7 @@ public ApiModel Clear()
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/v2/history/toview/clear",
body = ApiHelper.MustParameter(AppKey, true)
};
@@ -41,7 +42,7 @@ public ApiModel Del()
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/v2/history/toview/del",
body = ApiHelper.MustParameter(AppKey, true) + "&viewed=true"
};
@@ -52,7 +53,7 @@ public ApiModel Del(string id)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/v2/history/toview/del",
body = ApiHelper.MustParameter(AppKey, true) + "&aid=" + id
};
diff --git a/src/BiliLite.UWP/Models/Requests/Api/VideoAPI.cs b/src/BiliLite.UWP/Models/Requests/Api/VideoAPI.cs
index 2587cca32..d5d050759 100644
--- a/src/BiliLite.UWP/Models/Requests/Api/VideoAPI.cs
+++ b/src/BiliLite.UWP/Models/Requests/Api/VideoAPI.cs
@@ -1,5 +1,6 @@
using BiliLite.Services;
using System;
+using BiliLite.Models.Common;
namespace BiliLite.Models.Requests.Api
{
@@ -9,7 +10,7 @@ public ApiModel Detail(string id, bool isbvid)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://app.bilibili.com/x/v2/view",
parameter = ApiHelper.MustParameter(AppKey, true) + $"&{(isbvid ? "bvid=" : "aid=")}{id}&plat=0"
};
@@ -21,7 +22,7 @@ public ApiModel DetailWebInterface(string id, bool isBvId)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://api.bilibili.com/x/web-interface/view",
parameter = $"&{(isBvId ? "bvid=" : "aid=")}{id}",
need_cookie = true,
@@ -33,7 +34,7 @@ public ApiModel RelatesWebInterface(string id, bool isBvId)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://api.bilibili.com/x/web-interface/archive/related",
parameter = $"&{(isBvId ? "bvid=" : "aid=")}{id}"
};
@@ -44,7 +45,7 @@ public ApiModel DetailProxy(string id, bool isbvid)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://app.bilibili.com/x/v2/view",
parameter = ApiHelper.GetAccessParameter(AppKey) + $"&{(isbvid ? "bvid=" : "aid=")}{id}&plat=0"
};
@@ -64,7 +65,7 @@ public ApiModel Like(string aid, int dislike, int like)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"https://app.bilibili.com/x/v2/view/like",
body = ApiHelper.MustParameter(AppKey, true) + $"&aid={aid}&dislike={dislike}&from=7&like={like}"
};
@@ -81,7 +82,7 @@ public ApiModel Dislike(string aid, int dislike, int like)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"https://app.biliapi.net/x/v2/view/dislike",
body = ApiHelper.MustParameter(AppKey, true) + $"&aid={aid}&dislike={dislike}&from=7&like={like}"
};
@@ -97,7 +98,7 @@ public ApiModel Triple(string aid)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"https://app.bilibili.com/x/v2/view/like/triple",
body = ApiHelper.MustParameter(AppKey, true) + $"&aid={aid}"
};
@@ -109,7 +110,7 @@ public ApiModel Coin(string aid, int num)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"https://app.biliapi.net/x/v2/view/coin/add",
body = ApiHelper.MustParameter(AppKey, true) + $"&aid={aid}&multiply={num}&platform=android&select_like=0"
};
@@ -127,7 +128,7 @@ public ApiModel Attention(string mid, string mode)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Post,
+ method = HttpMethods.Post,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/relation/modify",
body = ApiHelper.MustParameter(AppKey, true) + $"&act={mode}&fid={mid}&re_src=32"
};
@@ -139,7 +140,7 @@ public ApiModel Tags(string aid)
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/tag/archive/tags",
parameter = $"&aid={aid}",
need_cookie = true,
@@ -151,7 +152,7 @@ public ApiModel GetMediaList(string medisListId, string lastAid, int pagesize =
{
var api = new ApiModel()
{
- method = RestSharp.Method.Get,
+ method = HttpMethods.Get,
baseUrl = $"https://api.bilibili.com/x/v2/medialist/resource/list",
parameter =
$"{ApiHelper.MustParameter(AppKey, true)}&type=1&biz_id={medisListId}&oid={lastAid}&otype=2&ps={pagesize}&direction=false&desc=true&sort_field=1&tid=0&with_current=false",
diff --git a/src/BiliLite.UWP/Models/Requests/ApiModel.cs b/src/BiliLite.UWP/Models/Requests/ApiModel.cs
index 01ed02287..bad0c078f 100644
--- a/src/BiliLite.UWP/Models/Requests/ApiModel.cs
+++ b/src/BiliLite.UWP/Models/Requests/ApiModel.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using BiliLite.Models.Common;
namespace BiliLite.Models.Requests
{
@@ -7,7 +8,7 @@ public class ApiModel
///
/// 请求方法
///
- public RestSharp.Method method { get; set; }
+ public HttpMethods method { get; set; }
///
/// API地址
///
diff --git a/src/BiliLite.UWP/Pages/BasePage.cs b/src/BiliLite.UWP/Pages/BasePage.cs
index a1f105a00..319d5cc77 100644
--- a/src/BiliLite.UWP/Pages/BasePage.cs
+++ b/src/BiliLite.UWP/Pages/BasePage.cs
@@ -84,6 +84,11 @@ public void StopHighRateSpeedPlay()
Player.StopHighRateSpeedPlay();
}
+ public void SetPosition(double position)
+ {
+ Player.SetPosition(position);
+ }
+
public void PositionBack()
{
Player.PositionBack();
diff --git a/src/BiliLite.UWP/Pages/NewPage.xaml.cs b/src/BiliLite.UWP/Pages/NewPage.xaml.cs
index 7ec045ca6..52ced345d 100644
--- a/src/BiliLite.UWP/Pages/NewPage.xaml.cs
+++ b/src/BiliLite.UWP/Pages/NewPage.xaml.cs
@@ -41,7 +41,7 @@ private async void SetBackground()
}
else
{
- if (!File.Exists(background))
+ if (!await background.CheckFileExist())
{
Notify.ShowMessageToast("背景图片不存在,请重新设置");
return;
diff --git a/src/BiliLite.UWP/Services/PluginService.cs b/src/BiliLite.UWP/Services/PluginService.cs
new file mode 100644
index 000000000..762ee7a2c
--- /dev/null
+++ b/src/BiliLite.UWP/Services/PluginService.cs
@@ -0,0 +1,337 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Threading.Tasks;
+using Flurl.Http;
+using Windows.System;
+using WebSocket4Net;
+using System.Timers;
+using Windows.UI.Core;
+using Windows.UI.Xaml.Controls;
+using BiliLite.Extensions;
+using BiliLite.Models.Common;
+using BiliLite.Pages;
+using Microsoft.Extensions.DependencyInjection;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+
+namespace BiliLite.Services
+{
+ public class PluginService
+ {
+ private readonly SettingSqlService m_settingSqlService;
+ private List m_plugins;
+ private static readonly ILogger _logger = GlobalLogger.FromCurrentType();
+
+ public PluginService(SettingSqlService settingSqlService)
+ {
+ m_settingSqlService = settingSqlService;
+ m_plugins = m_settingSqlService.GetValue(SettingConstants.Other.PLUGIN_LIST, new List());
+ }
+
+ public async Task Start()
+ {
+ foreach (var plugin in m_plugins)
+ {
+ await plugin.Start();
+ }
+ }
+
+ public async Task Stop()
+ {
+ foreach (var plugin in m_plugins)
+ {
+ await plugin.Stop();
+ }
+ }
+
+ public List GetPlugins()
+ {
+ return m_plugins;
+ }
+
+ public async Task AddPlugin(WebSocketPlugin plugin)
+ {
+ var oldPlugin = m_plugins.FirstOrDefault(x => x.Name == plugin.Name);
+ if (oldPlugin != null)
+ {
+ await oldPlugin.Stop();
+
+ oldPlugin.CheckUrl = plugin.CheckUrl;
+ oldPlugin.WakeProto = plugin.WakeProto;
+ oldPlugin.WebSocketUrl = plugin.WebSocketUrl;
+
+ try
+ {
+ await oldPlugin.Start();
+ }
+ catch (Exception ex)
+ {
+ _logger.Error("更新插件失败", ex);
+ throw ex;
+ }
+
+ m_settingSqlService.SetValue(SettingConstants.Other.PLUGIN_LIST, m_plugins);
+ return;
+ }
+ try
+ {
+ await plugin.Start();
+ }
+ catch (Exception ex)
+ {
+ _logger.Error("添加插件失败", ex);
+ throw ex;
+ }
+
+ m_plugins.Add(plugin);
+ m_settingSqlService.SetValue(SettingConstants.Other.PLUGIN_LIST, m_plugins);
+ }
+
+ public async Task RemovePlugin(string name)
+ {
+ var plugin = m_plugins.FirstOrDefault(x => x.Name == name);
+ if (plugin == null) return;
+ await plugin.Stop();
+ m_plugins.Remove(plugin);
+ }
+ }
+
+ public class WebSocketPlugin
+ {
+ private WebSocket m_webSocket;
+ private bool m_autoReconnect = true;
+ private int m_retryCount = 0;
+ private Timer m_clearRetryTimer;
+
+ public WebSocketPlugin()
+ {
+ m_clearRetryTimer = new Timer(5000);
+ m_clearRetryTimer.AutoReset = true;
+ m_clearRetryTimer.Elapsed += ClearRetryTimer_Elapsed;
+ }
+
+ ///
+ /// 插件的唤醒协议, 例如 bilibili://
+ ///
+ public string WakeProto { get; set; }
+
+ ///
+ /// 连接插件的WebSocket地址
+ ///
+ public string WebSocketUrl { get; set; }
+
+ ///
+ /// 检查插件是否已启动的Http地址
+ ///
+ public string CheckUrl { get; set; }
+
+ ///
+ /// 插件名称
+ ///
+ public string Name { get; set; }
+
+ public async Task Start()
+ {
+ if (!await CheckIsEnable())
+ {
+ await WakePlugin();
+ }
+ await Connect();
+ PluginCenter.BroadcastEvent += OnBroadcastEvent;
+ }
+
+ public async Task Stop()
+ {
+ PluginCenter.BroadcastEvent -= OnBroadcastEvent;
+ await DisConnect();
+ }
+
+ private void OnBroadcastEvent(object sender,object msg)
+ {
+ // 将msg序列化为json字符串,通过ws发送出去
+ var json = JsonConvert.SerializeObject(msg);
+ if (m_webSocket.State == WebSocketState.Open)
+ {
+ try
+ {
+ m_webSocket.Send(json);
+ }
+ catch (Exception ex)
+ {
+ // 处理发送消息时可能出现的异常
+ Debug.WriteLine($"Error sending message: {ex.Message}");
+ }
+ }
+ else
+ {
+ // WebSocket连接不是打开状态,可能需要重连或记录错误
+ Debug.WriteLine("WebSocket is not in the Open state.");
+ }
+ }
+
+ private async Task Connect()
+ {
+ m_webSocket = new WebSocket(WebSocketUrl);
+ m_webSocket.Opened += OnWebSocketOpened;
+ m_webSocket.Closed += OnWebSocketClosed;
+ m_webSocket.MessageReceived += OnWebSocketMessageReceived;
+ m_webSocket.Error += OnWebSocketError;
+ await OpenConnect();
+ }
+
+ private async Task OpenConnect()
+ {
+ try
+ {
+ await m_webSocket.OpenAsync();
+ }
+ catch (Exception ex)
+ {
+ await RetryConnect();
+ }
+ }
+
+ private async Task DisConnect()
+ {
+ if (m_webSocket != null && m_webSocket.State == WebSocketState.Open)
+ {
+ m_webSocket.Opened -= OnWebSocketOpened;
+ m_webSocket.Closed -= OnWebSocketClosed;
+ m_webSocket.MessageReceived -= OnWebSocketMessageReceived;
+ m_webSocket.Error -= OnWebSocketError;
+ m_autoReconnect = false;
+ await m_webSocket.CloseAsync();
+ m_webSocket = null;
+ }
+ }
+
+ private void ClearRetryTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
+ {
+ if (m_webSocket.State == WebSocketState.Open)
+ {
+ m_clearRetryTimer.Stop();
+ m_retryCount = 0;
+ }
+ }
+
+ private async Task RetryConnect()
+ {
+ var retryTime = 2000 * (m_retryCount);
+
+ m_retryCount++;
+ m_clearRetryTimer.Start();
+
+ await Task.Delay(retryTime);
+
+ await OpenConnect();
+ }
+
+ private void OnWebSocketOpened(object sender, EventArgs e)
+ {
+ // WebSocket 连接已打开
+ }
+
+ private async void OnWebSocketClosed(object sender, EventArgs e)
+ {
+ if (m_autoReconnect)
+ {
+ await RetryConnect();
+ }
+ }
+
+ private void OnWebSocketMessageReceived(object sender, MessageReceivedEventArgs e)
+ {
+ // 处理接收到的消息
+ var msg = JsonConvert.DeserializeObject(e.Message);
+
+ // TODO: 优化代码
+ if (msg.Type == "action")
+ {
+ var mainPage = App.ServiceProvider.GetRequiredService();
+ var mainPageObj = mainPage as Page;
+ mainPageObj.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
+ {
+ if (msg.Action == "ShowMessageToast")
+ {
+ // 解析参数
+ var message = msg.Params["message"]?.ToString();
+ var seconds = msg.Params["seconds"]?.ToObject() ?? 2; // 默认值为2秒
+
+ // 调用Notify.ShowMessageToast方法
+ Notify.ShowMessageToast(message, seconds);
+ }
+ else if (msg.Action == "ExecuteAction")
+ {
+ var name = msg.Params["name"]?.ToString();
+ var shortcutKeyService = App.ServiceProvider.GetRequiredService();
+ shortcutKeyService.ExecuteAction(name);
+ }
+ else if (msg.Action == "SetPosition")
+ {
+ var position = msg.Params["position"]?.ToObject() ?? 0;
+ if (!(mainPage.CurrentPage is PlayPage page)) return;
+ page.SetPosition(position);
+ }
+ });
+ }
+ }
+
+ private void OnWebSocketError(object sender, SuperSocket.ClientEngine.ErrorEventArgs e)
+ {
+ // 处理 WebSocket 错误
+ Debug.WriteLine($"WebSocket error: {e.Exception.Message}");
+ }
+
+ private async Task WakePlugin()
+ {
+ var success = await Launcher.LaunchUriAsync(new Uri(WakeProto));
+ if (!success)
+ {
+ // 处理唤醒失败的情况
+ throw new Exception("Failed to wake the plugin.");
+ }
+ // 等待一段时间让插件启动
+ await Task.Delay(5000);
+ }
+
+ private async Task CheckIsEnable()
+ {
+ try
+ {
+ var response = await $"{CheckUrl}".GetAsync();
+ // 假设如果插件启动了,这个请求会返回200 OK
+ return response.StatusCode == 200;
+ }
+ catch (Exception)
+ {
+ // 如果请求失败,可能意味着插件没有启动
+ return false;
+ }
+ }
+ }
+
+ public static class PluginCenter
+ {
+ public static event EventHandler