mirror of https://github.com/ShareX/ShareX.git
Include host manifest files in app folder
This commit is contained in:
parent
2328863616
commit
bd3a00ee6e
|
@ -50,6 +50,8 @@ Source: "{#MyAppRootDirectory}\Licenses\*.txt"; DestDir: {app}\Licenses; Flags:
|
||||||
Source: "{#MyAppOutputDirectory}\Recorder-devices-setup.exe"; DestDir: {app}; Flags: ignoreversion
|
Source: "{#MyAppOutputDirectory}\Recorder-devices-setup.exe"; DestDir: {app}; Flags: ignoreversion
|
||||||
Source: "{#MyAppOutputDirectory}\ffmpeg.exe"; DestDir: {app}; Flags: ignoreversion
|
Source: "{#MyAppOutputDirectory}\ffmpeg.exe"; DestDir: {app}; Flags: ignoreversion
|
||||||
Source: "{#MyAppReleaseDirectory}\ShareX_NativeMessagingHost.exe"; DestDir: {app}; Flags: ignoreversion
|
Source: "{#MyAppReleaseDirectory}\ShareX_NativeMessagingHost.exe"; DestDir: {app}; Flags: ignoreversion
|
||||||
|
Source: "{#MyAppReleaseDirectory}\host-manifest-chrome.json"; DestDir: {app}; Flags: ignoreversion
|
||||||
|
Source: "{#MyAppReleaseDirectory}\host-manifest-firefox.json"; DestDir: {app}; Flags: ignoreversion
|
||||||
Source: "{#MyAppReleaseDirectory}\de\*.resources.dll"; DestDir: {app}\Languages\de; Flags: ignoreversion
|
Source: "{#MyAppReleaseDirectory}\de\*.resources.dll"; DestDir: {app}\Languages\de; Flags: ignoreversion
|
||||||
Source: "{#MyAppReleaseDirectory}\es\*.resources.dll"; DestDir: {app}\Languages\es; Flags: ignoreversion
|
Source: "{#MyAppReleaseDirectory}\es\*.resources.dll"; DestDir: {app}\Languages\es; Flags: ignoreversion
|
||||||
Source: "{#MyAppReleaseDirectory}\es-MX\*.resources.dll"; DestDir: {app}\Languages\es-MX; Flags: ignoreversion
|
Source: "{#MyAppReleaseDirectory}\es-MX\*.resources.dll"; DestDir: {app}\Languages\es-MX; Flags: ignoreversion
|
||||||
|
|
|
@ -378,6 +378,8 @@ namespace ShareX.Setup
|
||||||
FileHelpers.CopyFiles(RecorderDevicesSetupPath, destination);
|
FileHelpers.CopyFiles(RecorderDevicesSetupPath, destination);
|
||||||
|
|
||||||
FileHelpers.CopyFiles(Path.Combine(source, "ShareX_NativeMessagingHost.exe"), destination);
|
FileHelpers.CopyFiles(Path.Combine(source, "ShareX_NativeMessagingHost.exe"), destination);
|
||||||
|
FileHelpers.CopyFiles(Path.Combine(source, "host-manifest-chrome.json"), destination);
|
||||||
|
FileHelpers.CopyFiles(Path.Combine(source, "host-manifest-firefox.json"), destination);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (string directory in Directory.GetDirectories(source))
|
foreach (string directory in Directory.GetDirectories(source))
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
#region License Information (GPL v3)
|
|
||||||
|
|
||||||
/*
|
|
||||||
ShareX - A program that allows you to take screenshots and share any file type
|
|
||||||
Copyright (c) 2007-2024 ShareX Team
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public License
|
|
||||||
as published by the Free Software Foundation; either version 2
|
|
||||||
of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
|
|
||||||
Optionally you can also view the license at <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#endregion License Information (GPL v3)
|
|
||||||
|
|
||||||
namespace ShareX
|
|
||||||
{
|
|
||||||
public class ChromeManifest
|
|
||||||
{
|
|
||||||
public string name { get; set; }
|
|
||||||
public string description { get; set; }
|
|
||||||
public string path { get; set; }
|
|
||||||
public string type { get; set; }
|
|
||||||
public string[] allowed_origins { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,36 +0,0 @@
|
||||||
#region License Information (GPL v3)
|
|
||||||
|
|
||||||
/*
|
|
||||||
ShareX - A program that allows you to take screenshots and share any file type
|
|
||||||
Copyright (c) 2007-2024 ShareX Team
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public License
|
|
||||||
as published by the Free Software Foundation; either version 2
|
|
||||||
of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
|
|
||||||
Optionally you can also view the license at <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#endregion License Information (GPL v3)
|
|
||||||
|
|
||||||
namespace ShareX
|
|
||||||
{
|
|
||||||
public class FirefoxManifest
|
|
||||||
{
|
|
||||||
public string name { get; set; }
|
|
||||||
public string description { get; set; }
|
|
||||||
public string path { get; set; }
|
|
||||||
public string type { get; set; }
|
|
||||||
public string[] allowed_extensions { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -23,12 +23,10 @@
|
||||||
|
|
||||||
#endregion License Information (GPL v3)
|
#endregion License Information (GPL v3)
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
using ShareX.HelpersLib;
|
using ShareX.HelpersLib;
|
||||||
using ShareX.Properties;
|
using ShareX.Properties;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace ShareX
|
namespace ShareX
|
||||||
|
@ -73,6 +71,8 @@ namespace ShareX
|
||||||
|
|
||||||
private static readonly string ChromeNativeMessagingHosts = @"SOFTWARE\Google\Chrome\NativeMessagingHosts\com.getsharex.sharex";
|
private static readonly string ChromeNativeMessagingHosts = @"SOFTWARE\Google\Chrome\NativeMessagingHosts\com.getsharex.sharex";
|
||||||
private static readonly string FirefoxNativeMessagingHosts = @"SOFTWARE\Mozilla\NativeMessagingHosts\ShareX";
|
private static readonly string FirefoxNativeMessagingHosts = @"SOFTWARE\Mozilla\NativeMessagingHosts\ShareX";
|
||||||
|
private static readonly string ChromeHostManifestFilePath = FileHelpers.GetAbsolutePath("host-manifest-chrome.json");
|
||||||
|
private static readonly string FirefoxHostManifestFilePath = FileHelpers.GetAbsolutePath("host-manifest-firefox.json");
|
||||||
|
|
||||||
public static bool CheckShellContextMenuButton()
|
public static bool CheckShellContextMenuButton()
|
||||||
{
|
{
|
||||||
|
@ -278,8 +278,7 @@ namespace ShareX
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return RegistryHelpers.CheckStringValue(ChromeNativeMessagingHosts, null, Program.ChromeHostManifestFilePath) &&
|
return RegistryHelpers.CheckStringValue(ChromeNativeMessagingHosts, null, ChromeHostManifestFilePath) && File.Exists(ChromeHostManifestFilePath);
|
||||||
File.Exists(Program.ChromeHostManifestFilePath);
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -309,38 +308,13 @@ namespace ShareX
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void CreateChromeHostManifest(string filePath)
|
|
||||||
{
|
|
||||||
FileHelpers.CreateDirectoryFromFilePath(filePath);
|
|
||||||
|
|
||||||
ChromeManifest manifest = new ChromeManifest()
|
|
||||||
{
|
|
||||||
name = "com.getsharex.sharex",
|
|
||||||
description = "ShareX",
|
|
||||||
path = Program.NativeMessagingHostFilePath,
|
|
||||||
type = "stdio",
|
|
||||||
allowed_origins = new string[] { "chrome-extension://nlkoigbdolhchiicbonbihbphgamnaoc/" }
|
|
||||||
};
|
|
||||||
|
|
||||||
string json = JsonConvert.SerializeObject(manifest, Formatting.Indented);
|
|
||||||
|
|
||||||
File.WriteAllText(filePath, json, Encoding.UTF8);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void RegisterChromeExtensionSupport()
|
private static void RegisterChromeExtensionSupport()
|
||||||
{
|
{
|
||||||
CreateChromeHostManifest(Program.ChromeHostManifestFilePath);
|
RegistryHelpers.CreateRegistry(ChromeNativeMessagingHosts, ChromeHostManifestFilePath);
|
||||||
|
|
||||||
RegistryHelpers.CreateRegistry(ChromeNativeMessagingHosts, Program.ChromeHostManifestFilePath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void UnregisterChromeExtensionSupport()
|
private static void UnregisterChromeExtensionSupport()
|
||||||
{
|
{
|
||||||
if (File.Exists(Program.ChromeHostManifestFilePath))
|
|
||||||
{
|
|
||||||
File.Delete(Program.ChromeHostManifestFilePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
RegistryHelpers.RemoveRegistry(ChromeNativeMessagingHosts);
|
RegistryHelpers.RemoveRegistry(ChromeNativeMessagingHosts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -348,8 +322,7 @@ namespace ShareX
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return RegistryHelpers.CheckStringValue(FirefoxNativeMessagingHosts, null, Program.FirefoxHostManifestFilePath) &&
|
return RegistryHelpers.CheckStringValue(FirefoxNativeMessagingHosts, null, FirefoxHostManifestFilePath) && File.Exists(FirefoxHostManifestFilePath);
|
||||||
File.Exists(Program.FirefoxHostManifestFilePath);
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -379,38 +352,13 @@ namespace ShareX
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void CreateFirefoxHostManifest(string filePath)
|
|
||||||
{
|
|
||||||
FileHelpers.CreateDirectoryFromFilePath(filePath);
|
|
||||||
|
|
||||||
FirefoxManifest manifest = new FirefoxManifest()
|
|
||||||
{
|
|
||||||
name = "ShareX",
|
|
||||||
description = "ShareX",
|
|
||||||
path = Program.NativeMessagingHostFilePath,
|
|
||||||
type = "stdio",
|
|
||||||
allowed_extensions = new string[] { "firefox@getsharex.com" }
|
|
||||||
};
|
|
||||||
|
|
||||||
string json = JsonConvert.SerializeObject(manifest, Formatting.Indented);
|
|
||||||
|
|
||||||
File.WriteAllText(filePath, json, Encoding.UTF8);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void RegisterFirefoxAddonSupport()
|
private static void RegisterFirefoxAddonSupport()
|
||||||
{
|
{
|
||||||
CreateFirefoxHostManifest(Program.FirefoxHostManifestFilePath);
|
RegistryHelpers.CreateRegistry(FirefoxNativeMessagingHosts, FirefoxHostManifestFilePath);
|
||||||
|
|
||||||
RegistryHelpers.CreateRegistry(FirefoxNativeMessagingHosts, Program.FirefoxHostManifestFilePath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void UnregisterFirefoxAddonSupport()
|
private static void UnregisterFirefoxAddonSupport()
|
||||||
{
|
{
|
||||||
if (File.Exists(Program.FirefoxHostManifestFilePath))
|
|
||||||
{
|
|
||||||
File.Delete(Program.FirefoxHostManifestFilePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
RegistryHelpers.RemoveRegistry(FirefoxNativeMessagingHosts);
|
RegistryHelpers.RemoveRegistry(FirefoxNativeMessagingHosts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -463,6 +411,8 @@ namespace ShareX
|
||||||
CreateCustomUploaderExtension(false);
|
CreateCustomUploaderExtension(false);
|
||||||
CreateImageEffectExtension(false);
|
CreateImageEffectExtension(false);
|
||||||
CreateSendToMenuButton(false);
|
CreateSendToMenuButton(false);
|
||||||
|
UnregisterChromeExtensionSupport();
|
||||||
|
UnregisterFirefoxAddonSupport();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -161,7 +161,6 @@ namespace ShareX
|
||||||
AppName, PersonalPathConfigFileName);
|
AppName, PersonalPathConfigFileName);
|
||||||
|
|
||||||
private static readonly string PortableCheckFilePath = FileHelpers.GetAbsolutePath("Portable");
|
private static readonly string PortableCheckFilePath = FileHelpers.GetAbsolutePath("Portable");
|
||||||
public static readonly string NativeMessagingHostFilePath = FileHelpers.GetAbsolutePath("ShareX_NativeMessagingHost.exe");
|
|
||||||
public static readonly string SteamInAppFilePath = FileHelpers.GetAbsolutePath("Steam");
|
public static readonly string SteamInAppFilePath = FileHelpers.GetAbsolutePath("Steam");
|
||||||
|
|
||||||
private static string CustomPersonalPath { get; set; }
|
private static string CustomPersonalPath { get; set; }
|
||||||
|
@ -255,10 +254,7 @@ namespace ShareX
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string ToolsFolder => Path.Combine(PersonalFolder, "Tools");
|
|
||||||
public static string ImageEffectsFolder => Path.Combine(PersonalFolder, "ImageEffects");
|
public static string ImageEffectsFolder => Path.Combine(PersonalFolder, "ImageEffects");
|
||||||
public static string ChromeHostManifestFilePath => Path.Combine(ToolsFolder, "Chrome-host-manifest.json");
|
|
||||||
public static string FirefoxHostManifestFilePath => Path.Combine(ToolsFolder, "Firefox-host-manifest.json");
|
|
||||||
|
|
||||||
private static string PersonalPathDetectionMethod;
|
private static string PersonalPathDetectionMethod;
|
||||||
|
|
||||||
|
@ -527,7 +523,6 @@ namespace ShareX
|
||||||
FileHelpers.CreateDirectory(SettingManager.BackupFolder);
|
FileHelpers.CreateDirectory(SettingManager.BackupFolder);
|
||||||
FileHelpers.CreateDirectory(ImageEffectsFolder);
|
FileHelpers.CreateDirectory(ImageEffectsFolder);
|
||||||
FileHelpers.CreateDirectory(ScreenshotsParentFolder);
|
FileHelpers.CreateDirectory(ScreenshotsParentFolder);
|
||||||
FileHelpers.CreateDirectory(ToolsFolder);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,4 +26,12 @@
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="ZXing.Net" Version="0.16.9" />
|
<PackageReference Include="ZXing.Net" Version="0.16.9" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Update="host-manifest-chrome.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="host-manifest-firefox.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"name": "com.getsharex.sharex",
|
||||||
|
"description": "ShareX",
|
||||||
|
"path": "ShareX_NativeMessagingHost.exe",
|
||||||
|
"type": "stdio",
|
||||||
|
"allowed_origins": [
|
||||||
|
"chrome-extension://nlkoigbdolhchiicbonbihbphgamnaoc/"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"name": "ShareX",
|
||||||
|
"description": "ShareX",
|
||||||
|
"path": "ShareX_NativeMessagingHost.exe",
|
||||||
|
"type": "stdio",
|
||||||
|
"allowed_extensions": [
|
||||||
|
"firefox@getsharex.com"
|
||||||
|
]
|
||||||
|
}
|
Loading…
Reference in New Issue