Skip to content

Commit 0cc572c

Browse files
committed
working now
1 parent ed15482 commit 0cc572c

File tree

6 files changed

+96
-9
lines changed

6 files changed

+96
-9
lines changed

extensions/spotify/build.gradle.kts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import com.android.build.gradle.internal.tasks.factory.dependsOn
22
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
33

44
plugins {
5+
alias(libs.plugins.protobuf)
56
id("com.github.johnrengelman.shadow") version "8.1.1"
67
}
78

@@ -27,6 +28,7 @@ val relocateTask by tasks.register<ShadowJar>("relocateTask") {
2728
configurations = listOf(internalize)
2829

2930
relocate("okhttp3", "app.revanced.extensions.spotify.okhttp3")
31+
// relocate("com.google.protobuf", "app.revanced.extensions.spotify.com.google.protobuf")
3032
}
3133

3234
tasks.build.dependsOn(relocateTask)
@@ -59,3 +61,19 @@ android {
5961
}
6062
}
6163
}
64+
65+
protobuf {
66+
protoc {
67+
artifact = libs.protobuf.protoc.get().toString()
68+
}
69+
70+
generateProtoTasks {
71+
all().forEach { task ->
72+
task.builtins {
73+
create("java") {
74+
option("lite")
75+
}
76+
}
77+
}
78+
}
79+
}

extensions/spotify/src/main/java/app/revanced/extension/spotify/misc/fix/ClientTokenService.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
import androidx.annotation.NonNull;
44
import androidx.annotation.Nullable;
55
import app.revanced.extension.shared.Logger;
6-
import com.spotify.clienttoken.data.v0.Connectivity.*;
7-
import com.spotify.clienttoken.http.v0.ClientToken.*;
6+
import app.revanced.extension.spotify.misc.fix.clienttoken.data.v0.ClienttokenHttp.*;
87

98
import java.io.IOException;
109
import java.io.InputStream;

extensions/spotify/src/main/java/app/revanced/extension/spotify/misc/fix/RequestListener.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
import androidx.annotation.NonNull;
44
import app.revanced.extension.shared.Logger;
5+
import app.revanced.extension.spotify.misc.fix.clienttoken.data.v0.ClienttokenHttp;
6+
import app.revanced.extension.spotify.misc.fix.clienttoken.data.v0.ClienttokenHttp.ClientTokenResponse;
57
import com.google.protobuf.MessageLite;
6-
import com.spotify.clienttoken.http.v0.ClientToken.ClientTokenResponse;
78
import fi.iki.elonen.NanoHTTPD;
8-
import xyz.gianlu.librespot.core.Session;
99

1010
import java.io.ByteArrayInputStream;
1111
import java.io.FilterInputStream;

extensions/spotify/src/main/java/app/revanced/extension/spotify/misc/fix/SpoofClientPatch.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ public synchronized static void launchListener(int port) {
4747

4848
AndroidZeroconfServer.Builder builder = new AndroidZeroconfServer.Builder(Utils.getContext(), conf)
4949
.setPreferredLocale(Locale.getDefault().getLanguage())
50-
.setDeviceType(Connect.DeviceType.COMPUTER)
51-
.setDeviceId("81983a3578aef8351b1e948ef8d6e3652bc7d001")
50+
.setDeviceType(Connect.DeviceType.AUDIO_DONGLE)
5251
.setDeviceName("ReVanced");
5352

5453
server = builder.create();
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
syntax = "proto3";
2+
3+
package spotify.clienttoken.data.v0;
4+
5+
option optimize_for = LITE_RUNTIME;
6+
option java_package = "app.revanced.extension.spotify.misc.fix.clienttoken.data.v0";
7+
8+
message ClientTokenRequest {
9+
ClientTokenRequestType request_type = 1;
10+
11+
oneof request {
12+
ClientDataRequest client_data = 2;
13+
}
14+
}
15+
16+
enum ClientTokenRequestType {
17+
REQUEST_UNKNOWN = 0;
18+
REQUEST_CLIENT_DATA_REQUEST = 1;
19+
REQUEST_CHALLENGE_ANSWERS_REQUEST = 2;
20+
}
21+
22+
message ClientDataRequest {
23+
string client_version = 1;
24+
string client_id = 2;
25+
26+
oneof data {
27+
ConnectivitySdkData connectivity_sdk_data = 3;
28+
}
29+
}
30+
31+
message ConnectivitySdkData {
32+
PlatformSpecificData platform_specific_data = 1;
33+
string device_id = 2;
34+
}
35+
36+
message PlatformSpecificData {
37+
oneof data {
38+
NativeIOSData ios = 2;
39+
}
40+
}
41+
42+
message NativeIOSData {
43+
int32 user_interface_idiom = 1;
44+
bool target_iphone_simulator = 2;
45+
string hw_machine = 3;
46+
string system_version = 4;
47+
string simulator_model_identifier = 5;
48+
}
49+
50+
message ClientTokenResponse {
51+
ClientTokenResponseType response_type = 1;
52+
53+
oneof response {
54+
GrantedTokenResponse granted_token = 2;
55+
}
56+
}
57+
58+
enum ClientTokenResponseType {
59+
RESPONSE_UNKNOWN = 0;
60+
RESPONSE_GRANTED_TOKEN_RESPONSE = 1;
61+
RESPONSE_CHALLENGES_RESPONSE = 2;
62+
}
63+
64+
message GrantedTokenResponse {
65+
string token = 1;
66+
int32 expires_after_seconds = 2;
67+
int32 refresh_after_seconds = 3;
68+
repeated TokenDomain domains = 4;
69+
}
70+
71+
message TokenDomain {
72+
string domain = 1;
73+
}

gradle/libs.versions.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ appcompat = "1.7.0"
1111
okhttp = "5.0.0-alpha.14"
1212
retrofit = "2.11.0"
1313
guava = "33.4.0-jre"
14-
protobuf-javalite = "4.31.1"
15-
protoc = "4.31.1"
14+
protoc = "3.25.2"
1615
protobuf = "0.9.5"
1716
antlr4 = "4.13.2"
1817
nanohttpd = "2.3.1"
@@ -24,7 +23,6 @@ antlr4 = { module = "org.antlr:antlr4", version.ref = "antlr4" }
2423
appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
2524
nanohttpd = { module = "org.nanohttpd:nanohttpd", version.ref = "nanohttpd" }
2625
okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
27-
protobuf-javalite = { module = "com.google.protobuf:protobuf-javalite", version.ref = "protobuf-javalite" }
2826
protobuf-protoc = { module = "com.google.protobuf:protoc", version.ref = "protoc" }
2927
retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" }
3028
guava = { module = "com.google.guava:guava", version.ref = "guava" }

0 commit comments

Comments
 (0)