mirror of
https://github.com/Difegue/Karen
synced 2025-01-08 11:58:02 +08:00
Switch to using a native Redis server
This commit is contained in:
parent
d3f57ee86b
commit
f6b5da8dc1
23
Karen/Interop/RedisServer.cs
Normal file
23
Karen/Interop/RedisServer.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Karen.Interop
|
||||
{
|
||||
public static class RedisServer
|
||||
{
|
||||
|
||||
public static void Start(string contentFolder)
|
||||
{
|
||||
Process.Start(new ProcessStartInfo(".\\Redis\\redis-server.exe", $".\\Redis\\redis.conf --dir '{contentFolder}/' --daemonize yes") { UseShellExecute = false });
|
||||
}
|
||||
|
||||
public static void Stop()
|
||||
{
|
||||
Process.Start(new ProcessStartInfo("taskkill", "/F /IM redis-server.exe") { UseShellExecute = false});
|
||||
}
|
||||
}
|
||||
}
|
@ -87,8 +87,10 @@ namespace Karen.Interop
|
||||
string contentFolder = GetWSLPath(winPath);
|
||||
string thumbnailFolder = string.IsNullOrWhiteSpace(thumbPath) ? contentFolder + "/thumb" : GetWSLPath(thumbPath);
|
||||
|
||||
var wslCommands = new List<string>();
|
||||
// Start native Redis server
|
||||
RedisServer.Start(winPath);
|
||||
|
||||
var wslCommands = new List<string>();
|
||||
|
||||
var driveLetter = winPath.Split('\\')[0];
|
||||
if (!IsLocalDrive(driveLetter))
|
||||
@ -114,8 +116,7 @@ namespace Karen.Interop
|
||||
wslCommands.Add($"export LRR_DATA_DIRECTORY='{contentFolder}'");
|
||||
wslCommands.Add($"export LRR_THUMB_DIRECTORY='{thumbnailFolder}'");
|
||||
wslCommands.Add($"cd /home/koyomi/lanraragi && rm -f public/temp/server.pid");
|
||||
wslCommands.Add($"mkdir -p log && mkdir -p content && mkdir -p database && sysctl vm.overcommit_memory=1");
|
||||
wslCommands.Add($"redis-server /home/koyomi/lanraragi/tools/build/docker/redis.conf --dir '{contentFolder}/' --daemonize yes");
|
||||
wslCommands.Add($"mkdir -p log && mkdir -p content && mkdir -p database");
|
||||
wslCommands.Add($"perl ./script/launcher.pl -f ./script/lanraragi");
|
||||
|
||||
// Concat all commands into one string we'll throw at WSL
|
||||
@ -139,7 +140,9 @@ namespace Karen.Interop
|
||||
}
|
||||
|
||||
public bool? StopApp()
|
||||
{
|
||||
{
|
||||
RedisServer.Stop();
|
||||
|
||||
// Kill WSL Process
|
||||
if (_lrrProc != null && !_lrrProc.HasExited)
|
||||
{
|
||||
|
@ -70,7 +70,7 @@
|
||||
<Separator Height="12" Margin="0"/>
|
||||
<TextBlock Style="{StaticResource BodyTextBlockStyle}">
|
||||
You're using the <Hyperlink NavigateUri="https://github.com/Difegue/Karen" RequestNavigate="Hyperlink_RequestNavigate">Karen</Hyperlink> Bootstrapper for <Hyperlink NavigateUri="https://github.com/Difegue/LANraragi" RequestNavigate="Hyperlink_RequestNavigate">LANraragi</Hyperlink>,
|
||||
<LineBreak/> Version 2.7 <emoji:TextBlock Text="🐝"/>
|
||||
<LineBreak/> Version 2.8 <emoji:TextBlock Text="🐝"/>
|
||||
<LineBreak/>
|
||||
<emoji:TextBlock Text="✨"/> Consider installing <Hyperlink NavigateUri="ms-windows-store://pdp/?ProductId=9MZ6BWWVSWJH&mode=mini" RequestNavigate="Hyperlink_RequestNavigate">LRReader</Hyperlink> from the Microsoft Store! <emoji:TextBlock Text="✨"/>
|
||||
<LineBreak/>
|
||||
|
@ -40,9 +40,9 @@ namespace Setup
|
||||
var project = new Project("LANraragi",
|
||||
new Dir(@"%AppData%\LANraragi",
|
||||
new Files(@"..\Karen\bin\Release\net472\win7-x64\*.*"),
|
||||
new Files(@"..\External\Redis\*.*"),
|
||||
new File(@"..\DistroInstaller\bin\Release\net472\win7-x64\DistroInstaller.exe"), //DesktopBridge.Helpers.dll already in the global Files match above
|
||||
new File(@"..\External\package.tar"),
|
||||
new Dir(@"..\External\Redis"),
|
||||
uninstallerShortcut
|
||||
),
|
||||
new Dir(@"%ProgramMenu%\LANraragi for Windows",
|
||||
|
Loading…
Reference in New Issue
Block a user