Make some small changes and fixes
This commit is contained in:
parent
a93d62e2a1
commit
504ef2211d
7 changed files with 119 additions and 16 deletions
18
README.md
18
README.md
|
@ -1,3 +1,21 @@
|
|||
# Zontreck.com
|
||||
|
||||
Zontreck.com Website
|
||||
|
||||
# OpenSim Web Interface
|
||||
__________
|
||||
|
||||
1. How to set up
|
||||
```
|
||||
Setting up the web interface externally is not officially supported. This was designed and built to be used integrated with zontreck.com.
|
||||
|
||||
However, if you still wish to do so, you will have quite a bit of code to edit. First off, edit main.dart in libs/pages. You'll need to remove the reference to HomePage, and add a homePage attribute to MaterialApp that points to OpenSimPage()
|
||||
|
||||
Next up, you'll want to edit Settings.dart, the reason is because this seeks out services.json from the Aria's Creations github. That file controls where to look for the API server. Either hardcode a return value, or upload your own somewhere
|
||||
|
||||
Next, you need to edit the API Endpoint paths to point to where these files reside on your actual server.
|
||||
```
|
||||
|
||||
I will be releasing a separate system based on this code in a separate repository that is intended for third party hosting as soon as this interface is completed.
|
||||
|
||||
The released standalone will also be uploaded as a packaged library for dart. It will then still be included here but primarily maintained in the standalone once this happens.
|
|
@ -1,9 +1,10 @@
|
|||
import 'package:dio/dio.dart';
|
||||
import 'package:libac_flutter/nbt/impl/CompoundTag.dart';
|
||||
import 'package:libac_flutter/utils/Hashing.dart';
|
||||
|
||||
enum APIEndpoint {
|
||||
SetupCheck(script: "SetupCheck.php", path: "/ac/home/"),
|
||||
Login(script: "Login.php", path: "/ac/home/");
|
||||
SetupCheck(script: "SetupCheck.php", path: "/ac/home/supports/"),
|
||||
Login(script: "Login.php", path: "/ac/home/supports/");
|
||||
|
||||
final String script;
|
||||
final String path;
|
||||
|
@ -48,4 +49,14 @@ class Settings {
|
|||
|
||||
API_SERVER = "${protocol}://${host}:${port}/";
|
||||
}
|
||||
|
||||
Future<String> hashPSK(String PSK) async {
|
||||
String hash = Hashing.md5Hash("AriasCreations");
|
||||
for (int i = 0; i < 512; i++) {
|
||||
hash = Hashing.sha256Hash("${hash}:${PSK}");
|
||||
}
|
||||
hash = Hashing.md5Hash(hash);
|
||||
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,13 +14,19 @@ class OpenSimPage extends StatefulWidget {
|
|||
class OpenSimPageState extends State<OpenSimPage> {
|
||||
Settings settings = Settings();
|
||||
|
||||
TextEditingController databaseHostController = TextEditingController();
|
||||
TextEditingController databaseUsernameController = TextEditingController();
|
||||
TextEditingController databasePasswordController = TextEditingController();
|
||||
TextEditingController databaseNameController = TextEditingController();
|
||||
TextEditingController PSKController = TextEditingController();
|
||||
|
||||
@override
|
||||
Future<void> didChangeDependencies() async {
|
||||
// Send check for setup completion
|
||||
var reply = await settings.dio.get(APIEndpoint.SetupCheck.getURL());
|
||||
|
||||
var replyJson = json.decode(reply.data);
|
||||
if (replyJson['done'] as String == "true") {
|
||||
if (replyJson['done'] as bool == true) {
|
||||
setState(() {
|
||||
settings.OpenSimSetupCompleted = true;
|
||||
});
|
||||
|
@ -37,16 +43,69 @@ class OpenSimPageState extends State<OpenSimPage> {
|
|||
body: Padding(
|
||||
padding: EdgeInsets.all(8),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
settings.OpenSimSetupCompleted
|
||||
? ListTile(
|
||||
title: Text("Login Required"),
|
||||
child: settings.OpenSimSetupCompleted
|
||||
? Column(
|
||||
children: [],
|
||||
)
|
||||
: Column(
|
||||
children: [
|
||||
ListTile(
|
||||
title: Text("Initial Setup Required"),
|
||||
tileColor: Constants.TITLEBAR_COLOR,
|
||||
)
|
||||
: Text("You need to set up the database")
|
||||
],
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
title: Text("Database Host"),
|
||||
subtitle: TextField(
|
||||
controller: databaseHostController,
|
||||
decoration:
|
||||
InputDecoration(hintText: "example.com:3306"),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
title: Text("Database Username"),
|
||||
subtitle: TextField(
|
||||
controller: databaseUsernameController,
|
||||
decoration: InputDecoration(hintText: "Username"),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
title: Text("Database Password"),
|
||||
subtitle: TextField(
|
||||
decoration:
|
||||
InputDecoration(hintText: "****", hintMaxLines: 1),
|
||||
obscureText: true,
|
||||
obscuringCharacter: "*",
|
||||
controller: databasePasswordController,
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
title: Text("Database Name"),
|
||||
subtitle: TextField(
|
||||
decoration:
|
||||
InputDecoration(hintText: "acwi", hintMaxLines: 1),
|
||||
controller: databaseNameController,
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
title: Text("PreShared Secret"),
|
||||
subtitle: TextField(
|
||||
controller: PSKController,
|
||||
decoration: InputDecoration(
|
||||
hintText:
|
||||
"Pre-Shared Key. Long text that gets hashed"),
|
||||
),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () async {
|
||||
var PSK = await settings.hashPSK(PSKController.text);
|
||||
|
||||
setState(() {
|
||||
PSKController.text = PSK;
|
||||
});
|
||||
},
|
||||
child: Text("Submit"))
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
|
@ -26,9 +26,10 @@ function rewrite_DB_conf($host, $user, $pass, $db)
|
|||
file_put_contents("../database.user.php", $ptl);
|
||||
}
|
||||
|
||||
require("Database.php");
|
||||
if(file_exists("../database.user.php"))
|
||||
require("../database.user.php");
|
||||
else
|
||||
require("Database.php");
|
||||
|
||||
session_start();
|
||||
?>
|
14
php/Setup.php
Normal file
14
php/Setup.php
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
if(!defined("COMMON"))
|
||||
require("Common.php");
|
||||
|
||||
$js = getJsonizedInput();
|
||||
|
||||
$host = $js['host'];
|
||||
$user = $js['user'];
|
||||
$pass = $js['pass'];
|
||||
$db = $js['db'];
|
||||
|
||||
rewrite_DB_conf($host, $user, $pass, $db);
|
||||
|
||||
?>
|
|
@ -37,7 +37,7 @@ dependencies:
|
|||
cupertino_icons: ^1.0.6
|
||||
libac_flutter:
|
||||
hosted: https://git.zontreck.com/api/packages/AriasCreations/pub/
|
||||
version: 1.0.1
|
||||
version: 1.0.2
|
||||
dio: ^5.4.3+1
|
||||
shared_preferences: ^2.2.3
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<!-- iOS meta tags & icons -->
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<meta name="apple-mobile-web-app-title" content="tempflutter">
|
||||
<meta name="apple-mobile-web-app-title" content="zontreck">
|
||||
<link rel="apple-touch-icon" href="icons/Icon-192.png">
|
||||
|
||||
<!-- Favicon -->
|
||||
|
|
Loading…
Reference in a new issue