Compare commits
3 Commits
3e00fc6197
...
885b27bfe1
| Author | SHA1 | Date |
|---|---|---|
|
|
885b27bfe1 | |
|
|
73c2ccea0a | |
|
|
7f37600fca |
|
|
@ -6,7 +6,7 @@ on:
|
|||
paths: ["velconnect/**"]
|
||||
jobs:
|
||||
run_pull:
|
||||
name: Pull new version
|
||||
name: Pull new version on Oracle
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: install ssh keys
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@ export function prettyDate(date: string | Date | DateTime, includeYear = false)
|
|||
}
|
||||
// return DateTime.fromISO(date).toFormat("yyyy-LL-dd hh:mm a ZZZZ");
|
||||
const fromNow = DateTime.utc().minus(d.toMillis()).toMillis();
|
||||
const yearReplace = includeYear ? '' : ', 2023';
|
||||
// TODO fix
|
||||
const yearReplace = includeYear ? '' : ', 2024';
|
||||
if (fromNow > 0) {
|
||||
return `${d.toLocaleString(DateTime.DATETIME_MED)} (${humanizeDuration(fromNow, {
|
||||
round: true,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "VEL-Connect",
|
||||
"rootNamespace": "VEL-Connect",
|
||||
"rootNamespace": "VELConnect",
|
||||
"references": [
|
||||
"GUID:1e55e2c4387020247a1ae212bbcbd381",
|
||||
"GUID:343deaaf83e0cee4ca978e7df0b80d21",
|
||||
|
|
|
|||
|
|
@ -185,7 +185,23 @@ namespace VELConnect
|
|||
sb.Append("EDITOR");
|
||||
#endif
|
||||
string id = Convert.ToBase64String(md5.ComputeHash(Encoding.UTF8.GetBytes(sb.ToString())));
|
||||
deviceId = id[..15];
|
||||
deviceId = CreateDeviceId();
|
||||
}
|
||||
|
||||
// Computes 15-char device id compatibly with pocketbase
|
||||
private static string CreateDeviceId()
|
||||
{
|
||||
MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
|
||||
StringBuilder sb = new StringBuilder(SystemInfo.deviceUniqueIdentifier);
|
||||
sb.Append(Application.productName);
|
||||
#if UNITY_EDITOR
|
||||
// allows running multiple builds on the same computer
|
||||
// return SystemInfo.deviceUniqueIdentifier + Hash128.Compute(Application.dataPath);
|
||||
sb.Append(Application.dataPath);
|
||||
sb.Append("EDITOR");
|
||||
#endif
|
||||
string id = Convert.ToBase64String(md5.ComputeHash(Encoding.UTF8.GetBytes(sb.ToString())));
|
||||
return id[..15];
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
|
|
@ -901,7 +917,7 @@ namespace VELConnect
|
|||
case UnityWebRequest.Result.ConnectionError:
|
||||
case UnityWebRequest.Result.DataProcessingError:
|
||||
case UnityWebRequest.Result.ProtocolError:
|
||||
Debug.LogError(url + ": Error: " + webRequest.error + "\n" + Environment.StackTrace);
|
||||
Debug.LogError(url + ": Error: " + webRequest.error + "\n" + webRequest.downloadHandler.text + "\n" + Environment.StackTrace);
|
||||
failureCallback?.Invoke(webRequest.error);
|
||||
break;
|
||||
case UnityWebRequest.Result.Success:
|
||||
|
|
@ -913,6 +929,23 @@ namespace VELConnect
|
|||
webRequest.Dispose();
|
||||
}
|
||||
|
||||
public static void SetDataBlock(string blockId, State.DataBlock dataBlock)
|
||||
{
|
||||
PostRequestCallback(instance.velConnectUrl + "/data_block/" + blockId, JsonConvert.SerializeObject(dataBlock, Formatting.None, new JsonSerializerSettings
|
||||
{
|
||||
NullValueHandling = NullValueHandling.Ignore
|
||||
}));
|
||||
}
|
||||
|
||||
public static void GetDataBlock(string blockId, Action<State.DataBlock> successCallback = null, Action<string> failureCallback = null)
|
||||
{
|
||||
GetRequestCallback(instance.velConnectUrl + "/data_block/" + blockId, data =>
|
||||
{
|
||||
State.DataBlock dict = JsonConvert.DeserializeObject<State.DataBlock>(data);
|
||||
successCallback?.Invoke(dict);
|
||||
}, failureCallback);
|
||||
}
|
||||
|
||||
private void OnApplicationFocus(bool focus)
|
||||
{
|
||||
UpdateUserCount(!focus);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,85 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using VelNet;
|
||||
|
||||
namespace VELConnect
|
||||
{
|
||||
public class VelNetPersist : MonoBehaviour
|
||||
{
|
||||
public SyncState syncState;
|
||||
private string Id => $"{Application.productName}_{VelNetManager.Room}_{syncState.networkObject.sceneNetworkId}_{syncState.networkObject.syncedComponents.IndexOf(syncState)}";
|
||||
private const float interval = 5f;
|
||||
private double nextUpdate;
|
||||
private bool loading;
|
||||
private const bool debugLogs = false;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (Time.timeAsDouble > nextUpdate && VelNetManager.InRoom && !loading)
|
||||
{
|
||||
nextUpdate = Time.timeAsDouble + interval + UnityEngine.Random.Range(0, interval);
|
||||
if (syncState.networkObject.IsMine)
|
||||
{
|
||||
Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
VelNetManager.OnJoinedRoom += OnJoinedRoom;
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
VelNetManager.OnJoinedRoom -= OnJoinedRoom;
|
||||
}
|
||||
|
||||
private void OnJoinedRoom(string roomName)
|
||||
{
|
||||
Load();
|
||||
}
|
||||
|
||||
private void Load()
|
||||
{
|
||||
loading = true;
|
||||
if (debugLogs) Debug.Log($"[VelNetPersist] Loading {Id}");
|
||||
VELConnectManager.GetDataBlock(Id, data =>
|
||||
{
|
||||
if (!data.data.TryGetValue("state", out string d))
|
||||
{
|
||||
Debug.LogError($"[VelNetPersist] Failed to parse {Id}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (syncState == null)
|
||||
{
|
||||
Debug.LogError("[VelNetPersist] Object doesn't exist anymore");
|
||||
}
|
||||
|
||||
syncState.UnpackState(Convert.FromBase64String(d));
|
||||
if (debugLogs) Debug.Log($"[VelNetPersist] Loaded {Id}");
|
||||
loading = false;
|
||||
}, s =>
|
||||
{
|
||||
Debug.LogError(s);
|
||||
loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
private void Save()
|
||||
{
|
||||
if (debugLogs) Debug.Log($"[VelNetPersist] Saving {Id}");
|
||||
VELConnectManager.SetDataBlock(Id, new VELConnectManager.State.DataBlock()
|
||||
{
|
||||
category = "object_persist",
|
||||
data = new Dictionary<string, string>
|
||||
{
|
||||
{ "name", syncState.networkObject.name },
|
||||
{ "state", Convert.ToBase64String(syncState.PackState()) }
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: cd4cd3f927d9998449837165f749c9c2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "edu.uga.engr.vel.vel-connect",
|
||||
"displayName": "VEL-Connect",
|
||||
"version": "4.0.0",
|
||||
"version": "4.0.1",
|
||||
"unity": "2019.1",
|
||||
"description": "Web-based configuration for VR applications",
|
||||
"keywords": [],
|
||||
|
|
|
|||
|
|
@ -1,22 +1,20 @@
|
|||
FROM alpine:latest
|
||||
# syntax=docker/dockerfile:1
|
||||
FROM golang:1.21 as build
|
||||
WORKDIR /src
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
ARG PB_VERSION=0.20.7
|
||||
COPY *.go ./
|
||||
COPY pb_migrations/ ./pb_migrations
|
||||
|
||||
RUN apk add --no-cache \
|
||||
unzip \
|
||||
ca-certificates
|
||||
# Build
|
||||
RUN CGO_ENABLED=0 go build -ldflags="-s -w" -o ./velconnect
|
||||
# RUN ./velconnect-pb migrate up
|
||||
|
||||
# download and unzip PocketBase
|
||||
ADD https://github.com/pocketbase/pocketbase/releases/download/v${PB_VERSION}/pocketbase_${PB_VERSION}_linux_arm64.zip /tmp/pb.zip
|
||||
RUN unzip /tmp/pb.zip -d /pb/
|
||||
FROM alpine:3.19.1
|
||||
COPY --from=build /src/velconnect /velconnect
|
||||
|
||||
# uncomment to copy the local pb_migrations dir into the image
|
||||
# COPY ./pb_migrations /pb/pb_migrations
|
||||
EXPOSE 8090
|
||||
|
||||
# uncomment to copy the local pb_hooks dir into the image
|
||||
# COPY ./pb_hooks /pb/pb_hooks
|
||||
|
||||
EXPOSE 8092
|
||||
|
||||
# start PocketBase
|
||||
CMD ["/pb/pocketbase", "serve", "--http=0.0.0.0:8092"]
|
||||
# Run
|
||||
ENTRYPOINT ["./velconnect", "serve", "--http=0.0.0.0:8090"]
|
||||
|
|
@ -4,6 +4,6 @@ services:
|
|||
build: .
|
||||
restart: always
|
||||
ports:
|
||||
- "8091:8092"
|
||||
- "8094:8090"
|
||||
volumes:
|
||||
- ./pb_data:/pb/pb_data
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ go 1.18
|
|||
|
||||
require (
|
||||
github.com/labstack/echo/v5 v5.0.0-20220201181537-ed2888cfa198
|
||||
github.com/pocketbase/dbx v1.10.0
|
||||
github.com/pocketbase/pocketbase v0.16.7
|
||||
)
|
||||
|
||||
|
|
@ -50,7 +51,6 @@ require (
|
|||
github.com/mattn/go-isatty v0.0.19 // indirect
|
||||
github.com/mattn/go-sqlite3 v1.14.17 // indirect
|
||||
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
|
||||
github.com/pocketbase/dbx v1.10.0 // indirect
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
|
||||
github.com/spf13/cast v1.5.1 // indirect
|
||||
github.com/spf13/cobra v1.7.0 // indirect
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import (
|
|||
"log"
|
||||
"net/http"
|
||||
|
||||
_ "velaboratory/velconnect/migrations"
|
||||
_ "velaboratory/velconnect/pb_migrations"
|
||||
|
||||
"github.com/labstack/echo/v5"
|
||||
"github.com/pocketbase/pocketbase"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,453 @@
|
|||
package migrations
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/pocketbase/dbx"
|
||||
"github.com/pocketbase/pocketbase/daos"
|
||||
m "github.com/pocketbase/pocketbase/migrations"
|
||||
"github.com/pocketbase/pocketbase/models"
|
||||
)
|
||||
|
||||
func init() {
|
||||
m.Register(func(db dbx.Builder) error {
|
||||
jsonData := `[
|
||||
{
|
||||
"id": "ve85cwsj7syqvxu",
|
||||
"created": "2023-07-06 23:08:13.962Z",
|
||||
"updated": "2023-11-03 18:47:06.094Z",
|
||||
"name": "UserCount",
|
||||
"type": "base",
|
||||
"system": false,
|
||||
"schema": [
|
||||
{
|
||||
"system": false,
|
||||
"id": "pnhtdbcx",
|
||||
"name": "app_id",
|
||||
"type": "text",
|
||||
"required": false,
|
||||
"unique": false,
|
||||
"options": {
|
||||
"min": null,
|
||||
"max": null,
|
||||
"pattern": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"system": false,
|
||||
"id": "wkf3zyyb",
|
||||
"name": "room_id",
|
||||
"type": "text",
|
||||
"required": false,
|
||||
"unique": false,
|
||||
"options": {
|
||||
"min": null,
|
||||
"max": null,
|
||||
"pattern": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"system": false,
|
||||
"id": "f7k9hdoc",
|
||||
"name": "total_users",
|
||||
"type": "number",
|
||||
"required": false,
|
||||
"unique": false,
|
||||
"options": {
|
||||
"min": null,
|
||||
"max": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"system": false,
|
||||
"id": "uevek8os",
|
||||
"name": "room_users",
|
||||
"type": "number",
|
||||
"required": false,
|
||||
"unique": false,
|
||||
"options": {
|
||||
"min": null,
|
||||
"max": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"system": false,
|
||||
"id": "coilxuep",
|
||||
"name": "version",
|
||||
"type": "text",
|
||||
"required": false,
|
||||
"unique": false,
|
||||
"options": {
|
||||
"min": null,
|
||||
"max": null,
|
||||
"pattern": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"system": false,
|
||||
"id": "zee0a2yb",
|
||||
"name": "platform",
|
||||
"type": "text",
|
||||
"required": false,
|
||||
"unique": false,
|
||||
"options": {
|
||||
"min": null,
|
||||
"max": null,
|
||||
"pattern": ""
|
||||
}
|
||||
}
|
||||
],
|
||||
"indexes": [],
|
||||
"listRule": null,
|
||||
"viewRule": null,
|
||||
"createRule": "",
|
||||
"updateRule": null,
|
||||
"deleteRule": null,
|
||||
"options": {}
|
||||
},
|
||||
{
|
||||
"id": "fupstz47c55s69f",
|
||||
"created": "2023-07-06 23:10:31.321Z",
|
||||
"updated": "2023-11-03 18:47:06.120Z",
|
||||
"name": "Device",
|
||||
"type": "base",
|
||||
"system": false,
|
||||
"schema": [
|
||||
{
|
||||
"system": false,
|
||||
"id": "1tkrnxqf",
|
||||
"name": "os_info",
|
||||
"type": "text",
|
||||
"required": false,
|
||||
"unique": false,
|
||||
"options": {
|
||||
"min": null,
|
||||
"max": null,
|
||||
"pattern": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"system": false,
|
||||
"id": "knspamfx",
|
||||
"name": "friendly_name",
|
||||
"type": "text",
|
||||
"required": false,
|
||||
"unique": false,
|
||||
"options": {
|
||||
"min": null,
|
||||
"max": null,
|
||||
"pattern": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"system": false,
|
||||
"id": "qfalwg3c",
|
||||
"name": "modified_by",
|
||||
"type": "text",
|
||||
"required": false,
|
||||
"unique": false,
|
||||
"options": {
|
||||
"min": null,
|
||||
"max": null,
|
||||
"pattern": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"system": false,
|
||||
"id": "x0zlup7v",
|
||||
"name": "current_app",
|
||||
"type": "text",
|
||||
"required": false,
|
||||
"unique": false,
|
||||
"options": {
|
||||
"min": null,
|
||||
"max": null,
|
||||
"pattern": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"system": false,
|
||||
"id": "vpzen2th",
|
||||
"name": "current_room",
|
||||
"type": "text",
|
||||
"required": false,
|
||||
"unique": false,
|
||||
"options": {
|
||||
"min": null,
|
||||
"max": null,
|
||||
"pattern": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"system": false,
|
||||
"id": "d0ckgjhm",
|
||||
"name": "pairing_code",
|
||||
"type": "text",
|
||||
"required": false,
|
||||
"unique": false,
|
||||
"options": {
|
||||
"min": null,
|
||||
"max": null,
|
||||
"pattern": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"system": false,
|
||||
"id": "hglbl7da",
|
||||
"name": "last_online",
|
||||
"type": "date",
|
||||
"required": false,
|
||||
"unique": false,
|
||||
"options": {
|
||||
"min": "",
|
||||
"max": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"system": false,
|
||||
"id": "qxsvm1rf",
|
||||
"name": "data",
|
||||
"type": "relation",
|
||||
"required": true,
|
||||
"unique": false,
|
||||
"options": {
|
||||
"collectionId": "3qwwkz4wb0lyi78",
|
||||
"cascadeDelete": false,
|
||||
"minSelect": null,
|
||||
"maxSelect": 1,
|
||||
"displayFields": [
|
||||
"data"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"system": false,
|
||||
"id": "nfernq2q",
|
||||
"name": "owner",
|
||||
"type": "relation",
|
||||
"required": false,
|
||||
"unique": false,
|
||||
"options": {
|
||||
"collectionId": "_pb_users_auth_",
|
||||
"cascadeDelete": false,
|
||||
"minSelect": null,
|
||||
"maxSelect": 1,
|
||||
"displayFields": [
|
||||
"username"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"system": false,
|
||||
"id": "p1aruqz5",
|
||||
"name": "past_owners",
|
||||
"type": "relation",
|
||||
"required": false,
|
||||
"unique": false,
|
||||
"options": {
|
||||
"collectionId": "_pb_users_auth_",
|
||||
"cascadeDelete": false,
|
||||
"minSelect": null,
|
||||
"maxSelect": null,
|
||||
"displayFields": [
|
||||
"username"
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"indexes": [],
|
||||
"listRule": "",
|
||||
"viewRule": "",
|
||||
"createRule": null,
|
||||
"updateRule": "",
|
||||
"deleteRule": null,
|
||||
"options": {}
|
||||
},
|
||||
{
|
||||
"id": "3qwwkz4wb0lyi78",
|
||||
"created": "2023-07-06 23:12:11.113Z",
|
||||
"updated": "2024-01-31 21:26:53.835Z",
|
||||
"name": "DataBlock",
|
||||
"type": "base",
|
||||
"system": false,
|
||||
"schema": [
|
||||
{
|
||||
"system": false,
|
||||
"id": "wbifl8pv",
|
||||
"name": "category",
|
||||
"type": "text",
|
||||
"required": false,
|
||||
"unique": false,
|
||||
"options": {
|
||||
"min": null,
|
||||
"max": null,
|
||||
"pattern": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"system": false,
|
||||
"id": "5a3nwg7m",
|
||||
"name": "modified_by",
|
||||
"type": "text",
|
||||
"required": false,
|
||||
"unique": false,
|
||||
"options": {
|
||||
"min": null,
|
||||
"max": null,
|
||||
"pattern": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"system": false,
|
||||
"id": "mkzyfsng",
|
||||
"name": "data",
|
||||
"type": "json",
|
||||
"required": false,
|
||||
"unique": false,
|
||||
"options": {}
|
||||
},
|
||||
{
|
||||
"system": false,
|
||||
"id": "a3d7pkoh",
|
||||
"name": "owner",
|
||||
"type": "relation",
|
||||
"required": false,
|
||||
"unique": false,
|
||||
"options": {
|
||||
"collectionId": "_pb_users_auth_",
|
||||
"cascadeDelete": false,
|
||||
"minSelect": null,
|
||||
"maxSelect": 1,
|
||||
"displayFields": [
|
||||
"username"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"system": false,
|
||||
"id": "80tmi6fm",
|
||||
"name": "block_id",
|
||||
"type": "text",
|
||||
"required": false,
|
||||
"unique": false,
|
||||
"options": {
|
||||
"min": null,
|
||||
"max": null,
|
||||
"pattern": ""
|
||||
}
|
||||
}
|
||||
],
|
||||
"indexes": [
|
||||
"CREATE INDEX ` + "`" + `idx_aYVfg1q` + "`" + ` ON ` + "`" + `DataBlock` + "`" + ` (` + "`" + `block_id` + "`" + `)"
|
||||
],
|
||||
"listRule": "",
|
||||
"viewRule": "",
|
||||
"createRule": "",
|
||||
"updateRule": "",
|
||||
"deleteRule": null,
|
||||
"options": {}
|
||||
},
|
||||
{
|
||||
"id": "_pb_users_auth_",
|
||||
"created": "2023-11-03 18:47:06.067Z",
|
||||
"updated": "2024-01-31 21:26:53.820Z",
|
||||
"name": "Users",
|
||||
"type": "auth",
|
||||
"system": false,
|
||||
"schema": [
|
||||
{
|
||||
"system": false,
|
||||
"id": "users_name",
|
||||
"name": "name",
|
||||
"type": "text",
|
||||
"required": false,
|
||||
"unique": false,
|
||||
"options": {
|
||||
"min": null,
|
||||
"max": null,
|
||||
"pattern": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"system": false,
|
||||
"id": "users_avatar",
|
||||
"name": "avatar",
|
||||
"type": "file",
|
||||
"required": false,
|
||||
"unique": false,
|
||||
"options": {
|
||||
"maxSelect": 1,
|
||||
"maxSize": 5242880,
|
||||
"mimeTypes": [
|
||||
"image/jpeg",
|
||||
"image/png",
|
||||
"image/svg+xml",
|
||||
"image/gif",
|
||||
"image/webp"
|
||||
],
|
||||
"thumbs": null,
|
||||
"protected": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"system": false,
|
||||
"id": "1hwaooub",
|
||||
"name": "devices",
|
||||
"type": "relation",
|
||||
"required": false,
|
||||
"unique": false,
|
||||
"options": {
|
||||
"collectionId": "fupstz47c55s69f",
|
||||
"cascadeDelete": false,
|
||||
"minSelect": null,
|
||||
"maxSelect": null,
|
||||
"displayFields": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"system": false,
|
||||
"id": "xvw8arlm",
|
||||
"name": "profiles",
|
||||
"type": "relation",
|
||||
"required": false,
|
||||
"unique": false,
|
||||
"options": {
|
||||
"collectionId": "3qwwkz4wb0lyi78",
|
||||
"cascadeDelete": false,
|
||||
"minSelect": null,
|
||||
"maxSelect": null,
|
||||
"displayFields": [
|
||||
"data"
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"indexes": [],
|
||||
"listRule": "id = @request.auth.id",
|
||||
"viewRule": "id = @request.auth.id",
|
||||
"createRule": "",
|
||||
"updateRule": "id = @request.auth.id",
|
||||
"deleteRule": "id = @request.auth.id",
|
||||
"options": {
|
||||
"allowEmailAuth": true,
|
||||
"allowOAuth2Auth": true,
|
||||
"allowUsernameAuth": true,
|
||||
"exceptEmailDomains": null,
|
||||
"manageRule": null,
|
||||
"minPasswordLength": 6,
|
||||
"onlyEmailDomains": null,
|
||||
"requireEmail": false
|
||||
}
|
||||
}
|
||||
]`
|
||||
|
||||
collections := []*models.Collection{}
|
||||
if err := json.Unmarshal([]byte(jsonData), &collections); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return daos.New(db).ImportCollections(collections, true, nil)
|
||||
}, func(db dbx.Builder) error {
|
||||
return nil
|
||||
})
|
||||
}
|
||||
Loading…
Reference in New Issue