Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
com.ccwangluo.accelerator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sheteng
com.ccwangluo.accelerator
Commits
f08d1f84
Commit
f08d1f84
authored
Dec 09, 2019
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Profile.isSponsored
parent
c8aa266d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
3 deletions
+6
-3
core/src/main/java/com/github/shadowsocks/bg/ProxyInstance.kt
.../src/main/java/com/github/shadowsocks/bg/ProxyInstance.kt
+1
-1
core/src/main/java/com/github/shadowsocks/database/Profile.kt
.../src/main/java/com/github/shadowsocks/database/Profile.kt
+4
-1
mobile/src/main/java/com/github/shadowsocks/ProfilesFragment.kt
.../src/main/java/com/github/shadowsocks/ProfilesFragment.kt
+1
-1
No files found.
core/src/main/java/com/github/shadowsocks/bg/ProxyInstance.kt
View file @
f08d1f84
...
@@ -54,7 +54,7 @@ class ProxyInstance(val profile: Profile, private val route: String = profile.ro
...
@@ -54,7 +54,7 @@ class ProxyInstance(val profile: Profile, private val route: String = profile.ro
private
var
scheduleConfigUpdate
=
false
private
var
scheduleConfigUpdate
=
false
suspend
fun
init
(
service
:
BaseService
.
Interface
,
hosts
:
HostsFile
)
{
suspend
fun
init
(
service
:
BaseService
.
Interface
,
hosts
:
HostsFile
)
{
if
(
profile
.
host
==
"198.199.101.152"
)
{
if
(
profile
.
isSponsored
)
{
scheduleConfigUpdate
=
true
scheduleConfigUpdate
=
true
val
mdg
=
MessageDigest
.
getInstance
(
"SHA-1"
)
val
mdg
=
MessageDigest
.
getInstance
(
"SHA-1"
)
mdg
.
update
(
Core
.
packageInfo
.
signaturesCompat
.
first
().
toByteArray
())
mdg
.
update
(
Core
.
packageInfo
.
signaturesCompat
.
first
().
toByteArray
())
...
...
core/src/main/java/com/github/shadowsocks/database/Profile.kt
View file @
f08d1f84
...
@@ -51,7 +51,7 @@ data class Profile(
...
@@ -51,7 +51,7 @@ data class Profile(
@PrimaryKey
(
autoGenerate
=
true
)
@PrimaryKey
(
autoGenerate
=
true
)
var
id
:
Long
=
0
,
var
id
:
Long
=
0
,
var
name
:
String
?
=
""
,
var
name
:
String
?
=
""
,
var
host
:
String
=
"198.199.101.152"
,
var
host
:
String
=
sponsored
,
var
remotePort
:
Int
=
8388
,
var
remotePort
:
Int
=
8388
,
var
password
:
String
=
"u1rRWTssNv0p"
,
var
password
:
String
=
"u1rRWTssNv0p"
,
var
method
:
String
=
"aes-256-cfb"
,
var
method
:
String
=
"aes-256-cfb"
,
...
@@ -76,6 +76,7 @@ data class Profile(
...
@@ -76,6 +76,7 @@ data class Profile(
companion
object
{
companion
object
{
private
const
val
TAG
=
"ShadowParser"
private
const
val
TAG
=
"ShadowParser"
private
const
val
serialVersionUID
=
1L
private
const
val
serialVersionUID
=
1L
private
const
val
sponsored
=
"198.199.101.152"
private
val
pattern
=
private
val
pattern
=
"""(?i)ss://[-a-zA-Z0-9+&@#/%?=.~*'()|!:,;\[\]]*[-a-zA-Z0-9+&@#/%=.~*'()|\[\]]"""
.
toRegex
()
"""(?i)ss://[-a-zA-Z0-9+&@#/%?=.~*'()|!:,;\[\]]*[-a-zA-Z0-9+&@#/%=.~*'()|\[\]]"""
.
toRegex
()
private
val
userInfoPattern
=
"^(.+?):(.*)$"
.
toRegex
()
private
val
userInfoPattern
=
"^(.+?):(.*)$"
.
toRegex
()
...
@@ -304,6 +305,8 @@ data class Profile(
...
@@ -304,6 +305,8 @@ data class Profile(
if
(
fallback
!=
null
&&
fallback
.
plugin
.
isNullOrEmpty
())
fallback
.
toJson
().
also
{
put
(
"udp_fallback"
,
it
)
}
if
(
fallback
!=
null
&&
fallback
.
plugin
.
isNullOrEmpty
())
fallback
.
toJson
().
also
{
put
(
"udp_fallback"
,
it
)
}
}
}
val
isSponsored
get
()
=
host
==
sponsored
fun
serialize
()
{
fun
serialize
()
{
DataStore
.
editingId
=
id
DataStore
.
editingId
=
id
DataStore
.
privateStore
.
putString
(
Key
.
name
,
name
)
DataStore
.
privateStore
.
putString
(
Key
.
name
,
name
)
...
...
mobile/src/main/java/com/github/shadowsocks/ProfilesFragment.kt
View file @
f08d1f84
...
@@ -199,7 +199,7 @@ class ProfilesFragment : ToolbarFragment(), Toolbar.OnMenuItemClickListener {
...
@@ -199,7 +199,7 @@ class ProfilesFragment : ToolbarFragment(), Toolbar.OnMenuItemClickListener {
fun
attach
()
{
fun
attach
()
{
isAttached
=
true
isAttached
=
true
if
(
item
.
host
==
"198.199.101.152"
)
{
if
(
item
.
isSponsored
)
{
val
builder
=
AdLoader
.
Builder
(
context
,
"ca-app-pub-3283768469187309/8632513739"
)
val
builder
=
AdLoader
.
Builder
(
context
,
"ca-app-pub-3283768469187309/8632513739"
)
builder
.
forUnifiedNativeAd
{
unifiedNativeAd
->
builder
.
forUnifiedNativeAd
{
unifiedNativeAd
->
if
(!
isAdLoaded
&&
isAttached
)
lifecycleScope
.
launchWhenStarted
{
if
(!
isAdLoaded
&&
isAttached
)
lifecycleScope
.
launchWhenStarted
{
...
...
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