mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-17 18:40:33 +00:00
Edgegap plugin updated to latest
This commit is contained in:
parent
8d37cc3174
commit
c1f71dffe9
@ -1,16 +0,0 @@
|
||||
FROM ubuntu:bionic
|
||||
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
COPY Builds/EdgegapServer /root/build/
|
||||
|
||||
WORKDIR /root/
|
||||
|
||||
RUN chmod +x /root/build/ServerBuild
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y ca-certificates && \
|
||||
apt-get clean && \
|
||||
update-ca-certificates
|
||||
|
||||
ENTRYPOINT [ "/root/build/ServerBuild", "-batchmode", "-nographics"]
|
@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 78b80371aabba1d48aac39ec7ccfe7c5
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,8 +1,9 @@
|
||||
FROM ubuntu:22.04
|
||||
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
ARG SERVER_BUILD_PATH=Builds/EdgegapServer
|
||||
|
||||
COPY Builds/EdgegapServer /root/build/
|
||||
COPY ${SERVER_BUILD_PATH} /root/build/
|
||||
|
||||
WORKDIR /root/
|
||||
|
||||
@ -13,4 +14,4 @@ RUN apt-get update && \
|
||||
apt-get clean && \
|
||||
update-ca-certificates
|
||||
|
||||
ENTRYPOINT [ "/root/build/ServerBuild", "-batchmode", "-nographics"]
|
||||
CMD [ "/root/build/ServerBuild", "-batchmode", "-nographics", "$UNITY_COMMANDLINE_ARGS"]
|
||||
|
@ -63,7 +63,7 @@ public enum LogLevel
|
||||
public const string EDGEGAP_GET_A_TOKEN_URL = "https://app.edgegap.com/?oneClick=true";
|
||||
public const string EDGEGAP_ADD_MORE_GAME_SERVERS_URL = "https://edgegap.com/resources/contact";
|
||||
public const string EDGEGAP_DOC_BTN_HOW_TO_LOGIN_VIA_CLI_URL = "https://docs.edgegap.com/docs/container/edgegap-container-registry/#getting-your-credentials";
|
||||
private const string DEFAULT_UTM_SOURCE_TAG = "partner_mirror_assetstore_unity";
|
||||
private const string DEFAULT_UTM_SOURCE_TAG = "partner_mirror_source_unity";
|
||||
private const string DEFAULT_UTM_MEDIUM_TAG = "servers_quickstart_plugin";
|
||||
private const string DEFAULT_UTM_CONTENT_TAG = "plugin_button";
|
||||
public const string DEFAULT_UTM_TAGS = "utm_source=" + DEFAULT_UTM_SOURCE_TAG +
|
||||
|
@ -112,7 +112,8 @@ public class EdgegapWindowV2 : EditorWindow
|
||||
Path.GetDirectoryName(AssetDatabase.GetAssetPath(MonoScript.FromScriptableObject(this)));
|
||||
// END MIRROR CHANGE
|
||||
internal string ProjectRootPath => Directory.GetCurrentDirectory();
|
||||
internal string DockerFilePath => $"{Directory.GetParent(Directory.GetFiles(ProjectRootPath, GetType().Name + ".cs", SearchOption.AllDirectories)[0]).FullName}{Path.DirectorySeparatorChar}Dockerfile";
|
||||
internal string ThisScriptPath => Directory.GetFiles(ProjectRootPath, GetType().Name + ".cs", SearchOption.AllDirectories)[0];
|
||||
internal string DockerFilePath => $"{Directory.GetParent(ThisScriptPath).FullName}{Path.DirectorySeparatorChar}Dockerfile";
|
||||
|
||||
[MenuItem("Tools/Edgegap Hosting")] // MIRROR CHANGE: more obvious title
|
||||
public static void ShowEdgegapToolWindow()
|
||||
@ -545,7 +546,11 @@ private void debugEnableAllGroups()
|
||||
_containerCustomRegistryWrapper.SetEnabled(true);
|
||||
}
|
||||
|
||||
private void onApiTokenVerifyBtnClick() => _ = verifyApiTokenGetRegistryCredsAsync();
|
||||
private void onApiTokenVerifyBtnClick()
|
||||
{
|
||||
_ = verifyApiTokenGetRegistryCredsAsync();
|
||||
_ = checkForUpdates();
|
||||
}
|
||||
private void onApiTokenGetBtnClick() => openGetApiTokenWebsite();
|
||||
|
||||
/// <summary>Process UI + validation before/after API logic</summary>
|
||||
@ -915,6 +920,24 @@ private string getBase64StrFromSprite(Sprite sprite, int maxKbSize = 200)
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fetch latest github release and compare with local package.json version
|
||||
/// </summary>
|
||||
private async Task checkForUpdates()
|
||||
{
|
||||
// get local package.json version
|
||||
DirectoryInfo thisScriptDir = new DirectoryInfo(ThisScriptPath);
|
||||
PackageJSON local = PackageJSON.PackageJSONFromJSON($"{thisScriptDir.Parent.Parent.ToString()}{Path.DirectorySeparatorChar}package.json");
|
||||
|
||||
// get latest release from github repository
|
||||
string releaseJSON = await GithubRelease.GithubReleaseFromAPI();
|
||||
GithubRelease latest = GithubRelease.GithubReleaseFromJSON(releaseJSON);
|
||||
|
||||
if (local.version != latest.name) {
|
||||
Debug.LogWarning($"Please update your Edgegap Quickstart plugin - local version `{local.version}` < latest version `{latest.name}`. See https://github.com/edgegap/edgegap-unity-plugin.");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies token => apps/container groups -> gets registry creds (if any).
|
||||
/// TODO: UX - Show loading spinner.
|
||||
|
31
Assets/Mirror/Hosting/Edgegap/Editor/GithubRelease.cs
Normal file
31
Assets/Mirror/Hosting/Edgegap/Editor/GithubRelease.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Edgegap.Editor
|
||||
{
|
||||
[Serializable]
|
||||
public class GithubRelease
|
||||
{
|
||||
public string name;
|
||||
|
||||
public static async Task<string> GithubReleaseFromAPI()
|
||||
{
|
||||
HttpClient http = new HttpClient();
|
||||
http.DefaultRequestHeaders.Add("Accept", "application/vnd.github+json");
|
||||
http.DefaultRequestHeaders.Add("X-GitHub-Api-Version", "2022-11-28");
|
||||
http.DefaultRequestHeaders.Add("User-Agent", "Unity");
|
||||
http.Timeout = TimeSpan.FromSeconds(30);
|
||||
|
||||
HttpResponseMessage response = await http.GetAsync("https://api.github.com/repos/edgegap/edgegap-unity-plugin/releases/latest").ConfigureAwait(false);
|
||||
|
||||
return response.IsSuccessStatusCode ? await response.Content.ReadAsStringAsync() : "{}";
|
||||
}
|
||||
|
||||
public static GithubRelease GithubReleaseFromJSON(string json)
|
||||
{
|
||||
return JsonUtility.FromJson<GithubRelease>(json);
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Mirror/Hosting/Edgegap/Editor/GithubRelease.cs.meta
Normal file
11
Assets/Mirror/Hosting/Edgegap/Editor/GithubRelease.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6ef365e2acd5a5044a4a14fa83c7d9b9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
37
Assets/Mirror/Hosting/Edgegap/Editor/PackageJSON.cs
Normal file
37
Assets/Mirror/Hosting/Edgegap/Editor/PackageJSON.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Edgegap.Editor
|
||||
{
|
||||
[Serializable]
|
||||
public class PackageJSON
|
||||
{
|
||||
[Serializable]
|
||||
public struct Author
|
||||
{
|
||||
public string name;
|
||||
public string email;
|
||||
public string url;
|
||||
}
|
||||
|
||||
public string name;
|
||||
public string version;
|
||||
public string displayName;
|
||||
public string description;
|
||||
public string unity;
|
||||
public string unityRelease;
|
||||
public string documentationUrl;
|
||||
public string changelogUrl;
|
||||
public string licensesUrl;
|
||||
|
||||
public Author author;
|
||||
|
||||
// dependencies omitted since JsonUtility doesn't support dictionaries
|
||||
|
||||
public static PackageJSON PackageJSONFromJSON(string path)
|
||||
{
|
||||
return JsonUtility.FromJson<PackageJSON>(File.ReadAllText(path));
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Mirror/Hosting/Edgegap/Editor/PackageJSON.cs.meta
Normal file
11
Assets/Mirror/Hosting/Edgegap/Editor/PackageJSON.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e8abfa078881a944a81ac3bcc8e5e0f4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -42,15 +42,25 @@ This plugin does not need to be included in your builds, as it's only a developm
|
||||
## Other sources
|
||||
|
||||
The only other official distribution channels for this plugin are:
|
||||
- [Mirror Networking samples](https://mirror-networking.gitbook.io/docs/hosting/edgegap-hosting-plugin-guide)
|
||||
- [Fish Networking samples](https://fish-networking.gitbook.io/docs/manual/server-hosting/edgegap-official-partner)
|
||||
|
||||
**WARNING!** The [Edgegap plugin published on Unity Asset Store](https://assetstore.unity.com/packages/tools/network/edgegap-game-server-hosting-212563) is outdated and not supported anymore. If you've previously installed our plugin by another method than described above, please remove any Edgegap files or dependencies related before updating your plugin using the git URL.
|
||||
- [Unity Asset Store package](https://assetstore.unity.com/packages/tools/network/edgegap-game-server-hosting-212563)
|
||||
- [Mirror Networking source](https://github.com/MirrorNetworking/Mirror)
|
||||
- [Mirror Networking free package](https://assetstore.unity.com/packages/tools/network/mirror-129321)
|
||||
- [Mirror Networking LTS package](https://assetstore.unity.com/packages/tools/network/mirror-lts-102631)
|
||||
- [Fish Networking source](https://github.com/FirstGearGames/FishNet)
|
||||
- [Fish Networking free package](https://assetstore.unity.com/packages/tools/network/fishnet-networking-evolved-207815)
|
||||
- [Fish Networking Pro package](https://assetstore.unity.com/packages/tools/network/fishnet-pro-networking-evolved-287711)
|
||||
|
||||
## Next Steps
|
||||
|
||||
Once you have it, check for **Tools** -> **Edgegap Hosting** in Unity's top menu.
|
||||
|
||||
### Usage requirements
|
||||
|
||||
To take full advantage of our Unity plugin's build features, you will need to:
|
||||
- [Create an Edgegap Free Tier account](https://app.edgegap.com/auth/register),
|
||||
- [Install Docker Desktop](https://www.docker.com/products/docker-desktop/) (or Docker CLI),
|
||||
- Install Unity Linux Build Support modules for Unity.
|
||||
|
||||
From here, we recommend following our [Unity Plugin Guide](https://docs.edgegap.com/docs/tools-and-integrations/unity-plugin-guide) to get your first dedicated server deployed.
|
||||
|
||||
### Update the Plugin in Unity
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "com.edgegap.unity-servers-plugin",
|
||||
"version": "1.0.8",
|
||||
"version": "2.3.1",
|
||||
"displayName": "Edgegap Servers Quickstart",
|
||||
"description": "Get started quickly with Edgegap Dedicated Server hosting.",
|
||||
"unity": "2021.3",
|
||||
@ -18,4 +18,4 @@
|
||||
"email": "contact@edgegap.com",
|
||||
"url": "https://www.edgegap.com"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user