mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-02 18:26:27 +13:00
Merge pull request #5822 from Erik3003/master
Added registry check to allow system admins to disable uploads
This commit is contained in:
commit
3ef392c9cd
5 changed files with 48 additions and 0 deletions
|
@ -118,6 +118,7 @@ public static string TitleShort
|
|||
public static bool SteamFirstTimeConfig { get; private set; }
|
||||
public static bool IgnoreHotkeyWarning { get; private set; }
|
||||
public static bool PuushMode { get; private set; }
|
||||
public static bool UploadForbidden { get; private set; }
|
||||
|
||||
internal static ApplicationConfig Settings { get; set; }
|
||||
internal static TaskSettings DefaultTaskSettings { get; set; }
|
||||
|
@ -361,6 +362,7 @@ private static void Run()
|
|||
CheckPuushMode();
|
||||
DebugWriteFlags();
|
||||
|
||||
SetForbiddenUpload();
|
||||
SettingManager.LoadInitialSettings();
|
||||
|
||||
Uploader.UpdateServicePointManager();
|
||||
|
@ -619,6 +621,25 @@ public static bool WritePersonalPathConfig(string path)
|
|||
return false;
|
||||
}
|
||||
|
||||
private static void SetForbiddenUpload()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (RegistryHelpers.CheckRegistry(@"SOFTWARE\ShareX", "UploadForbidden"))
|
||||
{
|
||||
UploadForbidden = RegistryHelpers.CheckRegistry("SOFTWARE\\ShareX", "UploadForbidden", "true");
|
||||
}
|
||||
else
|
||||
{
|
||||
UploadForbidden = RegistryHelpers.CheckRegistry(@"SOFTWARE\ShareX", "UploadForbidden", "true", Microsoft.Win32.RegistryHive.LocalMachine);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugHelper.WriteException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
|
||||
{
|
||||
OnError(e.Exception);
|
||||
|
|
11
ShareX/Properties/Resources.Designer.cs
generated
11
ShareX/Properties/Resources.Designer.cs
generated
|
@ -3117,5 +3117,16 @@ public static string YourAntiVirusSoftwareOrTheControlledFolderAccessFeatureInWi
|
|||
"ShareX", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Your system admin disabled the upload feature..
|
||||
/// </summary>
|
||||
public static string YourSystemAdminDisabledTheUploadFeature
|
||||
{
|
||||
get
|
||||
{
|
||||
return ResourceManager.GetString("YourSystemAdminDisabledTheUploadFeature", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -568,4 +568,10 @@ Soll ShareX neu gestartet werden?</value>
|
|||
<data name="AboutForm_AboutForm_Language_fa_IR" xml:space="preserve">
|
||||
<value>Persisch</value>
|
||||
</data>
|
||||
<data name="ThisFeatureWillNotWorkWhenDisableUploadOptionIsEnabled" xml:space="preserve">
|
||||
<value>Diese Funktion funktioniert nicht, wenn die "DisableUpload"-Option eingeschaltet wurde!</value>
|
||||
</data>
|
||||
<data name="YourSystemAdminDisabledTheUploadFeature" xml:space="preserve">
|
||||
<value>Ihr Systemadministrator hat diese Funktion ausgeschaltet.</value>
|
||||
</data>
|
||||
</root>
|
|
@ -1097,4 +1097,7 @@ Please run ShareX as administrator to change personal folder path.</value>
|
|||
<data name="Discord" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\resources\discord.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="YourSystemAdminDisabledTheUploadFeature" xml:space="preserve">
|
||||
<value>Your system admin disabled the upload feature.</value>
|
||||
</data>
|
||||
</root>
|
|
@ -1797,6 +1797,13 @@ public static void ShowNotificationTip(string text, string title = "ShareX", int
|
|||
|
||||
public static bool IsUploadAllowed()
|
||||
{
|
||||
if (Program.UploadForbidden)
|
||||
{
|
||||
MessageBox.Show(Resources.YourSystemAdminDisabledTheUploadFeature, "ShareX",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
|
||||
return false;
|
||||
}
|
||||
if (Program.Settings.DisableUpload)
|
||||
{
|
||||
MessageBox.Show(Resources.ThisFeatureWillNotWorkWhenDisableUploadOptionIsEnabled, "ShareX",
|
||||
|
|
Loading…
Reference in a new issue