main - remote-2023-08-20T02:24:11 now-2023-08-20T18:40:38
This commit is contained in:
commit
4cf5c80442
161 changed files with 12176 additions and 0 deletions
8
Packages/com.vrchat.core.bootstrap/Editor.meta
Normal file
8
Packages/com.vrchat.core.bootstrap/Editor.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5ee5eebf1b35bbd49ae7983db316180a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
92
Packages/com.vrchat.core.bootstrap/Editor/Bootstrap.cs
Normal file
92
Packages/com.vrchat.core.bootstrap/Editor/Bootstrap.cs
Normal file
|
@ -0,0 +1,92 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace VRC.PackageManagement.Core
|
||||
{
|
||||
public class Bootstrap
|
||||
{
|
||||
// JSON property names in Project Manifest
|
||||
public const string UNITY_PACKAGES_FOLDER = "Packages";
|
||||
public const string UNITY_MANIFEST_FILENAME = "manifest.json";
|
||||
|
||||
// VRC Values
|
||||
public const string VRC_CONFIG = "https://api.vrchat.cloud/api/1/config";
|
||||
public const string VRC_AGENT = "VCCBootstrap 1.0";
|
||||
public const string VRC_RESOLVER_PACKAGE = "com.vrchat.core.vpm-resolver";
|
||||
|
||||
// Finds url for bootstrap package without using JSON
|
||||
private static Regex _bootstrapRegex = new Regex("\"bootstrap\"\\s*:\\s*\"(.+?(?=\"))\"");
|
||||
public static string ManifestPath => Path.Combine(Directory.GetCurrentDirectory(), UNITY_PACKAGES_FOLDER, UNITY_MANIFEST_FILENAME);
|
||||
|
||||
// Path where we expect the target package to exist
|
||||
public static string ResolverPath =>
|
||||
Path.Combine(Directory.GetCurrentDirectory(), UNITY_PACKAGES_FOLDER, VRC_RESOLVER_PACKAGE);
|
||||
|
||||
[InitializeOnLoadMethod]
|
||||
public static async void CheckForRestore()
|
||||
{
|
||||
if (!new DirectoryInfo(ResolverPath).Exists)
|
||||
{
|
||||
try
|
||||
{
|
||||
await AddResolver();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogError($"Could not download and install the VPM Package Resolver - you may be missing packages. Exception: {e.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task AddResolver()
|
||||
{
|
||||
var configData = await GetRemoteString(VRC_CONFIG);
|
||||
if (string.IsNullOrWhiteSpace(configData))
|
||||
{
|
||||
Debug.LogWarning($"Could not get VPM libraries, try again later");
|
||||
return;
|
||||
}
|
||||
var bootstrapMatch = _bootstrapRegex.Match(configData);
|
||||
if (!bootstrapMatch.Success || bootstrapMatch.Groups.Count < 2)
|
||||
{
|
||||
Debug.LogError($"Could not find bootstrap in config, try again later");
|
||||
return;
|
||||
}
|
||||
|
||||
var url = bootstrapMatch.Groups[1].Value;
|
||||
|
||||
var targetFile = Path.Combine(Path.GetTempPath(), $"resolver-{DateTime.Now.ToString("yyyyMMddTHHmmss")}.unitypackage");
|
||||
|
||||
// Download to dir
|
||||
using (var client = new WebClient())
|
||||
{
|
||||
// Add User Agent or else CloudFlare will return 1020
|
||||
client.Headers.Add(HttpRequestHeader.UserAgent, VRC_AGENT);
|
||||
|
||||
await client.DownloadFileTaskAsync(url, targetFile);
|
||||
|
||||
if (File.Exists(targetFile))
|
||||
{
|
||||
Debug.Log($"Downloaded Resolver to {targetFile}");
|
||||
AssetDatabase.ImportPackage(targetFile, false);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
public static async Task<string> GetRemoteString(string url)
|
||||
{
|
||||
using (var client = new WebClient())
|
||||
{
|
||||
// Add User Agent or else CloudFlare will return 1020
|
||||
client.Headers.Add(HttpRequestHeader.UserAgent, VRC_AGENT);
|
||||
return await client.DownloadStringTaskAsync(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Packages/com.vrchat.core.bootstrap/Editor/Bootstrap.cs.meta
Normal file
11
Packages/com.vrchat.core.bootstrap/Editor/Bootstrap.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: eea11c44cabdaaa43ac0a21dbbbd9824
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"name": "VRChat.Bootstrapper.Editor",
|
||||
"references": [],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e0d8a3ed977bd0948b99f4bce8e56a07
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
11
Packages/com.vrchat.core.bootstrap/License.md
Normal file
11
Packages/com.vrchat.core.bootstrap/License.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
# VRCHAT INC.
|
||||
### VRCHAT DISTRO LICENSE FILE
|
||||
Version: February 24, 2022
|
||||
|
||||
**SUMMARY OF TERMS:** Any materials subject to this Distro Asset License may be distributed by you, with or without modifications, on a non-commercial basis (i.e., at no charge), in accordance with the full terms of the Materials License Agreement.
|
||||
|
||||
This Distro License File is a "License File" as defined in the VRChat Materials License Agreement, found at https://hello.vrchat.com/legal/sdk (or any successor link designated by VRChat) (as may be revised from time to time, the "Materials License Agreement").
|
||||
|
||||
This Distro License File applies to all the files in the Folder containing this Distro License File and those in all Child Folders within that Folder (except with respect to files in any Child Folder that contains a different License File) (such files, other than this Distro License File, the "Covered Files"). All capitalized terms used but not otherwise defined in this Distro License File have the meanings provided in the Materials License Agreement.
|
||||
|
||||
This Distro License File only provides a summary of the terms applicable to the Covered Files. To understand your rights and obligations and the full set of terms that apply to use of the Covered Files, please see the relevant sections of the Materials License Agreement, including terms applicable to Distro Materials.
|
7
Packages/com.vrchat.core.bootstrap/License.md.meta
Normal file
7
Packages/com.vrchat.core.bootstrap/License.md.meta
Normal file
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a84f4a071b4a7fa49985f447a0ce2fe2
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
17
Packages/com.vrchat.core.bootstrap/package.json
Normal file
17
Packages/com.vrchat.core.bootstrap/package.json
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"name" : "com.vrchat.core.bootstrap",
|
||||
"displayName" : "VRChat Package Bootstrapper",
|
||||
"version" : "0.1.15",
|
||||
"unity" : "2019.4",
|
||||
"description" : "Tool to Download VPM Packages",
|
||||
"vrchatVersion" : "2022.1.1",
|
||||
"author" : {
|
||||
"name" : "VRChat",
|
||||
"email" : "developer@vrchat.com",
|
||||
"url" : "https://github.com/vrchat/packages"
|
||||
},
|
||||
"url" : "",
|
||||
"dependencies" : {
|
||||
"com.unity.nuget.newtonsoft-json" : "2.0.2"
|
||||
}
|
||||
}
|
7
Packages/com.vrchat.core.bootstrap/package.json.meta
Normal file
7
Packages/com.vrchat.core.bootstrap/package.json.meta
Normal file
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6c5fffb4815ba9046ad0a2e878396439
|
||||
PackageManifestImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Add a link
Reference in a new issue