Skip to content

Commit

Permalink
重建播放器客户端
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjz authored and chenjz committed Apr 25, 2024
1 parent abfe88f commit 1311ac2
Show file tree
Hide file tree
Showing 111 changed files with 5,928 additions and 3,440 deletions.
9 changes: 0 additions & 9 deletions Peach.Host/Controllers/CmsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,6 @@ public IActionResult GenerateConfig([NotNull] string fileName, type _type)
List<object> collection = new List<object>();
string site;

//{
//"key": "dr_007影视",
// "name": "007影视(道长)",
// "type": 1,
// "api": "http://b.flash168.top/vod?rule=007影视",
// "searchable": 2,
// "quickSearch": 0,
// "filterable": 1
//},
if (_type == type.js1)
foreach (var file in files)
{
Expand Down
12 changes: 12 additions & 0 deletions Peach.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Peach.Host", "Peach.Host\Pe
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RuleTest", "RuleTest\RuleTest.csproj", "{513948F2-2565-4688-BF5D-9B712C57E014}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PeachPlayer", "PeachPlayer\PeachPlayer.csproj", "{DA9068D2-6A6F-4265-B8F3-99222341B3AD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PeachPlayer.Desktop", "PeachPlayer.Desktop\PeachPlayer.Desktop.csproj", "{666CCF7C-954B-4549-B2A9-03BC37C209CD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -45,6 +49,14 @@ Global
{513948F2-2565-4688-BF5D-9B712C57E014}.Debug|Any CPU.Build.0 = Debug|Any CPU
{513948F2-2565-4688-BF5D-9B712C57E014}.Release|Any CPU.ActiveCfg = Release|Any CPU
{513948F2-2565-4688-BF5D-9B712C57E014}.Release|Any CPU.Build.0 = Release|Any CPU
{DA9068D2-6A6F-4265-B8F3-99222341B3AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DA9068D2-6A6F-4265-B8F3-99222341B3AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DA9068D2-6A6F-4265-B8F3-99222341B3AD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DA9068D2-6A6F-4265-B8F3-99222341B3AD}.Release|Any CPU.Build.0 = Release|Any CPU
{666CCF7C-954B-4549-B2A9-03BC37C209CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{666CCF7C-954B-4549-B2A9-03BC37C209CD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{666CCF7C-954B-4549-B2A9-03BC37C209CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{666CCF7C-954B-4549-B2A9-03BC37C209CD}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Binary file added PeachPlayer.Android/Icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions PeachPlayer.Android/MainActivity.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Android.App;
using Android.Content.PM;

using Avalonia;
using Avalonia.Android;
using Avalonia.ReactiveUI;

namespace PeachPlayer.Android;

[Activity(
Label = "PeachPlayer.Android",
Theme = "@style/MyTheme.NoActionBar",
Icon = "@drawable/icon",
MainLauncher = true,
ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize | ConfigChanges.UiMode)]
public class MainActivity : AvaloniaMainActivity<App>
{
protected override AppBuilder CustomizeAppBuilder(AppBuilder builder)
{
return base.CustomizeAppBuilder(builder)
.WithInterFont()
.UseReactiveUI();
}
}
28 changes: 28 additions & 0 deletions PeachPlayer.Android/PeachPlayer.Android.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0-android</TargetFramework>
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
<Nullable>enable</Nullable>
<ApplicationId>com.CompanyName.AvaloniaTest</ApplicationId>
<ApplicationVersion>1</ApplicationVersion>
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<AndroidPackageFormat>apk</AndroidPackageFormat>
<AndroidEnableProfiledAot>False</AndroidEnableProfiledAot>
</PropertyGroup>

<ItemGroup>
<AndroidResource Include="Icon.png">
<Link>Resources\drawable\Icon.png</Link>
</AndroidResource>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Avalonia.Android" Version="$(AvaloniaVersion)" />
<PackageReference Include="Xamarin.AndroidX.Core.SplashScreen" Version="1.0.1.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\PeachPlayer\PeachPlayer.csproj" />
</ItemGroup>
</Project>
5 changes: 5 additions & 0 deletions PeachPlayer.Android/Properties/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto">
<uses-permission android:name="android.permission.INTERNET" />
<application android:label="AvaloniaTest" android:icon="@drawable/Icon" />
</manifest>
8 changes: 8 additions & 0 deletions PeachPlayer.Android/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"profiles": {
"WSL": {
"commandName": "WSL2",
"distributionName": ""
}
}
}
13 changes: 13 additions & 0 deletions PeachPlayer.Android/Resources/drawable/splash_screen.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

<item>
<color android:color="@color/splash_background"/>
</item>

<item android:drawable="@drawable/icon"
android:width="120dp"
android:height="120dp"
android:gravity="center" />

</layer-list>
4 changes: 4 additions & 0 deletions PeachPlayer.Android/Resources/values-night/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="splash_background">#212121</color>
</resources>
4 changes: 4 additions & 0 deletions PeachPlayer.Android/Resources/values/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="splash_background">#FFFFFF</color>
</resources>
12 changes: 12 additions & 0 deletions PeachPlayer.Android/Resources/values/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<resources>

<style name="MyTheme">
</style>

<style name="MyTheme.NoActionBar" parent="@style/Theme.AppCompat.DayNight.NoActionBar">
<item name="android:windowActionBar">false</item>
<item name="android:windowBackground">@drawable/splash_screen</item>
<item name="android:windowNoTitle">true</item>
</style>
</resources>
5 changes: 5 additions & 0 deletions PeachPlayer.Browser/AppBundle/Logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 74 additions & 0 deletions PeachPlayer.Browser/AppBundle/app.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
:root {
--sat: env(safe-area-inset-top);
--sar: env(safe-area-inset-right);
--sab: env(safe-area-inset-bottom);
--sal: env(safe-area-inset-left);
}

/* HTML styles for the splash screen */

.highlight {
color: white;
font-size: 2.5rem;
display: block;
}

.purple {
color: #8b44ac;
}

.icon {
opacity: 0.05;
height: 35%;
width: 35%;
position: absolute;
background-repeat: no-repeat;
right: 0px;
bottom: 0px;
margin-right: 3%;
margin-bottom: 5%;
z-index: 5000;
background-position: right bottom;
pointer-events: none;
}

#avalonia-splash a {
color: whitesmoke;
text-decoration: none;
}

.center {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}

#avalonia-splash {
position: relative;
height: 100%;
width: 100%;
color: whitesmoke;
background: #1b2a4e;
font-family: 'Nunito', sans-serif;
background-position: center;
background-size: cover;
background-repeat: no-repeat;
justify-content: center;
align-items: center;
}

.splash-close {
animation: fadeout 0.25s linear forwards;
}

@keyframes fadeout {
0% {
opacity: 100%;
}

100% {
opacity: 0;
visibility: collapse;
}
}
Binary file added PeachPlayer.Browser/AppBundle/favicon.ico
Binary file not shown.
30 changes: 30 additions & 0 deletions PeachPlayer.Browser/AppBundle/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>

<head>
<title>AvaloniaTest.Browser</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<base href="/" />
<link rel="modulepreload" href="./main.js" />
<link rel="modulepreload" href="./dotnet.js" />
<link rel="modulepreload" href="./avalonia.js" />
<link rel="stylesheet" href="./app.css" />
</head>

<body style="margin: 0px; overflow: hidden">
<div id="out">
<div id="avalonia-splash">
<div class="center">
<h2 class="purple">
Powered by
<a class="highlight" href="https://www.avaloniaui.net/" target="_blank">Avalonia UI</a>
</h2>
</div>
<img class="icon" src="Logo.svg" alt="Avalonia Logo" />
</div>
</div>
<script type='module' src="./main.js"></script>
</body>

</html>
13 changes: 13 additions & 0 deletions PeachPlayer.Browser/AppBundle/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { dotnet } from './dotnet.js'

const is_browser = typeof window != "undefined";
if (!is_browser) throw new Error(`Expected to be running in a browser`);

const dotnetRuntime = await dotnet
.withDiagnosticTracing(false)
.withApplicationArgumentsFromQuery()
.create();

const config = dotnetRuntime.getConfig();

await dotnetRuntime.runMainAndExit(config.mainAssemblyName, [window.location.search]);
20 changes: 20 additions & 0 deletions PeachPlayer.Browser/PeachPlayer.Browser.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<RuntimeIdentifier>browser-wasm</RuntimeIdentifier>
<WasmMainJSPath>AppBundle\main.js</WasmMainJSPath>
<OutputType>Exe</OutputType>
</PropertyGroup>

<ItemGroup>
<WasmExtraFilesToDeploy Include="AppBundle\**" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Avalonia.Browser" Version="$(AvaloniaVersion)" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\PeachPlayer\PeachPlayer.csproj" />
</ItemGroup>
</Project>
20 changes: 20 additions & 0 deletions PeachPlayer.Browser/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System.Runtime.Versioning;
using System.Threading.Tasks;
using Avalonia;
using Avalonia.Browser;
using Avalonia.ReactiveUI;

using PeachPlayer;

[assembly: SupportedOSPlatform("browser")]

internal partial class Program
{
private static async Task Main(string[] args) => await BuildAvaloniaApp()
.WithInterFont()
.UseReactiveUI()
.StartBrowserAppAsync("out");

public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>();
}
13 changes: 13 additions & 0 deletions PeachPlayer.Browser/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"profiles": {
"PeachPlayer.Browser": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/debug?browser={browserInspectUri}"
}
}
}
11 changes: 11 additions & 0 deletions PeachPlayer.Browser/runtimeconfig.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"wasmHostProperties": {
"perHostConfig": [
{
"name": "browser",
"html-path": "index.html",
"Host": "browser"
}
]
}
}
19 changes: 19 additions & 0 deletions PeachPlayer.Desktop/PeachPlayer.Desktop.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<!--If you are willing to use Windows/MacOS native APIs you will need to create 3 projects.
One for Windows with net7.0-windows TFM, one for MacOS with net7.0-macos and one with net7.0 TFM for Linux.-->
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Avalonia.Desktop" Version="$(AvaloniaVersion)" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\PeachPlayer\PeachPlayer.csproj" />
</ItemGroup>
</Project>
24 changes: 24 additions & 0 deletions PeachPlayer.Desktop/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;

using Avalonia;
using Avalonia.ReactiveUI;

namespace PeachPlayer.Desktop;

class Program
{
// Initialization code. Don't use any Avalonia, third-party APIs or any
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
// yet and stuff might break.
[STAThread]
public static void Main(string[] args) => BuildAvaloniaApp()
.StartWithClassicDesktopLifetime(args);

// Avalonia configuration, don't remove; also used by visual designer.
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UsePlatformDetect()
.WithInterFont()
.LogToTrace()
.UseReactiveUI();
}
Loading

0 comments on commit 1311ac2

Please sign in to comment.