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

Commit 61ee42f

Browse files
committed
fix: error page on hash mistmatch
Also rebranded all code to be argon instead of tmod and other fixes!
1 parent 3cc593f commit 61ee42f

26 files changed

+313
-245
lines changed

.github/workflows/flutterci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ jobs:
4646
- uses: subosito/flutter-action@v1
4747
with:
4848
channel: 'stable'
49+
cache: true
4950
- run: sudo apt-get update -y
5051
- run: sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev vlc libvlc-dev libwebkit2gtk-4.0-dev libmediainfo-dev dpkg-dev alien
5152
- run: flutter config --enable-linux-desktop

.vscode/settings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"licenser.license": "CC-BY-NC-ND-3",
3-
"licenser.projectName": "TMOD Installer",
3+
"licenser.projectName": "ArgonInstaller",
44
"licenser.author": "Tricked-dev <[email protected]>",
55
"deno.enable": false
66
}

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ ArgonInstaller is a cross platform mod installer and updater you can use it with
3535

3636
Feather "client" is currently both windows only and paid, and free alternatives such as Skyclient don't support importing custom mod your own custom repos. This makes it tedious to add your own mods and keep them updated. ArgonInstaller aims to fix this issue allowing anyone to maintain a repo with their favorite mods and update it themself
3737

38-
## Argon Installer art
38+
## ArgonInstaller art
3939

40-
The current Argon installer art can be found here: <https://www.figma.com/file/iH6zwbkTFIYeCuSMYHJxs1/TMOD-INSTALLER?node-id=0%3A1> feel free to dm me if your interested into making/have made new art to use anything is probably better than this same goes for the name of the project if you have a better idea lol.
40+
The current Argon installer art can be found here: <https://www.figma.com/file/iH6zwbkTFIYeCuSMYHJxs1/Argon-INSTALLER?node-id=0%3A1> feel free to dm me if your interested into making/have made new art to use anything is probably better than this same goes for the name of the project if you have a better idea lol.
4141

4242
## Flutter guide - Contributing
4343

lib/config.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// TMOD Installer (c) by tricked
1+
// ArgonInstaller (c) by tricked
22
//
3-
// TMOD Installer is licensed under a
3+
// ArgonInstaller is licensed under a
44
// Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
55
//
66
// You should have received a copy of the license along with this

lib/main.dart

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// TMOD Installer (c) by tricked
1+
// ArgonInstaller (c) by tricked
22
//
3-
// TMOD Installer is licensed under a
3+
// ArgonInstaller is licensed under a
44
// Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
55
//
66
// You should have received a copy of the license along with this
@@ -50,11 +50,11 @@ void main(List<String> args) async {
5050
await windowManager.setSkipTaskbar(false);
5151
});
5252

53-
runApp(const TModInstallerApp());
53+
runApp(const ArgonInstallerApp());
5454
}
5555

56-
class TModInstallerApp extends StatelessWidget {
57-
const TModInstallerApp({Key? key}) : super(key: key);
56+
class ArgonInstallerApp extends StatelessWidget {
57+
const ArgonInstallerApp({Key? key}) : super(key: key);
5858

5959
// This widget is the root of your application.
6060
@override
@@ -110,24 +110,24 @@ class TModInstallerApp extends StatelessWidget {
110110
initialRoute: '/',
111111
routes: {
112112
'/': (_) =>
113-
const TModInstallerPage(title: 'Tricked mod Installer')
113+
const ArgonInstallerPage(title: 'Tricked mod Installer')
114114
},
115-
// home: const TModInstallerPage(title: 'Tricked mod Installer'),
115+
// home: const ArgonInstallerPage(title: 'Tricked mod Installer'),
116116
);
117117
});
118118
}
119119
}
120120

121-
class TModInstallerPage extends StatefulWidget {
122-
const TModInstallerPage({Key? key, required this.title}) : super(key: key);
121+
class ArgonInstallerPage extends StatefulWidget {
122+
const ArgonInstallerPage({Key? key, required this.title}) : super(key: key);
123123

124124
final String title;
125125

126126
@override
127-
State<TModInstallerPage> createState() => _TModInstallerPageState();
127+
State<ArgonInstallerPage> createState() => _ArgonInstallerPageState();
128128
}
129129

130-
class _TModInstallerPageState extends State<TModInstallerPage> {
130+
class _ArgonInstallerPageState extends State<ArgonInstallerPage> {
131131
@override
132132
void initState() {
133133
super.initState();
@@ -183,7 +183,7 @@ class _TModInstallerPageState extends State<TModInstallerPage> {
183183
// return const DragToMoveArea(
184184
// child: Align(
185185
// alignment: AlignmentDirectional.centerStart,
186-
// child: Text("TMod Installer"),
186+
// child: Text("Argon Installer"),
187187
// ),
188188
// );
189189
// }(),

lib/src/models/models.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// TMOD Installer (c) by tricked
1+
// ArgonInstaller (c) by tricked
22
//
3-
// TMOD Installer is licensed under a
3+
// ArgonInstaller is licensed under a
44
// Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
55
//
66
// You should have received a copy of the license along with this

lib/src/screens/launcher.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// TMOD Installer (c) by Tricked-dev <[email protected]>
1+
// ArgonInstaller (c) by Tricked-dev <[email protected]>
22
//
3-
// TMOD Installer is licensed under a
3+
// ArgonInstaller is licensed under a
44
// Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
55
//
66
// You should have received a copy of the license along with this

lib/src/screens/mod.dart

+19-17
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// TMOD Installer (c) by Tricked-dev <[email protected]>
1+
// ArgonInstaller (c) by Tricked-dev <[email protected]>
22
//
3-
// TMOD Installer is licensed under a
3+
// ArgonInstaller is licensed under a
44
// Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
55
//
66
// You should have received a copy of the license along with this
@@ -183,25 +183,12 @@ class _ModScreenState extends State<ModScreen> {
183183
return FutureBuilder(
184184
future: installMod(mod, version, widget.mcv),
185185
builder: (context, snapshot) {
186-
if (snapshot.connectionState == ConnectionState.done) {
187-
return ContentDialog(
188-
title: const Text("Mod installed!"),
189-
content:
190-
const Text("Succesfully installed the mod - press esc to exit"),
191-
actions: <Widget>[
192-
FilledButton(
193-
onPressed: () {
194-
Navigator.of(context).pop();
195-
},
196-
child: const Text('Close'),
197-
),
198-
],
199-
);
200-
}
201186
if (snapshot.hasError) {
202187
if (snapshot.error is HashingError) {
203188
return ContentDialog(
204189
title: Text((snapshot.error as HashingError).reason),
190+
content:
191+
SelectableText((snapshot.error as HashingError).description),
205192
actions: <Widget>[
206193
FilledButton(
207194
onPressed: () {
@@ -225,6 +212,21 @@ class _ModScreenState extends State<ModScreen> {
225212
],
226213
);
227214
}
215+
if (snapshot.connectionState == ConnectionState.done) {
216+
return ContentDialog(
217+
title: const Text("Mod installed!"),
218+
content: const Text("Successfully installed the mod"),
219+
actions: <Widget>[
220+
FilledButton(
221+
onPressed: () {
222+
Navigator.of(context).pop();
223+
},
224+
child: const Text('Close'),
225+
),
226+
],
227+
);
228+
}
229+
228230
return ContentDialog(
229231
title: Text('Installing ${mod.display} ${version.version}'),
230232
content: Row(

lib/src/screens/modlist.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// TMOD Installer (c) by tricked
1+
// ArgonInstaller (c) by tricked
22
//
3-
// TMOD Installer is licensed under a
3+
// ArgonInstaller is licensed under a
44
// Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
55
//
66
// You should have received a copy of the license along with this

lib/src/screens/settings.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// TMOD Installer (c) by tricked
1+
// ArgonInstaller (c) by tricked
22
//
3-
// TMOD Installer is licensed under a
3+
// ArgonInstaller is licensed under a
44
// Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
55
//
66
// You should have received a copy of the license along with this
@@ -284,7 +284,7 @@ class _SettingsState extends State<Settings> {
284284
),
285285
spacer,
286286
const Text(
287-
"TMod Installer created by Tricked-dev licensed under: Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License."),
287+
"Argon Installer created by Tricked-dev licensed under: Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License."),
288288
],
289289
);
290290
}

lib/src/screens/updater.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// TMOD Installer (c) by tricked
1+
// ArgonInstaller (c) by tricked
22
//
3-
// TMOD Installer is licensed under a
3+
// ArgonInstaller is licensed under a
44
// Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
55
//
66
// You should have received a copy of the license along with this

lib/src/screens/version.dart

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
// TMOD Installer (c) by Tricked-dev <[email protected]>
1+
// ArgonInstaller (c) by Tricked-dev <[email protected]>
22
//
3-
// TMOD Installer is licensed under a
3+
// ArgonInstaller is licensed under a
44
// Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
55
//
66
// You should have received a copy of the license along with this
77
// work. If not, see <http://creativecommons.org/licenses/by-nc-nd/3.0/>.
88

9-
// TMOD Installer (c) by tricked
9+
// ArgonInstaller (c) by tricked
1010
//
11-
// TMOD Installer is licensed under a
11+
// ArgonInstaller is licensed under a
1212
// Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
1313
//
1414
// You should have received a copy of the license along with this
@@ -66,7 +66,8 @@ class _VersionPage extends State<VersionPage> {
6666

6767
@override
6868
Widget build(BuildContext context) {
69-
Directory("${Config.appDir}/modlists/${widget.version}/").create(recursive: true);
69+
Directory("${Config.appDir}/modlists/${widget.version}/")
70+
.create(recursive: true);
7071
final padding = PageHeader.horizontalPadding(context);
7172

7273
return Container(

lib/src/utils.dart

+11-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// TMOD Installer (c) by tricked
1+
// ArgonInstaller (c) by tricked
22
//
3-
// TMOD Installer is licensed under a
3+
// ArgonInstaller is licensed under a
44
// Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
55
//
66
// You should have received a copy of the license along with this
@@ -63,7 +63,8 @@ class UtilMod {
6363

6464
class HashingError extends Error {
6565
String reason;
66-
HashingError(this.reason);
66+
String description;
67+
HashingError(this.reason, this.description);
6768
}
6869

6970
Future<void> installMod(Mod mod, DownloadMod version, String mcv) async {
@@ -80,15 +81,17 @@ Future<void> installMod(Mod mod, DownloadMod version, String mcv) async {
8081
} else if (hashData[0] == "sha512") {
8182
hashFun = sha512.convert;
8283
} else {
83-
throw HashingError("Invalid hashing algorithm ${hashData[0]}");
84+
throw HashingError("Invalid hashing algorithm",
85+
"Mod required the ${hashData[0]} hashing algorithm which is not supported by Argon!");
8486
}
8587
print(hashFun);
8688
print(hashData);
8789
if (hashFun(response.bodyBytes).toString() != hashData[1]) {
88-
throw HashingError(
89-
"Hash mismatch file hash: ${hashFun(response.bodyBytes).toString()}. Expected hash ${hashData[1]}");
90+
print("Throwing error");
91+
throw HashingError("Hash mismatch.",
92+
"file hash: ${hashFun(response.bodyBytes).toString()}. Expected hash ${hashData[1]}\nPlease check your internet connection!");
9093
}
91-
//TODO: Hashing!
94+
9295
await Directory("${Config.appDir}/modlists/$mcv/").create(recursive: true);
9396

9497
UtilMod(version.filename, mcv).write(response.bodyBytes);
@@ -123,7 +126,7 @@ Future<void> fetchData() async {
123126
if (trimmed == "") continue;
124127
final res = await http.get(Uri.parse(trimmed.startsWith("http")
125128
? trimmed
126-
: "https://tmod.deno.dev/$trimmed.json"));
129+
: "https://argon.deno.dev/$trimmed.json"));
127130
var data = json.decode(res.body);
128131

129132
mods = [

lib/theme.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// TMOD Installer (c) by tricked
1+
// ArgonInstaller (c) by tricked
22
//
3-
// TMOD Installer is licensed under a
3+
// ArgonInstaller is licensed under a
44
// Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
55
//
66
// You should have received a copy of the license along with this

linux/main.cc

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
// TMOD Installer (c) by tricked
2-
//
3-
// TMOD Installer is licensed under a
1+
// ArgonInstaller (c) by tricked
2+
//
3+
// ArgonInstaller is licensed under a
44
// Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
5-
//
5+
//
66
// You should have received a copy of the license along with this
77
// work. If not, see <http://creativecommons.org/licenses/by-nc-nd/3.0/>.
88

99
#include "my_application.h"
1010

11-
int main(int argc, char** argv) {
11+
int main(int argc, char **argv)
12+
{
1213
g_autoptr(MyApplication) app = my_application_new();
1314
return g_application_run(G_APPLICATION(app), argc, argv);
1415
}

linux/my_application.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// TMOD Installer (c) by tricked
1+
// ArgonInstaller (c) by tricked
22
//
3-
// TMOD Installer is licensed under a
3+
// ArgonInstaller is licensed under a
44
// Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
55
//
66
// You should have received a copy of the license along with this

linux/my_application.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
// TMOD Installer (c) by tricked
2-
//
3-
// TMOD Installer is licensed under a
1+
// ArgonInstaller (c) by tricked
2+
//
3+
// ArgonInstaller is licensed under a
44
// Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
5-
//
5+
//
66
// You should have received a copy of the license along with this
77
// work. If not, see <http://creativecommons.org/licenses/by-nc-nd/3.0/>.
88

@@ -21,6 +21,6 @@ G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION,
2121
*
2222
* Returns: a new #MyApplication.
2323
*/
24-
MyApplication* my_application_new();
24+
MyApplication *my_application_new();
2525

26-
#endif // FLUTTER_MY_APPLICATION_H_
26+
#endif // FLUTTER_MY_APPLICATION_H_

windows/runner/Runner.rc

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// TMOD Installer (c) by tricked
1+
// ArgonInstaller (c) by tricked
22
//
3-
// TMOD Installer is licensed under a
3+
// ArgonInstaller is licensed under a
44
// Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
55
//
66
// You should have received a copy of the license along with this

0 commit comments

Comments
 (0)