Skip to content
This repository was archived by the owner on Sep 19, 2021. It is now read-only.

Commit 6a52c55

Browse files
committed
Patch 4.4 updates and API Key checking.
1 parent 54d01fa commit 6a52c55

File tree

5 files changed

+290
-248
lines changed

5 files changed

+290
-248
lines changed

Mappy/API.cs

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,30 @@ static class API
1616
private static int total = 0;
1717
private static bool requestInAction = false;
1818

19-
//
20-
// Submit data
21-
//
19+
/// <summary>
20+
/// Check an API key can submit data to XIVAPI
21+
/// </summary>
22+
/// <param name="key"></param>
23+
public static async void CheckApiKey(string key)
24+
{
25+
try
26+
{
27+
Logger.Add("Validating XIVAPI key...");
28+
29+
dynamic response = await $"http://xivapi.local/mappy/verify?key={key}".GetJsonAsync();
30+
App.Instance.ToggleSubmitting(response.allowed);
31+
}
32+
catch (Exception ex)
33+
{
34+
Logger.Exception(ex, "Mappy -> CheckApiKey");
35+
}
36+
}
37+
38+
/// <summary>
39+
/// Submit some data (Even if you hard code this, there are server checks XD)
40+
/// </summary>
41+
/// <param name="type"></param>
42+
/// <param name="data"></param>
2243
public static async void SubmitData(string type, List<Entity> data)
2344
{
2445
// if submit turned off
@@ -39,9 +60,9 @@ public static async void SubmitData(string type, List<Entity> data)
3960

4061
try {
4162
// submit to api
42-
await "http://xivapi.local/data/submit".PostJsonAsync(new
63+
string key = Properties.Settings.Default.ApiKey;
64+
await $"http://xivapi.local/mappy/submit?key={key}".PostJsonAsync(new
4365
{
44-
key = Properties.Settings.Default.ApiKey,
4566
id,
4667
type,
4768
data,
@@ -53,9 +74,10 @@ public static async void SubmitData(string type, List<Entity> data)
5374
}
5475
}
5576

56-
//
57-
// Get map image list
58-
//
77+
/// <summary>
78+
/// Get map image from XIVAPI
79+
/// </summary>
80+
/// <param name="id"></param>
5981
public static async void GetMapImage(uint id)
6082
{
6183
// if a request is in action or id is zero, do nothing

Mappy/App.Designer.cs

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Mappy/App.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ private void Initialized()
8787
};
8888
aTimer.Interval = Properties.Settings.Default.ScanTimerSpeed;
8989
aTimer.Enabled = true;
90+
91+
// check key
92+
API.CheckApiKey(Properties.Settings.Default.ApiKey);
9093
}
9194

9295
#region Log View Window
@@ -321,6 +324,18 @@ private void BtnOpenDebug_Click(object sender, EventArgs e)
321324

322325
#region Settings
323326

327+
public void ToggleSubmitting(bool enable)
328+
{
329+
Settings_Submit.Checked = enable;
330+
Properties.Settings.Default.Submit = Settings_Submit.Checked;
331+
Properties.Settings.Default.Save();
332+
333+
Logger.Add(enable
334+
? "XIVAPI key enabled! Data will submit. If you have enabled the API key after memory scan, you will need to restart the app to pickup the existing data."
335+
: "XIVAPI key does not have permission to submit data. Ask @Vekien for permission!"
336+
);
337+
}
338+
324339
private void LoadSettings()
325340
{
326341
TopMost = Properties.Settings.Default.AlwaysOnTop;
@@ -338,12 +353,17 @@ private void Settings_Submit_CheckedChanged(object sender, EventArgs e)
338353
{
339354
Properties.Settings.Default.Submit = Settings_Submit.Checked;
340355
Properties.Settings.Default.Save();
356+
357+
if (Settings_Submit.Checked) {
358+
API.CheckApiKey(Properties.Settings.Default.ApiKey);
359+
}
341360
}
342361

343362
private void Settings_AlwaysOnTop_CheckedChanged(object sender, EventArgs e)
344363
{
345364
Properties.Settings.Default.AlwaysOnTop = Settings_AlwaysOnTop.Checked;
346365
Properties.Settings.Default.Save();
366+
347367
}
348368

349369
private void Settings_MapBoundaries_CheckedChanged(object sender, EventArgs e)

signatures-x64.json

Lines changed: 61 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,149 +1,148 @@
11
[
22
{
3-
"Key": "MAPINFO",
4-
"Value": "E8********CCCCCCCCCC48895C2408574883EC208B05",
3+
"Key": "TARGET",
4+
"Value": "41bc000000e041bd01000000493bc47555488d0d",
55
"ASMSignature": true,
66
"PointerPath": [
77
0,
8-
16
8+
144
99
]
1010
},
1111
{
12-
"Key": "ZONEINFO",
13-
"Value": "8B9084000000E8****0000EB**833D******000275**833D******000075**833D******000074**48C705",
12+
"Key": "CHATLOG",
13+
"Value": "e8********85c0740e488b0d********33D2E8********488b0d",
1414
"ASMSignature": true,
1515
"PointerPath": [
1616
0,
17-
-4
17+
0,
18+
48,
19+
908
1820
]
1921
},
20-
2122
{
23+
"Key": "CHARMAP",
24+
"Value": "488b420848c1e8033da701000077248bc0488d0d",
2225
"ASMSignature": true,
23-
"Key": "TARGET",
2426
"PointerPath": [
2527
0,
26-
144
27-
],
28-
"Value": "41bc000000e041bd01000000493bc47555488d0d"
28+
0
29+
]
2930
},
3031
{
32+
"Key": "PARTYMAP",
33+
"Value": "488D7C242066660F1F840000000000488B17488D0D",
3134
"ASMSignature": true,
32-
"Key": "CHATLOG",
3335
"PointerPath": [
3436
0,
35-
0,
36-
48,
37-
908
38-
],
39-
"Value": "e8********85c0740e488b0d********33D2E8********488b0d"
37+
752
38+
]
4039
},
4140
{
41+
"Key": "PARTYCOUNT",
42+
"Value": "488D7C242066660F1F840000000000488B17488D0D",
4243
"ASMSignature": true,
43-
"Key": "CHARMAP",
4444
"PointerPath": [
4545
0,
46-
0
47-
],
48-
"Value": "488b420848c1e8033da701000077248bc0488d0d"
46+
-26920
47+
]
4948
},
5049
{
50+
"Key": "MAPINFO",
51+
"Value": "E8********CCCCCCCCCC48895C2408574883EC208B05",
5152
"ASMSignature": true,
52-
"Key": "PARTYMAP",
5353
"PointerPath": [
5454
0,
55-
384
56-
],
57-
"Value": "488D7C242066660F1F840000000000488B17488D0D"
55+
16
56+
]
5857
},
5958
{
59+
"Key": "ZONEINFO",
60+
"Value": "8B9084000000E8****0000EB**833D******000275**833D******000075**833D******000074**48C705",
6061
"ASMSignature": true,
61-
"Key": "PARTYCOUNT",
6262
"PointerPath": [
6363
0,
64-
14784
65-
],
66-
"Value": "488D7C242066660F1F840000000000488B17488D0D"
64+
-4
65+
]
6766
},
6867
{
69-
"ASMSignature": true,
7068
"Key": "PLAYERINFO",
69+
"Value": "83f9ff7412448b048e8bd3488d0d",
70+
"ASMSignature": true,
7171
"PointerPath": [
7272
0,
7373
0
74-
],
75-
"Value": "83f9ff7412448b048e8bd3488d0d"
74+
]
7675
},
7776
{
78-
"ASMSignature": true,
7977
"Key": "ENMITYMAP",
78+
"Value": "83f9ff7412448b048e8bd3488d0d",
79+
"ASMSignature": true,
8080
"PointerPath": [
8181
0,
8282
-4656
83-
],
84-
"Value": "83f9ff7412448b048e8bd3488d0d"
83+
]
8584
},
8685
{
87-
"ASMSignature": true,
8886
"Key": "ENMITY_COUNT",
87+
"Value": "83f9ff7412448b048e8bd3488d0d",
88+
"ASMSignature": true,
8989
"PointerPath": [
9090
0,
9191
-2352
92-
],
93-
"Value": "83f9ff7412448b048e8bd3488d0d"
92+
]
9493
},
9594
{
96-
"ASMSignature": true,
9795
"Key": "AGROMAP",
96+
"Value": "83f9ff7412448b048e8bd3488d0d",
97+
"ASMSignature": true,
9898
"PointerPath": [
9999
0,
100100
-2344
101-
],
102-
"Value": "83f9ff7412448b048e8bd3488d0d"
101+
]
103102
},
104103
{
105-
"ASMSignature": true,
106104
"Key": "AGRO_COUNT",
105+
"Value": "83f9ff7412448b048e8bd3488d0d",
106+
"ASMSignature": true,
107107
"PointerPath": [
108108
0,
109109
-40
110-
],
111-
"Value": "83f9ff7412448b048e8bd3488d0d"
110+
]
112111
},
113112
{
114-
"ASMSignature": false,
115113
"Key": "HOTBAR",
114+
"Value": "9C640000000000002C2C000000000000",
115+
"ASMSignature": false,
116116
"PointerPath": [
117117
0,
118-
56,
119-
48,
120-
40,
121-
32,
122-
0,
118+
56,
119+
48,
120+
40,
121+
32,
122+
0,
123123
0
124-
],
125-
"Value": "F783843E****0000"
124+
]
126125
},
127126
{
128-
"ASMSignature": false,
129127
"Key": "RECAST",
128+
"Value": "9C640000000000002C2C000000000000",
129+
"ASMSignature": false,
130130
"PointerPath": [
131131
0,
132-
56,
133-
24,
134-
48,
135-
32,
132+
56,
133+
24,
134+
48,
135+
32,
136136
60
137-
],
138-
"Value": "F783843E****0000"
137+
]
139138
},
140139
{
141-
"ASMSignature": true,
142140
"Key": "INVENTORY",
141+
"Value": "48895C2408488974241048897C2418488B3D",
142+
"ASMSignature": true,
143143
"PointerPath": [
144144
0,
145145
0
146-
],
147-
"Value": "48895C2408488974241048897C2418488B3D"
146+
]
148147
}
149148
]

0 commit comments

Comments
 (0)