Skip to content

Commit 28b8890

Browse files
committed
Add a header describing Anisette server version
1 parent bd2cf62 commit 28b8890

File tree

2 files changed

+22
-26
lines changed

2 files changed

+22
-26
lines changed

anisette_server/app.d

+20-25
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,18 @@ void main(string[] args) {
2828
bool onlyInit = false;
2929
bool apkDownloadAllowed = true;
3030
auto helpInformation = getopt(
31-
args,
32-
"n|host", format!"The hostname to bind to (default: %s)"(serverConfig.hostname), &serverConfig.hostname,
33-
"p|port", format!"The port to bind to (default: %s)"(serverConfig.hostname), &serverConfig.port,
34-
"r|remember-machine", format!"Whether this machine should be remembered (default: %s)"(rememberMachine), &rememberMachine,
35-
"a|adi-path", format!"Where the provisioning information should be stored on the computer (default: %s)"(path), &path,
36-
"init-only", format!"Download libraries and exit (default: %s)"(onlyInit), &onlyInit,
37-
"can-download", format!"If turned on, may download the dependencies automatically (default: %s)"(apkDownloadAllowed), &apkDownloadAllowed,
31+
args,
32+
"n|host", format!"The hostname to bind to (default: %s)"(serverConfig.hostname), &serverConfig.hostname,
33+
"p|port", format!"The port to bind to (default: %s)"(serverConfig.hostname), &serverConfig.port,
34+
"r|remember-machine", format!"Whether this machine should be remembered (default: %s)"(rememberMachine), &rememberMachine,
35+
"a|adi-path", format!"Where the provisioning information should be stored on the computer (default: %s)"(path), &path,
36+
"init-only", format!"Download libraries and exit (default: %s)"(onlyInit), &onlyInit,
37+
"can-download", format!"If turned on, may download the dependencies automatically (default: %s)"(apkDownloadAllowed), &apkDownloadAllowed,
3838
);
3939

4040
if (helpInformation.helpWanted) {
4141
defaultGetoptPrinter("This program allows you to host anisette through libprovision!", helpInformation.options);
42-
return;
42+
return;
4343
}
4444

4545
auto coreADIPath = libraryPath.buildPath("libCoreADI.so");
@@ -103,12 +103,8 @@ void main(string[] args) {
103103
auto s = new HttpServer((ref ctx) {
104104
auto req = ctx.request;
105105
auto res = ctx.response;
106-
if (req.url == "/version") {
107-
writeln("[<<] GET /version");
108-
res.writeBodyString(anisetteServerVersion);
109-
writeln("[>>] 200 OK");
110-
res.setStatus(200);
111-
} else if (req.url == "/reprovision") {
106+
res.addHeader("Implementation-Version", anisetteServerBranding ~ " " ~ anisetteServerVersion);
107+
if (req.url == "/reprovision") {
112108
writeln("[<<] GET /reprovision");
113109
adi.provisionDevice(rinfo);
114110
writeln("[>>] 200 OK");
@@ -136,16 +132,16 @@ void main(string[] args) {
136132
import std.json;
137133

138134
JSONValue response = [
139-
"X-Apple-I-Client-Time": time.toISOExtString.split('.')[0] ~ "Z",
140-
"X-Apple-I-MD": Base64.encode(otp),
141-
"X-Apple-I-MD-M": Base64.encode(mid),
142-
"X-Apple-I-MD-RINFO": to!string(rinfo),
143-
"X-Apple-I-MD-LU": adi.localUserUUID,
144-
"X-Apple-I-SRL-NO": adi.serialNo,
145-
"X-MMe-Client-Info": adi.clientInfo,
146-
"X-Apple-I-TimeZone": time.timezone.dstName,
147-
"X-Apple-Locale": "en_US",
148-
"X-Mme-Device-Id": adi.deviceId,
135+
"X-Apple-I-Client-Time": time.toISOExtString.split('.')[0] ~ "Z",
136+
"X-Apple-I-MD": Base64.encode(otp),
137+
"X-Apple-I-MD-M": Base64.encode(mid),
138+
"X-Apple-I-MD-RINFO": to!string(rinfo),
139+
"X-Apple-I-MD-LU": adi.localUserUUID,
140+
"X-Apple-I-SRL-NO": adi.serialNo,
141+
"X-MMe-Client-Info": adi.clientInfo,
142+
"X-Apple-I-TimeZone": time.timezone.dstName,
143+
"X-Apple-Locale": "en_US",
144+
"X-Mme-Device-Id": adi.deviceId,
149145
];
150146

151147
writefln!"[>>] 200 OK %s"(response);
@@ -163,4 +159,3 @@ void main(string[] args) {
163159
writeln("Ready! Serving data.");
164160
s.start();
165161
}
166-

anisette_server/constants.d

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
module constants;
22

3-
enum anisetteServerVersion = "1.2.0";
3+
enum anisetteServerBranding = "anisette-server-provision";
4+
enum anisetteServerVersion = "1.2.1";
45
enum nativesUrl = "https://apps.mzstatic.com/content/android-apple-music-apk/applemusic.apk";

0 commit comments

Comments
 (0)