File tree 4 files changed +25
-8
lines changed
4 files changed +25
-8
lines changed Original file line number Diff line number Diff line change 1
1
.vs /
2
2
bin /
3
3
obj /
4
+ * .user
Original file line number Diff line number Diff line change 1
1
/*
2
- - Copyright(C) 2022 Prevter
2
+ - Copyright(C) 2022-2023 Prevter
3
3
-
4
4
- This program is free software: you can redistribute it and/or modify
5
5
- it under the terms of the GNU General Public License as published by
@@ -112,8 +112,10 @@ public App()
112
112
e . SetObserved ( ) ;
113
113
} ;
114
114
115
- //Get path for %AppData%
116
- var appdata = Environment . GetFolderPath ( Environment . SpecialFolder . ApplicationData ) ;
115
+ Utils . GetApiUrl ( ) ;
116
+
117
+ //Get path for %AppData%
118
+ var appdata = Environment . GetFolderPath ( Environment . SpecialFolder . ApplicationData ) ;
117
119
var subfolder = "floattool" ;
118
120
var combined = Path . Combine ( appdata , subfolder ) ;
119
121
Original file line number Diff line number Diff line change 1
1
/*
2
- - Copyright(C) 2022 Prevter
2
+ - Copyright(C) 2022-2023 Prevter
3
3
-
4
4
- This program is free software: you can redistribute it and/or modify
5
5
- it under the terms of the GNU General Public License as published by
23
23
using System . Diagnostics ;
24
24
using System . IO ;
25
25
using System . Linq ;
26
+ using System . Net ;
26
27
using System . Net . Http ;
27
28
using System . Text . RegularExpressions ;
28
29
using System . Threading ;
@@ -99,9 +100,22 @@ public static string FirstCharToUpper(this string input) =>
99
100
100
101
public static class Utils
101
102
{
102
- public const string API_URL = "https://prevter.ml/api/floattool" ;
103
+ public static string API_URL = "" ;
104
+ public static string HOME_URL = "" ;
103
105
private static readonly HttpClient Client = new ( ) ;
104
106
107
+ /// <summary>
108
+ /// Fetches home URL to allow for dynamic updates
109
+ /// </summary>
110
+ public static void GetApiUrl ( )
111
+ {
112
+ string global_settings_url = "https://raw.githubusercontent.com/Prevter/Prevter/main/globals.json" ;
113
+ string global_settings = Client . GetStringAsync ( global_settings_url ) . Result ;
114
+ dynamic json = JsonConvert . DeserializeObject ( global_settings ) ;
115
+ HOME_URL = json [ "home_url" ] + "floattool" ;
116
+ API_URL = json [ "home_url" ] + "api/floattool" ;
117
+ }
118
+
105
119
public static async Task < double > GetWearFromInspectURL ( string inspect_url )
106
120
{
107
121
string url = AppHelpers . Settings . FloatAPI switch
Original file line number Diff line number Diff line change 1
1
/*
2
- - Copyright(C) 2022 Prevter
2
+ - Copyright(C) 2022-2023 Prevter
3
3
-
4
4
- This program is free software: you can redistribute it and/or modify
5
5
- it under the terms of the GNU General Public License as published by
@@ -119,10 +119,10 @@ private void Window_KeyUp(object sender, KeyEventArgs e)
119
119
switch ( e . Key )
120
120
{
121
121
case Key . F1 :
122
- Process . Start ( new ProcessStartInfo { FileName = "https://prevter.ml/floattool /table", UseShellExecute = true } ) ;
122
+ Process . Start ( new ProcessStartInfo { FileName = $ " { Utils . HOME_URL } /table", UseShellExecute = true } ) ;
123
123
break ;
124
124
case Key . F2 :
125
- Process . Start ( new ProcessStartInfo { FileName = "https://prevter.ml/floattool /tools", UseShellExecute = true } ) ;
125
+ Process . Start ( new ProcessStartInfo { FileName = $ " { Utils . HOME_URL } /tools", UseShellExecute = true } ) ;
126
126
break ;
127
127
case Key . F3 :
128
128
string skin = $ "{ ViewModel . WeaponName } | { ViewModel . SkinName } ";
You can’t perform that action at this time.
0 commit comments