Skip to content

Commit

Permalink
支持设置请求时使用的build值;更新默认使用的build值
Browse files Browse the repository at this point in the history
  • Loading branch information
ywmoyue committed Jan 27, 2024
1 parent acb2ab8 commit 0e724df
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 2 deletions.
13 changes: 13 additions & 0 deletions src/BiliLite.UWP/Models/Common/SettingConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,9 @@ public class Download

}

/// <summary>
/// 开发者选项
/// </summary>
public class Other
{
/// <summary>
Expand Down Expand Up @@ -622,6 +625,16 @@ public class Other
/// 更新json请求地址
/// </summary>
public const string UPDATE_JSON_ADDRESS = "RawRepositoryAddress";

/// <summary>
/// 发起请求时使用的build值
/// </summary>
public const string REQUEST_BUILD = "RequestBuild";

/// <summary>
/// 默认发起请求时使用的build值
/// </summary>
public const string DEFAULT_REQUEST_BUILD = "75900200";
}
}
}
8 changes: 7 additions & 1 deletion src/BiliLite.UWP/Pages/SettingPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@
</PivotItem>
<PivotItem Margin="0">
<PivotItem.Header>
<TextBlock FontSize="15">其他</TextBlock>
<TextBlock FontSize="15">开发者选项</TextBlock>
</PivotItem.Header>
<ScrollViewer Padding="12 0" VerticalScrollBarVisibility="Auto">
<StackPanel>
Expand All @@ -584,6 +584,12 @@
</ComboBox>
<TextBlock Margin="0 8 0 0" FontSize="16">优先使用Grpc请求动态</TextBlock>
<ToggleSwitch x:Name="swFirstGrpcRequestDynamic"></ToggleSwitch>
<TextBlock Margin="0 8 0 8" FontSize="16">发起请求时使用的build值</TextBlock>
<StackPanel Orientation="Horizontal">
<TextBox x:Name="RequestBuildTextBox" PlaceholderText="请输入要使用的build值" Width="200"></TextBox>
<Button x:Name="RequestBuildSaveBtn" Click="RequestBuildSaveBtn_OnClick" Margin="4 0">保存</Button>
<Button x:Name="RequestBuildDefaultBtn" Click="RequestBuildDefaultBtn_OnClick" Margin="4 0">恢复默认</Button>
</StackPanel>
<TextBlock Margin="0 8 0 0" FontSize="16">BiliLite-WebApi(用于处理UWP无法完成的事项)</TextBlock>
<StackPanel Orientation="Horizontal">
<AutoSuggestBox Margin="0 8" x:Name="BiliLiteWebApiTextBox" QueryIcon="Accept" HorizontalAlignment="Left" PlaceholderText="https://example.com/"></AutoSuggestBox>
Expand Down
24 changes: 24 additions & 0 deletions src/BiliLite.UWP/Pages/SettingPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,9 @@ private void LoadOther()
SettingService.SetValue(SettingConstants.Other.FIRST_GRPC_REQUEST_DYNAMIC, swFirstGrpcRequestDynamic.IsOn);
});

RequestBuildTextBox.Text = SettingService.GetValue(SettingConstants.Other.REQUEST_BUILD,
SettingConstants.Other.DEFAULT_REQUEST_BUILD);

// BiliLiteWebApi
BiliLiteWebApiTextBox.Text = SettingService.GetValue(SettingConstants.Other.BILI_LITE_WEB_API_BASE_URL, ApiConstants.BILI_LITE_WEB_API_DEFAULT_BASE_URL);
BiliLiteWebApiTextBox.Loaded += (sender, e) =>
Expand Down Expand Up @@ -1021,5 +1024,26 @@ private void mirrorComboboxSelectAction(object selectedValue)
}
}
}

private void RequestBuildSaveBtn_OnClick(object sender, RoutedEventArgs e)
{
var build = RequestBuildTextBox.Text;
if (string.IsNullOrWhiteSpace(build))
{
Notify.ShowMessageToast("请输入正确的build值");
return;
}

SettingService.SetValue(SettingConstants.Other.REQUEST_BUILD, build);
Notify.ShowMessageToast("已保存");
}

private void RequestBuildDefaultBtn_OnClick(object sender, RoutedEventArgs e)
{
var build = SettingConstants.Other.DEFAULT_REQUEST_BUILD;
SettingService.SetValue(SettingConstants.Other.REQUEST_BUILD, build);
RequestBuildTextBox.Text = build;
Notify.ShowMessageToast("已恢复默认");
}
}
}
4 changes: 3 additions & 1 deletion src/BiliLite.UWP/Services/ApiHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public static class ApiHelper
public static ApiKeyInfo AndroidKey = new ApiKeyInfo(Constants.ANDROID_APP_KEY, "560c52ccd288fed045859ed18bffd973",
Constants.ANDROID_MOBI_APP, Constants.ANDROID_USER_AGENT);

private const string build = "6235200";
private const string _platform = "android";
public static string deviceId = "";
private static int[] mixinKeyEncTab = new int[] {
Expand Down Expand Up @@ -134,6 +133,9 @@ public static string MustParameter(ApiKeyInfo apikey, bool needAccesskey = false
{
url = $"access_key={SettingService.Account.AccessKey}&";
}

var build = SettingService.GetValue(SettingConstants.Other.REQUEST_BUILD,
SettingConstants.Other.DEFAULT_REQUEST_BUILD);

return url + $"appkey={apikey.Appkey}&build={build}&mobi_app={apikey.MobiApp}&platform={_platform}&ts={TimeExtensions.GetTimestampS()}";
}
Expand Down

0 comments on commit 0e724df

Please sign in to comment.