mod: impl config for api url
All checks were successful
Release Mod / Build (push) Successful in 25s
All checks were successful
Release Mod / Build (push) Successful in 25s
This commit is contained in:
@ -1,30 +1,35 @@
|
||||
using IPA;
|
||||
using IPALogger = IPA.Logging.Logger;
|
||||
using SiraUtil.Zenject;
|
||||
using IPA.Loader;
|
||||
using Zenject;
|
||||
using ScoreTracker.Core;
|
||||
using System.Threading.Tasks;
|
||||
using ScoreTracker.API;
|
||||
using System.Collections.Generic;
|
||||
using IPA.Config.Stores;
|
||||
using IPA.Config;
|
||||
using ScoreTracker.Configuration;
|
||||
using ScoreTracker.Installers;
|
||||
|
||||
namespace ScoreTracker
|
||||
{
|
||||
[Plugin(RuntimeOptions.SingleStartInit)]
|
||||
[Plugin(RuntimeOptions.DynamicInit)]
|
||||
[NoEnableDisable]
|
||||
public class Plugin
|
||||
{
|
||||
internal static Plugin Instance { get; private set; }
|
||||
internal static IPALogger Log { get; private set; }
|
||||
internal static DiContainer Container; // Workaround to access the Zenject container in SceneLoaded
|
||||
|
||||
[Init]
|
||||
public Plugin(IPALogger logger, PluginMetadata metadata, Zenjector zenjector)
|
||||
public Plugin(IPALogger logger, Zenjector zenjector, Config config)
|
||||
{
|
||||
Instance = this;
|
||||
Log = logger; // Setup the logger
|
||||
|
||||
// Install our Zenject bindings
|
||||
// Setup Zenject
|
||||
zenjector.UseLogger(logger);
|
||||
zenjector.UseMetadataBinder<Plugin>();
|
||||
zenjector.Install<AppInstaller>(Location.App);
|
||||
|
||||
// Setup the config
|
||||
PluginConfig.Instance = config.Generated<PluginConfig>();
|
||||
}
|
||||
|
||||
[OnStart]
|
||||
@ -32,11 +37,11 @@ namespace ScoreTracker
|
||||
{
|
||||
Log.Info("OnApplicationStart");
|
||||
|
||||
Task.Run(async () =>
|
||||
// Ensure the user is logged in
|
||||
Task.Factory.StartNew(async () =>
|
||||
{
|
||||
await Request.PostJsonAsync("http://localhost:7500/test", new Dictionary<object, object> {
|
||||
{ "boobies", "yes" }
|
||||
});
|
||||
var authHelper = new AuthHelper();
|
||||
await authHelper.EnsureLoggedIn();
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user