Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Titanium-Web-Proxy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Titanium-Web-Proxy
Commits
8311e6b5
Commit
8311e6b5
authored
Nov 20, 2018
by
justcoding121
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#522 fix Uwp startup
parent
2a57f752
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
4 deletions
+44
-4
RunTime.cs
src/Titanium.Web.Proxy/Helpers/RunTime.cs
+41
-0
ProxyServer.cs
src/Titanium.Web.Proxy/ProxyServer.cs
+3
-3
RequestHandler.cs
src/Titanium.Web.Proxy/RequestHandler.cs
+0
-1
No files found.
src/Titanium.Web.Proxy/Helpers/RunTime.cs
View file @
8311e6b5
using
System
;
using
System
;
using
System.Runtime.InteropServices
;
using
System.Text
;
#if NETSTANDARD2_0
#if NETSTANDARD2_0
using
System.Runtime.InteropServices
;
using
System.Runtime.InteropServices
;
#endif
#endif
...
@@ -53,6 +55,7 @@ namespace Titanium.Web.Proxy.Helpers
...
@@ -53,6 +55,7 @@ namespace Titanium.Web.Proxy.Helpers
#else
#else
public
static
bool
IsWindows
=>
!
IsLinux
&&
!
IsMac
;
public
static
bool
IsWindows
=>
!
IsLinux
&&
!
IsMac
;
#endif
#endif
public
static
bool
IsUwpOnWindows
=>
IsWindows
&&
UwpHelper
.
IsRunningAsUwp
();
#if NETSTANDARD2_0
#if NETSTANDARD2_0
public
static
bool
IsMac
=>
isRunningOnMac
;
public
static
bool
IsMac
=>
isRunningOnMac
;
...
@@ -60,5 +63,43 @@ namespace Titanium.Web.Proxy.Helpers
...
@@ -60,5 +63,43 @@ namespace Titanium.Web.Proxy.Helpers
public
static
bool
IsMac
=>
isRunningOnMonoMac
.
Value
;
public
static
bool
IsMac
=>
isRunningOnMonoMac
.
Value
;
#endif
#endif
//https://github.com/qmatteoq/DesktopBridgeHelpers/blob/master/DesktopBridge.Helpers/Helpers.cs
private
class
UwpHelper
{
const
long
APPMODEL_ERROR_NO_PACKAGE
=
15700L
;
[
DllImport
(
"kernel32.dll"
,
CharSet
=
CharSet
.
Unicode
,
SetLastError
=
true
)]
static
extern
int
GetCurrentPackageFullName
(
ref
int
packageFullNameLength
,
StringBuilder
packageFullName
);
internal
static
bool
IsRunningAsUwp
()
{
if
(
IsWindows7OrLower
)
{
return
false
;
}
else
{
int
length
=
0
;
var
sb
=
new
StringBuilder
(
0
);
int
result
=
GetCurrentPackageFullName
(
ref
length
,
sb
);
sb
=
new
StringBuilder
(
length
);
result
=
GetCurrentPackageFullName
(
ref
length
,
sb
);
return
result
!=
APPMODEL_ERROR_NO_PACKAGE
;
}
}
private
static
bool
IsWindows7OrLower
{
get
{
int
versionMajor
=
Environment
.
OSVersion
.
Version
.
Major
;
int
versionMinor
=
Environment
.
OSVersion
.
Version
.
Minor
;
double
version
=
versionMajor
+
(
double
)
versionMinor
/
10
;
return
version
<=
6.1
;
}
}
}
}
}
}
}
src/Titanium.Web.Proxy/ProxyServer.cs
View file @
8311e6b5
...
@@ -102,7 +102,7 @@ namespace Titanium.Web.Proxy
...
@@ -102,7 +102,7 @@ namespace Titanium.Web.Proxy
ProxyEndPoints
=
new
List
<
ProxyEndPoint
>();
ProxyEndPoints
=
new
List
<
ProxyEndPoint
>();
tcpConnectionFactory
=
new
TcpConnectionFactory
(
this
);
tcpConnectionFactory
=
new
TcpConnectionFactory
(
this
);
if
(!
RunTime
.
IsRunningOnMono
&&
RunTime
.
IsWindows
)
if
(!
RunTime
.
IsRunningOnMono
&&
RunTime
.
IsWindows
&&
!
RunTime
.
IsUwpOnWindows
)
{
{
systemProxySettingsManager
=
new
SystemProxyManager
();
systemProxySettingsManager
=
new
SystemProxyManager
();
}
}
...
@@ -542,7 +542,7 @@ namespace Titanium.Web.Proxy
...
@@ -542,7 +542,7 @@ namespace Titanium.Web.Proxy
// clear any system proxy settings which is pointing to our own endpoint (causing a cycle)
// clear any system proxy settings which is pointing to our own endpoint (causing a cycle)
// due to ungracious proxy shutdown before or something else
// due to ungracious proxy shutdown before or something else
if
(
systemProxySettingsManager
!=
null
&&
RunTime
.
IsWindows
)
if
(
systemProxySettingsManager
!=
null
&&
RunTime
.
IsWindows
&&
!
RunTime
.
IsUwpOnWindows
)
{
{
var
proxyInfo
=
systemProxySettingsManager
.
GetProxyInfoFromRegistry
();
var
proxyInfo
=
systemProxySettingsManager
.
GetProxyInfoFromRegistry
();
if
(
proxyInfo
.
Proxies
!=
null
)
if
(
proxyInfo
.
Proxies
!=
null
)
...
@@ -593,7 +593,7 @@ namespace Titanium.Web.Proxy
...
@@ -593,7 +593,7 @@ namespace Titanium.Web.Proxy
throw
new
Exception
(
"Proxy is not running."
);
throw
new
Exception
(
"Proxy is not running."
);
}
}
if
(!
RunTime
.
IsRunningOnMono
&&
RunTime
.
IsWindows
)
if
(!
RunTime
.
IsRunningOnMono
&&
RunTime
.
IsWindows
&&
!
RunTime
.
IsUwpOnWindows
)
{
{
bool
setAsSystemProxy
=
ProxyEndPoints
.
OfType
<
ExplicitProxyEndPoint
>()
bool
setAsSystemProxy
=
ProxyEndPoints
.
OfType
<
ExplicitProxyEndPoint
>()
.
Any
(
x
=>
x
.
IsSystemHttpProxy
||
x
.
IsSystemHttpsProxy
);
.
Any
(
x
=>
x
.
IsSystemHttpProxy
||
x
.
IsSystemHttpsProxy
);
...
...
src/Titanium.Web.Proxy/RequestHandler.cs
View file @
8311e6b5
...
@@ -25,7 +25,6 @@ namespace Titanium.Web.Proxy
...
@@ -25,7 +25,6 @@ namespace Titanium.Web.Proxy
/// </summary>
/// </summary>
public
partial
class
ProxyServer
public
partial
class
ProxyServer
{
{
private
bool
isWindowsAuthenticationEnabledAndSupported
=>
private
bool
isWindowsAuthenticationEnabledAndSupported
=>
EnableWinAuth
&&
RunTime
.
IsWindows
&&
!
RunTime
.
IsRunningOnMono
;
EnableWinAuth
&&
RunTime
.
IsWindows
&&
!
RunTime
.
IsRunningOnMono
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment