This commit is contained in:
Eauldane
2025-08-22 11:55:35 +01:00
commit b21d2a685e
312 changed files with 31174 additions and 0 deletions

284
.dockerignore Normal file
View File

@@ -0,0 +1,284 @@
# Created by https://www.gitignore.io/api/csharp
### Csharp ###
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
project.fragment.lock.json
artifacts/
Properties/launchSettings.json
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
# CodeRush
.cr/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/
tools/Cake.CoreCLR
.vscode
tools
.dotnet
Dockerfile
# .env file contains default environment variables for docker
.env
.git/

357
.gitignore vendored Normal file
View File

@@ -0,0 +1,357 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# docker run data
Docker/run/data/
**/obj/
**/bin/
**/.idea/

3
.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "MareAPI"]
path = MareAPI
url = https://github.com/Eauldane/SnowcloakAPI.git

39
Docker/Readme.md Normal file
View File

@@ -0,0 +1,39 @@
# Mare Synchronos Docker Setup
This is primarily aimed at developers who want to spin up their own local server for development purposes without having to spin up a VM.
Obligatory requires Docker to be installed on the machine.
There are two directories: `build` and `run`
## 1. build images
There is two ways to build the necessary docker images which are differentiated by the folders `-local` and `-git`
- -local will run the image build against the current locally present sources
- -git will run the image build against the latest git main commit
It is possible to build all required images at once by running `docker-build.bat/sh` (Server, Servies, StaticFilesServer) or all 3 separately with `docker-build-<whatever>.bat/sh`
## 2. Configure ports + token
You should set up 2 environment variables that hold server specific configuration and open up ports.
The default ports used through the provided configuration are `6000` for the main server and `6200` as well as `6201` for the files downloads.
Both ports should be open to your computer through your router if you wish to test this with clients.
Furthermore there are two environment variables `DEV_MARE_CDNURL` and `DEV_MARE_DISCORDTOKEN` which you are required to set.
`DEV_MARE_CDNURL` should point to `http://<yourip or dyndns>:6200/cache/` and `DEV_MARE_DISCORDTOKEN` is an oauth token from a bot you need to create through the Discord bot portal.
You should also set `DEV_MARE_CDNURL2` to `http://<yourip or dyndns>:6201/cache/`
It is enough to set them as User variables. The compose files refer to those environment variables to overwrite configuration settings for the Server and Services to set those respective values.
It is also possible to set those values in the configuration.json files themselves.
Without a valid Discord bot you will not be able to register accounts without fumbling around in the PostgreSQL database.
## 3. Run Mare Server
The run folder contains two major Mare configurations which is `standalone` and `sharded`.
Both configurations default to port `6000` for the main server connection and `6200` for the files downloads. Sharded configuration additionally uses `6201` for downloads. No HTTPS.
All `appsettings.json` configurations provided are extensive at the point of writing, note the differences between the shard configurations and the main servers respectively.
They can be used as examples if you want to spin up your own servers otherwise.
The scripts to start the respective services are divided by name, the `daemon-start/stop` files use `compose up -d` to run it in the background and to be able to stop the containers as well.
The respective docker-compose files lie in the `compose` folder. I would not recommend editing them unless you know what you are doing.
All data (postgresql and files uploads) will be thrown into the `data` folder after startup.
All logs from the mare services will be thrown into `logs`, divided by shard, where applicable.
The `standalone` configuration features PostgeSQL, Mare Server, Mare StaticFilesServer and Mare Services.
The `sharded` configuration features PostgreSQL, Redis, HAProxy, Mare Server Main, 2 Mare Server Shards, Mare Services, Mare StaticFilesServer Main and 2 Mare StaticFilesServer Shards.
Haproxy is set up that it takes the same ports as the `standalone` configuration and distributes the connections between the shards.
In theory it should be possible to switch between the `standalone` and `sharded` configuration by shutting down one composition container and starting up the other. They share the same Database.

View File

@@ -0,0 +1,32 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0 as BUILD
COPY MareAPI /server/MareAPI
COPY MareSynchronosServer/MareSynchronosShared /server/MareSynchronosServer/MareSynchronosShared
COPY MareSynchronosServer/MareSynchronosAuthService /server/MareSynchronosServer/MareSynchronosAuthService
WORKDIR /server/MareSynchronosServer/MareSynchronosAuthService/
RUN dotnet publish \
--configuration=Debug \
--os=linux \
--output=/build \
MareSynchronosAuthService.csproj
FROM mcr.microsoft.com/dotnet/aspnet:8.0
RUN adduser \
--disabled-password \
--group \
--no-create-home \
--quiet \
--system \
mare
COPY --from=BUILD /build /opt/MareSynchronosAuthService
RUN chown -R mare:mare /opt/MareSynchronosAuthService
RUN apt-get update; apt-get install curl -y
USER mare:mare
WORKDIR /opt/MareSynchronosAuthService
CMD ["./MareSynchronosAuthService"]

View File

@@ -0,0 +1,30 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0 as BUILD
RUN git clone --recurse-submodules https://github.com/Penumbra-Sync/server
WORKDIR /server/MareSynchronosServer/MareSynchronosAuthService/
RUN dotnet publish \
--configuration=Release \
--os=linux \
--output=/MareSynchronosAuthService \
MareSynchronosAuthService.csproj
FROM mcr.microsoft.com/dotnet/aspnet:8.0
RUN adduser \
--disabled-password \
--group \
--no-create-home \
--quiet \
--system \
mare
COPY --from=BUILD /MareSynchronosAuthService /opt/MareSynchronosAuthService
RUN chown -R mare:mare /opt/MareSynchronosAuthService
RUN apt-get update; apt-get install curl -y
USER mare:mare
WORKDIR /opt/MareSynchronosAuthService
CMD ["./MareSynchronosAuthService"]

View File

@@ -0,0 +1,32 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0 as BUILD
COPY MareAPI /server/MareAPI
COPY MareSynchronosServer/MareSynchronosShared /server/MareSynchronosServer/MareSynchronosShared
COPY MareSynchronosServer/MareSynchronosServer /server/MareSynchronosServer/MareSynchronosServer
WORKDIR /server/MareSynchronosServer/MareSynchronosServer/
RUN dotnet publish \
--configuration=Release \
--os=linux \
--output=/build \
MareSynchronosServer.csproj
FROM mcr.microsoft.com/dotnet/aspnet:8.0
RUN adduser \
--disabled-password \
--group \
--no-create-home \
--quiet \
--system \
mare
COPY --from=BUILD /build /opt/MareSynchronosServer
RUN chown -R mare:mare /opt/MareSynchronosServer
RUN apt-get update; apt-get install curl -y
USER mare:mare
WORKDIR /opt/MareSynchronosServer
CMD ["./MareSynchronosServer"]

View File

@@ -0,0 +1,30 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0 as BUILD
RUN git clone --recurse-submodules https://github.com/Penumbra-Sync/server
WORKDIR /server/MareSynchronosServer/MareSynchronosServer/
RUN dotnet publish \
--configuration=Release \
--os=linux \
--output=/MareSynchronosServer \
MareSynchronosServer.csproj
FROM mcr.microsoft.com/dotnet/aspnet:8.0
RUN adduser \
--disabled-password \
--group \
--no-create-home \
--quiet \
--system \
mare
COPY --from=BUILD /MareSynchronosServer /opt/MareSynchronosServer
RUN chown -R mare:mare /opt/MareSynchronosServer
RUN apt-get update; apt-get install curl -y
USER mare:mare
WORKDIR /opt/MareSynchronosServer
CMD ["./MareSynchronosServer"]

View File

@@ -0,0 +1,32 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0 as BUILD
COPY MareAPI /server/MareAPI
COPY MareSynchronosServer/MareSynchronosShared /server/MareSynchronosServer/MareSynchronosShared
COPY MareSynchronosServer/MareSynchronosServices /server/MareSynchronosServer/MareSynchronosServices
WORKDIR /server/MareSynchronosServer/MareSynchronosServices/
RUN dotnet publish \
--configuration=Release \
--os=linux \
--output=/build \
MareSynchronosServices.csproj
FROM mcr.microsoft.com/dotnet/aspnet:8.0
RUN adduser \
--disabled-password \
--group \
--no-create-home \
--quiet \
--system \
mare
COPY --from=BUILD /build /opt/MareSynchronosServices
RUN chown -R mare:mare /opt/MareSynchronosServices
RUN apt-get update; apt-get install curl -y
USER mare:mare
WORKDIR /opt/MareSynchronosServices
CMD ["./MareSynchronosServices"]

View File

@@ -0,0 +1,30 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0 as BUILD
RUN git clone --recurse-submodules https://github.com/Penumbra-Sync/server
WORKDIR /server/MareSynchronosServer/MareSynchronosServices/
RUN dotnet publish \
--configuration=Release \
--os=linux \
--output=/MareSynchronosServices \
MareSynchronosServices.csproj
FROM mcr.microsoft.com/dotnet/aspnet:8.0
RUN adduser \
--disabled-password \
--group \
--no-create-home \
--quiet \
--system \
mare
COPY --from=BUILD /MareSynchronosServices /opt/MareSynchronosServices
RUN chown -R mare:mare /opt/MareSynchronosServices
RUN apt-get update; apt-get install curl -y
USER mare:mare
WORKDIR /opt/MareSynchronosServices
CMD ["./MareSynchronosServices"]

View File

@@ -0,0 +1,32 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0 as BUILD
COPY MareAPI /server/MareAPI
COPY MareSynchronosServer/MareSynchronosShared /server/MareSynchronosServer/MareSynchronosShared
COPY MareSynchronosServer/MareSynchronosStaticFilesServer /server/MareSynchronosServer/MareSynchronosStaticFilesServer
WORKDIR /server/MareSynchronosServer/MareSynchronosStaticFilesServer/
RUN dotnet publish \
--configuration=Release \
--os=linux \
--output=/build \
MareSynchronosStaticFilesServer.csproj
FROM mcr.microsoft.com/dotnet/aspnet:8.0
RUN adduser \
--disabled-password \
--group \
--no-create-home \
--quiet \
--system \
mare
COPY --from=BUILD /build /opt/MareSynchronosStaticFilesServer
RUN chown -R mare:mare /opt/MareSynchronosStaticFilesServer
RUN apt-get update; apt-get install curl -y
USER mare:mare
WORKDIR /opt/MareSynchronosStaticFilesServer
CMD ["./MareSynchronosStaticFilesServer"]

View File

@@ -0,0 +1,30 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0 as BUILD
RUN git clone --recurse-submodules https://github.com/Penumbra-Sync/server
WORKDIR /server/MareSynchronosServer/MareSynchronosStaticFilesServer/
RUN dotnet publish \
--configuration=Release \
--os=linux \
--output=/MareSynchronosStaticFilesServer \
MareSynchronosStaticFilesServer.csproj
FROM mcr.microsoft.com/dotnet/aspnet:8.0
RUN adduser \
--disabled-password \
--group \
--no-create-home \
--quiet \
--system \
mare
COPY --from=BUILD /MareSynchronosStaticFilesServer /opt/MareSynchronosStaticFilesServer
RUN chown -R mare:mare /opt/MareSynchronosStaticFilesServer
RUN apt-get update; apt-get install curl -y
USER mare:mare
WORKDIR /opt/MareSynchronosStaticFilesServer
CMD ["./MareSynchronosStaticFilesServer"]

View File

@@ -0,0 +1,2 @@
#!/bin/sh
docker build -t darkarchon/mare-synchronos-authservice:latest . -f ../Dockerfile-MareSynchronosAuthService-git --no-cache --pull --force-rm

View File

@@ -0,0 +1,2 @@
#!/bin/sh
docker build -t darkarchon/mare-synchronos-server:latest . -f ../Dockerfile-MareSynchronosServer-git --no-cache --pull --force-rm

View File

@@ -0,0 +1,2 @@
#!/bin/sh
docker build -t darkarchon/mare-synchronos-services:latest . -f ../Dockerfile-MareSynchronosServices-git --no-cache --pull --force-rm

View File

@@ -0,0 +1,2 @@
#!/bin/sh
docker build -t darkarchon/mare-synchronos-staticfilesserver:latest . -f ../Dockerfile-MareSynchronosStaticFilesServer-git --no-cache --pull --force-rm

View File

@@ -0,0 +1,5 @@
#!/bin/sh
./docker-build-server.sh
./docker-build-authservice.sh
./docker-build-services.sh
./docker-build-staticfilesserver.sh

View File

@@ -0,0 +1,2 @@
#!/bin/sh
docker build -t darkarchon/mare-synchronos-authservice:latest . -f ../Dockerfile-MareSynchronosAuthService --no-cache --pull --force-rm

View File

@@ -0,0 +1,4 @@
#!/bin/sh
cd ../../../
docker build -t darkarchon/mare-synchronos-server:latest . -f ../Dockerfile-MareSynchronosServer --no-cache --pull --force-rm
cd Docker/build/linux-local

View File

@@ -0,0 +1,4 @@
#!/bin/sh
cd ../../../
docker build -t darkarchon/mare-synchronos-services:latest . -f ../Dockerfile-MareSynchronosServices --no-cache --pull --force-rm
cd Docker/build/linux-local

View File

@@ -0,0 +1,4 @@
#!/bin/sh
cd ../../../
docker build -t darkarchon/mare-synchronos-staticfilesserver:latest . -f ../Dockerfile-MareSynchronosStaticFilesServer --no-cache --pull --force-rm
cd Docker/build/linux-local

View File

@@ -0,0 +1,5 @@
#!/bin/sh
./docker-build-server.sh
./docker-build-authservice.sh
./docker-build-services.sh
./docker-build-staticfilesserver.sh

View File

@@ -0,0 +1,3 @@
@echo off
docker build -t darkarchon/mare-synchronos-authservice:latest . -f ..\Dockerfile-MareSynchronosAuthService-git --no-cache --pull --force-rm

View File

@@ -0,0 +1,2 @@
@echo off
docker build -t darkarchon/mare-synchronos-server:latest . -f ..\Dockerfile-MareSynchronosServer-git --no-cache --pull --force-rm

View File

@@ -0,0 +1,3 @@
@echo off
docker build -t darkarchon/mare-synchronos-services:latest . -f ..\Dockerfile-MareSynchronosServices-git --no-cache --pull --force-rm

View File

@@ -0,0 +1,3 @@
@echo off
docker build -t darkarchon/mare-synchronos-staticfilesserver:latest . -f ..\Dockerfile-MareSynchronosStaticFilesServer-git --no-cache --pull --force-rm

View File

@@ -0,0 +1,6 @@
@echo off
call docker-build-server.bat
call docker-build-authservice.bat
call docker-build-services.bat
call docker-build-staticfilesserver.bat

View File

@@ -0,0 +1,4 @@
@echo off
cd ..\..\..\
docker build -t darkarchon/mare-synchronos-authservice:latest . -f Docker\build\Dockerfile-MareSynchronosAuthService --no-cache --pull --force-rm
cd Docker\build\windows-local

View File

@@ -0,0 +1,4 @@
@echo off
cd ..\..\..\
docker build -t darkarchon/mare-synchronos-server:latest . -f Docker\build\Dockerfile-MareSynchronosServer --no-cache --pull --force-rm
cd Docker\build\windows-local

View File

@@ -0,0 +1,4 @@
@echo off
cd ..\..\..\
docker build -t darkarchon/mare-synchronos-services:latest . -f Docker\build\Dockerfile-MareSynchronosServices --no-cache --pull --force-rm
cd Docker\build\windows-local

View File

@@ -0,0 +1,4 @@
@echo off
cd ..\..\..\
docker build -t darkarchon/mare-synchronos-staticfilesserver:latest . -f Docker\build\Dockerfile-MareSynchronosStaticFilesServer --no-cache --pull --force-rm
cd Docker\build\windows-local

View File

@@ -0,0 +1,6 @@
@echo off
call docker-build-server.bat
call docker-build-authservice.bat
call docker-build-services.bat
call docker-build-staticfilesserver.bat

View File

@@ -0,0 +1,145 @@
services:
postgres:
image: postgres:latest
restart: always
environment:
POSTGRES_DB: mare
POSTGRES_USER: mare
POSTGRES_PASSWORD: secretdevpassword
volumes:
- ../data/postgresql/:/var/lib/postgresql/data
- postgres_socket:/var/run/postgresql:rw
healthcheck:
test: ["CMD-SHELL", "pg_isready -U mare"]
interval: 5s
start_period: 5s
timeout: 5s
retries: 5
haproxy:
image: haproxy:latest
restart: always
ports:
- 6000:6000/tcp
volumes:
- ../config/sharded/haproxy-shards.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
depends_on:
mare-server:
condition: service_healthy
redis:
image: redis:latest
command: [sh, -c, "rm -f /data/dump.rdb && redis-server --save \"\" --appendonly no --requirepass secretredispassword"]
volumes:
- cache:/data
mare-server:
image: darkarchon/mare-synchronos-server:latest
restart: on-failure
environment:
MareSynchronos__CdnFullUrl: "${DEV_MARE_CDNURL}"
volumes:
- ../config/sharded/server-shard-main.json:/opt/MareSynchronosServer/appsettings.json
- ../log/server-shard-main/:/opt/MareSynchronosServer/logs/:rw
- postgres_socket:/var/run/postgresql/:rw
depends_on:
postgres:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "curl --fail http://localhost:6000/health || exit 1"]
retries: 60
start_period: 10s
timeout: 1s
mare-shard-1:
image: darkarchon/mare-synchronos-server:latest
restart: on-failure
volumes:
- ../config/sharded/server-shard-1.json:/opt/MareSynchronosServer/appsettings.json
- ../log/server-shard-1/:/opt/MareSynchronosServer/logs/:rw
- postgres_socket:/var/run/postgresql/:rw
depends_on:
mare-server:
condition: service_healthy
mare-shard-2:
image: darkarchon/mare-synchronos-server:latest
restart: on-failure
volumes:
- ../config/sharded/server-shard-2.json:/opt/MareSynchronosServer/appsettings.json
- ../log/server-shard-2/:/opt/MareSynchronosServer/logs/:rw
- postgres_socket:/var/run/postgresql/:rw
depends_on:
mare-server:
condition: service_healthy
mare-services:
image: darkarchon/mare-synchronos-services:latest
restart: on-failure
environment:
MareSynchronos__DiscordBotToken: "${DEV_MARE_DISCORDTOKEN}"
MareSynchronos__DiscordChannelForMessages: "${DEV_MARE_DISCORDCHANNEL}"
volumes:
- ../config/standalone/services-standalone.json:/opt/MareSynchronosServices/appsettings.json
- ../log/services-standalone/:/opt/MareSynchronosServices/logs/:rw
- postgres_socket:/var/run/postgresql/:rw
depends_on:
mare-server:
condition: service_healthy
mare-files:
image: darkarchon/mare-synchronos-staticfilesserver:latest
restart: on-failure
ports:
- 6200:6200/tcp
environment:
MareSynchronos__CdnShardConfiguration__0__CdnFullUrl: "${DEV_MARE_FILES1}"
MareSynchronos__CdnShardConfiguration__0__FileMatch: "^[012345678]"
MareSynchronos__CdnShardConfiguration__1__CdnFullUrl: "${DEV_MARE_FILES2}"
MareSynchronos__CdnShardConfiguration__1__FileMatch: "^[789ABCDEF]"
volumes:
- ../config/sharded/files-shard-main.json:/opt/MareSynchronosStaticFilesServer/appsettings.json
- ../log/files-standalone/:/opt/MareSynchronosStaticFilesServer/logs/:rw
- postgres_socket:/var/run/postgresql/:rw
- ../data/files-shard-main/:/marecache/:rw
depends_on:
mare-server:
condition: service_healthy
healthcheck:
test: curl --fail http://localhost:6200/health || exit 1
retries: 60
start_period: 10s
timeout: 1s
mare-files-shard-1:
image: darkarchon/mare-synchronos-staticfilesserver:latest
restart: on-failure
volumes:
- ../config/sharded/files-shard-1.json:/opt/MareSynchronosStaticFilesServer/appsettings.json
- ../log/files-shard-1/:/opt/MareSynchronosStaticFilesServer/logs/:rw
- postgres_socket:/var/run/postgresql/:rw
- ../data/files-shard-1/:/marecache/:rw
ports:
- 6201:6200/tcp
depends_on:
mare-files:
condition: service_healthy
mare-files-shard-2:
image: darkarchon/mare-synchronos-staticfilesserver:latest
restart: on-failure
volumes:
- ../config/sharded/files-shard-2.json:/opt/MareSynchronosStaticFilesServer/appsettings.json
- ../log/files-shard-2/:/opt/MareSynchronosStaticFilesServer/logs/:rw
- postgres_socket:/var/run/postgresql/:rw
- ../data/files-shard-2/:/marecache/:rw
ports:
- 6202:6200/tcp
depends_on:
mare-files:
condition: service_healthy
volumes:
cache:
driver: local
postgres_socket:

View File

@@ -0,0 +1,102 @@
services:
postgres:
image: postgres:latest
restart: always
ports:
- 5432:5432/tcp
environment:
POSTGRES_DB: mare
POSTGRES_USER: mare
POSTGRES_PASSWORD: secretdevpassword
volumes:
- ../data/postgresql/:/var/lib/postgresql/data
- postgres_socket:/var/run/postgresql:rw
healthcheck:
test: ["CMD-SHELL", "pg_isready -U mare"]
interval: 5s
timeout: 5s
retries: 5
redis:
image: redis:latest
command: [sh, -c, "rm -f /data/dump.rdb && redis-server --save \"\" --appendonly no --requirepass secretredispassword"]
volumes:
- cache:/data
mare-server:
image: darkarchon/mare-synchronos-server:latest
restart: on-failure
ports:
- 6000:6000/tcp
environment:
MareSynchronos__CdnFullUrl: "${DEV_MARE_CDNURL}"
DOTNET_USE_POLLING_FILE_WATCHER: 1
volumes:
- ../config/standalone/server-standalone.json:/opt/MareSynchronosServer/appsettings.json
- ../log/server-standalone/:/opt/MareSynchronosServer/logs/:rw
- postgres_socket:/var/run/postgresql/:rw
depends_on:
postgres:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "curl --fail http://localhost:6000/health || exit 1"]
retries: 60
start_period: 10s
timeout: 1s
mare-auth:
image: darkarchon/mare-synchronos-authservice:latest
restart: on-failure
environment:
DOTNET_USE_POLLING_FILE_WATCHER: 1
volumes:
- ../config/standalone/authservice-standalone.json:/opt/MareSynchronosAuthService/appsettings.json
- ../log/authservice-standalone/:/opt/MareSynchronosAuthService/logs/:rw
- postgres_socket:/var/run/postgresql/:rw
depends_on:
mare-server:
condition: service_healthy
postgres:
condition: service_healthy
mare-services:
image: darkarchon/mare-synchronos-services:latest
restart: on-failure
environment:
MareSynchronos__DiscordBotToken: "${DEV_MARE_DISCORDTOKEN}"
MareSynchronos__DiscordChannelForMessages: "${DEV_MARE_DISCORDCHANNEL}"
MareSynchronos__DiscordChannelForReports: "${DEV_MARE_DISCORDCHANNEL}"
DOTNET_USE_POLLING_FILE_WATCHER: 1
volumes:
- ../config/standalone/services-standalone.json:/opt/MareSynchronosServices/appsettings.json
- ../log/services-standalone/:/opt/MareSynchronosServices/logs/:rw
- postgres_socket:/var/run/postgresql/:rw
depends_on:
mare-server:
condition: service_healthy
postgres:
condition: service_healthy
mare-files:
image: darkarchon/mare-synchronos-staticfilesserver:latest
ports:
- 6200:6200/tcp
restart: on-failure
environment:
MareSynchronos__CdnFullUrl: "${DEV_MARE_CDNURL}"
DOTNET_USE_POLLING_FILE_WATCHER: 1
volumes:
- ../config/standalone/files-standalone.json:/opt/MareSynchronosStaticFilesServer/appsettings.json
- ../log/files-standalone/:/opt/MareSynchronosStaticFilesServer/logs/:rw
- postgres_socket:/var/run/postgresql/:rw
- ../data/files-standalone/:/marecache/:rw
depends_on:
postgres:
condition: service_healthy
mare-server:
condition: service_healthy
volumes:
postgres_socket:
cache:
driver: local

View File

@@ -0,0 +1,53 @@
{
"ConnectionStrings": {
"DefaultConnection": "Host=/var/run/postgresql;Port=5432;Database=mare;Username=mare;Keepalive=15;Minimum Pool Size=10;Maximum Pool Size=50;No Reset On Close=true;Max Auto Prepare=50;Enlist=false"
},
"Logging": {
"LogLevel": {
"Default": "Warning",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information",
"MareSynchronosStaticFilesServer": "Debug",
"MareSynchronosShared": "Information",
"System.IO": "Information"
},
"File": {
"BasePath": "logs",
"FileAccessMode": "KeepOpenAndAutoFlush",
"FileEncodingName": "utf-8",
"DateFormat": "yyyMMdd",
"MaxFileSize": 104857600,
"Files": [
{
"Path": "<date:yyyy>/<date:MM>/<date:dd>/mare-<date:HH>-<counter:0000>.log"
}
]
}
},
"MareSynchronos": {
"DbContextPoolSize": 512,
"ShardName": "Files Shard 1",
"MetricsPort": 6250,
"ForcedDeletionOfFilesAfterHours": 2,
"CacheSizeHardLimitInGiB": 5,
"UnusedFileRetentionPeriodInDays": 14,
"CacheDirectory": "/marecache/",
"DownloadTimeoutSeconds": 30,
"DownloadQueueSize": 50,
"DownloadQueueReleaseSeconds": 15,
"RedisConnectionString": "redis,password=secretredispassword",
"Jwt": "teststringteststringteststringteststringteststringteststringteststringteststringteststringteststring",
"MainServerAddress": "http://mare-server:6000",
"MainFileServerAddress": "http://mare-files:6200"
},
"AllowedHosts": "*",
"Kestrel": {
"Endpoints": {
"Http": {
"Url": "http://+:6200"
}
}
},
"IpRateLimiting": {},
"IPRateLimitPolicies": {}
}

View File

@@ -0,0 +1,53 @@
{
"ConnectionStrings": {
"DefaultConnection": "Host=/var/run/postgresql;Port=5432;Database=mare;Username=mare;Keepalive=15;Minimum Pool Size=10;Maximum Pool Size=50;No Reset On Close=true;Max Auto Prepare=50;Enlist=false"
},
"Logging": {
"LogLevel": {
"Default": "Warning",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information",
"MareSynchronosStaticFilesServer": "Debug",
"MareSynchronosShared": "Information",
"System.IO": "Information"
},
"File": {
"BasePath": "logs",
"FileAccessMode": "KeepOpenAndAutoFlush",
"FileEncodingName": "utf-8",
"DateFormat": "yyyMMdd",
"MaxFileSize": 104857600,
"Files": [
{
"Path": "<date:yyyy>/<date:MM>/<date:dd>/mare-<date:HH>-<counter:0000>.log"
}
]
}
},
"MareSynchronos": {
"DbContextPoolSize": 512,
"ShardName": "Files Shard 2",
"MetricsPort": 6250,
"ForcedDeletionOfFilesAfterHours": 2,
"CacheSizeHardLimitInGiB": 5,
"UnusedFileRetentionPeriodInDays": 14,
"CacheDirectory": "/marecache/",
"DownloadTimeoutSeconds": 30,
"DownloadQueueSize": 50,
"DownloadQueueReleaseSeconds": 15,
"RedisConnectionString": "redis,password=secretredispassword",
"Jwt": "teststringteststringteststringteststringteststringteststringteststringteststringteststringteststring",
"MainServerAddress": "http://mare-server:6000",
"MainFileServerAddress": "http://mare-files:6200"
},
"AllowedHosts": "*",
"Kestrel": {
"Endpoints": {
"Http": {
"Url": "http://+:6200"
}
}
},
"IpRateLimiting": {},
"IPRateLimitPolicies": {}
}

View File

@@ -0,0 +1,56 @@
{
"ConnectionStrings": {
"DefaultConnection": "Host=/var/run/postgresql;Port=5432;Database=mare;Username=mare;Keepalive=15;Minimum Pool Size=10;Maximum Pool Size=50;No Reset On Close=true;Max Auto Prepare=50;Enlist=false"
},
"Logging": {
"LogLevel": {
"Default": "Warning",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information",
"MareSynchronosStaticFilesServer": "Information",
"MareSynchronosShared": "Information",
"System.IO": "Information"
},
"File": {
"BasePath": "logs",
"FileAccessMode": "KeepOpenAndAutoFlush",
"FileEncodingName": "utf-8",
"DateFormat": "yyyMMdd",
"MaxFileSize": 104857600,
"Files": [
{
"Path": "<date:yyyy>/<date:MM>/<date:dd>/mare-<date:HH>-<counter:0000>.log"
}
]
}
},
"MareSynchronos": {
"DbContextPoolSize": 512,
"ShardName": "Files",
"MetricsPort": 6250,
"FileServerGrpcAddress": "",
"ForcedDeletionOfFilesAfterHours": -1,
"CacheSizeHardLimitInGiB": -1,
"UnusedFileRetentionPeriodInDays": 14,
"CacheDirectory": "/marecache/",
"RemoteCacheSourceUri": "",
"RedisConnectionString": "redis,password=secretredispassword",
"Jwt": "teststringteststringteststringteststringteststringteststringteststringteststringteststringteststring",
"MainServerAddress": "http://mare-server:6000",
"MainFileServerAddress": ""
},
"AllowedHosts": "*",
"Kestrel": {
"Endpoints": {
"Http": {
"Url": "http://+:6200"
},
"Grpc": {
"Protocols": "Http2",
"Url": "http://+:6205"
}
}
},
"IpRateLimiting": {},
"IPRateLimitPolicies": {}
}

View File

@@ -0,0 +1,30 @@
global
log /dev/log local0
log /dev/log local1 notice
daemon
ca-base /etc/ssl/certs
crt-base /etc/ssl/private
ssl-default-bind-ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
ssl-default-bind-ciphersuites TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256
ssl-default-bind-options ssl-min-ver TLSv1.2 no-tls-tickets
defaults
log global
mode http
option httplog
option dontlognull
timeout connect 5000
timeout client 50000
timeout server 50000
frontend mare
bind :6000
default_backend mare-servers
backend mare-servers
balance leastconn
cookie SERVER insert indirect nocache
server mare1 mare-shard-1:6000 cookie mare1
server mare2 mare-shard-2:6000 cookie mare2

View File

@@ -0,0 +1,45 @@
{
"ConnectionStrings": {
"DefaultConnection": "Host=/var/run/postgresql;Port=5432;Database=mare;Username=mare;Keepalive=15;Minimum Pool Size=10;Maximum Pool Size=50;No Reset On Close=true;Max Auto Prepare=50;Enlist=false"
},
"Logging": {
"LogLevel": {
"Default": "Warning",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information",
"MareSynchronosServer": "Information",
"MareSynchronosShared": "Information",
"System.IO": "Information"
},
"File": {
"BasePath": "logs",
"FileAccessMode": "KeepOpenAndAutoFlush",
"FileEncodingName": "utf-8",
"DateFormat": "yyyMMdd",
"MaxFileSize": 104857600,
"Files": [
{
"Path": "<date:yyyy>/<date:MM>/<date:dd>/mare-<date:HH>-<counter:0000>.log"
}
]
}
},
"MareSynchronos": {
"DbContextPoolSize": 512,
"ShardName": "Shard 1",
"MetricsPort": 6050,
"MainServerAddress": "http://mare-server:6000",
"RedisConnectionString": "redis,password=secretredispassword",
"Jwt": "teststringteststringteststringteststringteststringteststringteststringteststringteststringteststring"
},
"AllowedHosts": "*",
"Kestrel": {
"Endpoints": {
"Http": {
"Url": "http://+:6000"
}
}
},
"IpRateLimiting": {},
"IPRateLimitPolicies": {}
}

View File

@@ -0,0 +1,45 @@
{
"ConnectionStrings": {
"DefaultConnection": "Host=/var/run/postgresql;Port=5432;Database=mare;Username=mare;Keepalive=15;Minimum Pool Size=10;Maximum Pool Size=50;No Reset On Close=true;Max Auto Prepare=50;Enlist=false"
},
"Logging": {
"LogLevel": {
"Default": "Warning",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information",
"MareSynchronosServer": "Information",
"MareSynchronosShared": "Information",
"System.IO": "Information"
},
"File": {
"BasePath": "logs",
"FileAccessMode": "KeepOpenAndAutoFlush",
"FileEncodingName": "utf-8",
"DateFormat": "yyyMMdd",
"MaxFileSize": 104857600,
"Files": [
{
"Path": "<date:yyyy>/<date:MM>/<date:dd>/mare-<date:HH>-<counter:0000>.log"
}
]
}
},
"MareSynchronos": {
"DbContextPoolSize": 512,
"ShardName": "Shard 2",
"MetricsPort": 6050,
"MainServerAddress": "http://mare-server:6000",
"RedisConnectionString": "redis,password=secretredispassword",
"Jwt": "teststringteststringteststringteststringteststringteststringteststringteststringteststringteststring"
},
"AllowedHosts": "*",
"Kestrel": {
"Endpoints": {
"Http": {
"Url": "http://+:6000"
}
}
},
"IpRateLimiting": {},
"IPRateLimitPolicies": {}
}

View File

@@ -0,0 +1,71 @@
{
"ConnectionStrings": {
"DefaultConnection": "Host=/var/run/postgresql;Port=5432;Database=mare;Username=mare;Keepalive=15;Minimum Pool Size=10;Maximum Pool Size=50;No Reset On Close=true;Max Auto Prepare=50;Enlist=false"
},
"Logging": {
"LogLevel": {
"Default": "Warning",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information",
"MareSynchronosServer": "Information",
"MareSynchronosShared": "Information",
"System.IO": "Information"
},
"File": {
"BasePath": "logs",
"FileAccessMode": "KeepOpenAndAutoFlush",
"FileEncodingName": "utf-8",
"DateFormat": "yyyMMdd",
"MaxFileSize": 104857600,
"Files": [
{
"Path": "<date:yyyy>/<date:MM>/<date:dd>/mare-<date:HH>-<counter:0000>.log"
}
]
}
},
"MareSynchronos": {
"DbContextPoolSize": 512,
"ShardName": "Main",
"MetricsPort": 6050,
"MainServerGrpcAddress": "",
"FailedAuthForTempBan": 5,
"TempBanDurationInMinutes": 5,
"Jwt": "teststringteststringteststringteststringteststringteststringteststringteststringteststringteststring",
"WhitelistedIps": [
""
],
"RedisConnectionString": "redis,password=secretredispassword",
"CdnFullUrl": "http://localhost:6200/",
"StaticFileServiceAddress": "http://mare-files:6205",
"MaxExistingGroupsByUser": 3,
"MaxJoinedGroupsByUser": 6,
"MaxGroupUserCount": 100,
"PurgeUnusedAccounts": false,
"PurgeUnusedAccountsPeriodInDays": 14,
"CdnShardConfiguration": [
{
"FileMatch": "^[01234567]",
"CdnFullUrl": ""
},
{
"FileMatch": "^[89ABCDEF]",
"CdnFullUrl": ""
}
]
},
"AllowedHosts": "*",
"Kestrel": {
"Endpoints": {
"Http": {
"Url": "http://+:6000"
},
"Grpc": {
"Protocols": "Http2",
"Url": "http://+:6005"
}
}
},
"IpRateLimiting": {},
"IPRateLimitPolicies": {}
}

View File

@@ -0,0 +1,42 @@
{
"ConnectionStrings": {
"DefaultConnection": "Host=/var/run/postgresql;Port=5432;Database=mare;Username=mare;Keepalive=15;Minimum Pool Size=10;Maximum Pool Size=50;No Reset On Close=true;Max Auto Prepare=50;Enlist=false"
},
"Logging": {
"LogLevel": {
"Default": "Warning",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information",
"MareSynchronosServices": "Information",
"MareSynchronosShared": "Information",
"System.IO": "Information"
},
"File": {
"BasePath": "logs",
"FileAccessMode": "KeepOpenAndAutoFlush",
"FileEncodingName": "utf-8",
"DateFormat": "yyyMMdd",
"MaxFileSize": 104857600,
"Files": [
{
"Path": "<date:yyyy>/<date:MM>/<date:dd>/mare-<date:HH>-<counter:0000>.log"
}
]
}
},
"MareSynchronos": {
"DbContextPoolSize": 512,
"ShardName": "AuthServices",
"MetricsPort": 6150,
"Jwt": "teststringteststringteststringteststringteststringteststringteststringteststringteststringteststring",
"RedisConnectionString": "redis,password=secretredispassword",
"FailedAuthForTempBan": 5,
"UseGeoIP": false,
"GeoIPDbCityFile": ""
},
"AllowedHosts": "*",
"Kestrel": {
},
"IpRateLimiting": {},
"IPRateLimitPolicies": {}
}

View File

@@ -0,0 +1,53 @@
{
"ConnectionStrings": {
"DefaultConnection": "Host=/var/run/postgresql;Port=5432;Database=mare;Username=mare;Keepalive=15;Minimum Pool Size=10;Maximum Pool Size=50;No Reset On Close=true;Max Auto Prepare=50;Enlist=false"
},
"Logging": {
"LogLevel": {
"Default": "Debug",
"Microsoft": "Debug",
"Microsoft.Hosting.Lifetime": "Information",
"MareSynchronosStaticFilesServer": "Debug",
"MareSynchronosShared": "Debug",
"System.IO": "Information"
},
"File": {
"BasePath": "logs",
"FileAccessMode": "KeepOpenAndAutoFlush",
"FileEncodingName": "utf-8",
"DateFormat": "yyyMMdd",
"MaxFileSize": 104857600,
"Files": [
{
"Path": "<date:yyyy>/<date:MM>/<date:dd>/mare-<date:HH>-<counter:0000>.log"
}
]
}
},
"MareSynchronos": {
"DbContextPoolSize": 512,
"ShardName": "Files",
"MetricsPort": 6250,
"ForcedDeletionOfFilesAfterHours": -1,
"CacheSizeHardLimitInGiB": -1,
"UnusedFileRetentionPeriodInDays": 14,
"CacheDirectory": "/marecache/",
"RemoteCacheSourceUri": "",
"MainServerAddress": "http://mare-server:6000/",
"RedisConnectionString": "redis,password=secretredispassword",
"MainFileServerAddress": "",
"Jwt": "teststringteststringteststringteststringteststringteststringteststringteststringteststringteststring",
"UseColdStorage": false,
"IsDistributionNode": true
},
"AllowedHosts": "*",
"Kestrel": {
"Endpoints": {
"Http": {
"Url": "http://+:6200"
}
}
},
"IpRateLimiting": {},
"IPRateLimitPolicies": {}
}

View File

@@ -0,0 +1,57 @@
{
"ConnectionStrings": {
"DefaultConnection": "Host=/var/run/postgresql;Port=5432;Database=mare;Username=mare;Keepalive=15;Minimum Pool Size=10;Maximum Pool Size=50;No Reset On Close=true;Max Auto Prepare=50;Enlist=false"
},
"Logging": {
"LogLevel": {
"Default": "Warning",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information",
"MareSynchronosServer": "Information",
"MareSynchronosShared": "Information",
"System.IO": "Information"
},
"File": {
"BasePath": "logs",
"FileAccessMode": "KeepOpenAndAutoFlush",
"FileEncodingName": "utf-8",
"DateFormat": "yyyMMdd",
"MaxFileSize": 104857600,
"Files": [
{
"Path": "<date:yyyy>/<date:MM>/<date:dd>/mare-<date:HH>-<counter:0000>.log"
}
]
}
},
"MareSynchronos": {
"DbContextPoolSize": 512,
"ShardName": "Main",
"MetricsPort": 6050,
"MainServerAddress": "",
"FailedAuthForTempBan": 5,
"TempBanDurationInMinutes": 5,
"Jwt": "teststringteststringteststringteststringteststringteststringteststringteststringteststringteststring",
"WhitelistedIps": [
""
],
"RedisConnectionString": "redis,password=secretredispassword",
"CdnFullUrl": "http://localhost:6200",
"MaxExistingGroupsByUser": 3,
"MaxJoinedGroupsByUser": 6,
"MaxGroupUserCount": 100,
"PurgeUnusedAccounts": false,
"PurgeUnusedAccountsPeriodInDays": 14,
"ExpectedClientVersion": "0.8.0"
},
"AllowedHosts": "*",
"Kestrel": {
"Endpoints": {
"Http": {
"Url": "http://+:6000"
}
}
},
"IpRateLimiting": {},
"IPRateLimitPolicies": {}
}

View File

@@ -0,0 +1,44 @@
{
"ConnectionStrings": {
"DefaultConnection": "Host=/var/run/postgresql;Port=5432;Database=mare;Username=mare;Keepalive=15;Minimum Pool Size=10;Maximum Pool Size=50;No Reset On Close=true;Max Auto Prepare=50;Enlist=false"
},
"Logging": {
"LogLevel": {
"Default": "Warning",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information",
"MareSynchronosServices": "Information",
"MareSynchronosShared": "Information",
"System.IO": "Information"
},
"File": {
"BasePath": "logs",
"FileAccessMode": "KeepOpenAndAutoFlush",
"FileEncodingName": "utf-8",
"DateFormat": "yyyMMdd",
"MaxFileSize": 104857600,
"Files": [
{
"Path": "<date:yyyy>/<date:MM>/<date:dd>/mare-<date:HH>-<counter:0000>.log"
}
]
}
},
"MareSynchronos": {
"DbContextPoolSize": 512,
"ShardName": "Services",
"MetricsPort": 6150,
"CdnFullUrl": "http://localhost:6200/",
"MainServerAddress": "http://mare-server:6000/",
"MainServerGrpcAddress": "http://mare-server:6005/",
"DiscordBotToken": "",
"DiscordChannelForMessages": "",
"Jwt": "teststringteststringteststringteststringteststringteststringteststringteststringteststringteststring",
"RedisConnectionString": "redis,password=secretredispassword"
},
"AllowedHosts": "*",
"Kestrel": {
},
"IpRateLimiting": {},
"IPRateLimitPolicies": {}
}

View File

@@ -0,0 +1,2 @@
#!/bin/sh
docker compose -f compose/mare-sharded.yml -p sharded up -d

View File

@@ -0,0 +1,2 @@
#!/bin/sh
docker compose -f compose/mare-sharded.yml -p sharded stop

View File

@@ -0,0 +1,2 @@
#!/bin/sh
docker compose -f compose/mare-sharded.yml -p sharded up

View File

@@ -0,0 +1,2 @@
#!/bin/sh
docker compose -f compose/mare-standalone.yml -p standalone up -d

View File

@@ -0,0 +1,2 @@
#!/bin/sh
docker compose -f compose/mare-standalone.yml -p standalone stop

View File

@@ -0,0 +1,2 @@
#!/bin/sh
docker compose -f compose/mare-standalone.yml -p standalone up

View File

@@ -0,0 +1,2 @@
@echo off
docker compose -f compose\mare-sharded.yml -p sharded up -d

View File

@@ -0,0 +1,2 @@
@echo off
docker compose -f compose\mare-sharded.yml -p sharded stop

View File

@@ -0,0 +1,2 @@
@echo off
docker compose -f compose\mare-sharded.yml -p sharded up

View File

@@ -0,0 +1,2 @@
@echo off
docker compose -f compose\mare-standalone.yml -p standalone up -d

View File

@@ -0,0 +1,2 @@
@echo off
docker compose -f compose\mare-standalone.yml -p standalone stop

View File

@@ -0,0 +1,2 @@
@echo off
docker compose -f compose\mare-standalone.yml -p standalone up

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 Mare Synchronos
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

350
MareAPI/.gitignore vendored Normal file
View File

@@ -0,0 +1,350 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/

21
MareAPI/LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 Mare Synchronos
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,36 @@
using MareSynchronos.API.Data.Enum;
using MessagePack;
using System.Text.Json.Serialization;
using System.Text.Json;
using System.Text;
using System.Security.Cryptography;
namespace MareSynchronos.API.Data;
[MessagePackObject(keyAsPropertyName: true)]
public class CharacterData
{
public CharacterData()
{
DataHash = new(() =>
{
var json = JsonSerializer.Serialize(this);
#pragma warning disable SYSLIB0021 // Type or member is obsolete
using SHA256CryptoServiceProvider cryptoProvider = new();
#pragma warning restore SYSLIB0021 // Type or member is obsolete
return BitConverter.ToString(cryptoProvider.ComputeHash(Encoding.UTF8.GetBytes(json))).Replace("-", "", StringComparison.Ordinal);
});
}
public Dictionary<ObjectKind, string> CustomizePlusData { get; set; } = new();
[JsonIgnore]
public Lazy<string> DataHash { get; }
public Dictionary<ObjectKind, List<FileReplacementData>> FileReplacements { get; set; } = new();
public Dictionary<ObjectKind, string> GlamourerData { get; set; } = new();
public string HeelsData { get; set; } = string.Empty;
public string HonorificData { get; set; } = string.Empty;
public string ManipulationData { get; set; } = string.Empty;
public string MoodlesData { get; set; } = string.Empty;
public string PetNamesData { get; set; } = string.Empty;
}

View File

@@ -0,0 +1,11 @@
using MessagePack;
namespace MareSynchronos.API.Data;
[MessagePackObject(keyAsPropertyName: true)]
public record ChatMessage
{
public string SenderName { get; set; } = string.Empty;
public uint SenderHomeWorldId { get; set; } = 0;
public byte[] PayloadContent { get; set; } = [];
}

View File

@@ -0,0 +1,19 @@
namespace MareSynchronos.API.Data.Comparer;
public class GroupDataComparer : IEqualityComparer<GroupData>
{
public static GroupDataComparer Instance => _instance;
private static GroupDataComparer _instance = new GroupDataComparer();
private GroupDataComparer() { }
public bool Equals(GroupData? x, GroupData? y)
{
if (x == null || y == null) return false;
return x.GID.Equals(y.GID, StringComparison.Ordinal);
}
public int GetHashCode(GroupData obj)
{
return obj.GID.GetHashCode();
}
}

View File

@@ -0,0 +1,23 @@
using MareSynchronos.API.Dto.Group;
namespace MareSynchronos.API.Data.Comparer;
public class GroupDtoComparer : IEqualityComparer<GroupDto>
{
public static GroupDtoComparer Instance => _instance;
private static GroupDtoComparer _instance = new GroupDtoComparer();
private GroupDtoComparer() { }
public bool Equals(GroupDto? x, GroupDto? y)
{
if (x == null || y == null) return false;
return x.GID.Equals(y.GID, StringComparison.Ordinal);
}
public int GetHashCode(GroupDto obj)
{
return obj.Group.GID.GetHashCode();
}
}

View File

@@ -0,0 +1,20 @@
using MareSynchronos.API.Dto.Group;
namespace MareSynchronos.API.Data.Comparer;
public class GroupPairDtoComparer : IEqualityComparer<GroupPairDto>
{
public static GroupPairDtoComparer Instance => _instance;
private static GroupPairDtoComparer _instance = new();
private GroupPairDtoComparer() { }
public bool Equals(GroupPairDto? x, GroupPairDto? y)
{
if (x == null || y == null) return false;
return x.GID.Equals(y.GID, StringComparison.Ordinal) && x.UID.Equals(y.UID, StringComparison.Ordinal);
}
public int GetHashCode(GroupPairDto obj)
{
return HashCode.Combine(obj.Group.GID.GetHashCode(), obj.User.UID.GetHashCode());
}
}

View File

@@ -0,0 +1,20 @@
namespace MareSynchronos.API.Data.Comparer;
public class UserDataComparer : IEqualityComparer<UserData>
{
public static UserDataComparer Instance => _instance;
private static UserDataComparer _instance = new();
private UserDataComparer() { }
public bool Equals(UserData? x, UserData? y)
{
if (x == null || y == null) return false;
return x.UID.Equals(y.UID, StringComparison.Ordinal);
}
public int GetHashCode(UserData obj)
{
return obj.UID.GetHashCode();
}
}

View File

@@ -0,0 +1,20 @@
using MareSynchronos.API.Dto.User;
namespace MareSynchronos.API.Data.Comparer;
public class UserDtoComparer : IEqualityComparer<UserDto>
{
public static UserDtoComparer Instance => _instance;
private static UserDtoComparer _instance = new();
private UserDtoComparer() { }
public bool Equals(UserDto? x, UserDto? y)
{
if (x == null || y == null) return false;
return x.User.UID.Equals(y.User.UID, StringComparison.Ordinal);
}
public int GetHashCode(UserDto obj)
{
return obj.User.UID.GetHashCode();
}
}

View File

@@ -0,0 +1,11 @@
namespace MareSynchronos.API.Data.Enum;
[Flags]
public enum GroupPermissions
{
NoneSet = 0x0,
DisableAnimations = 0x1,
DisableSounds = 0x2,
DisableInvites = 0x4,
DisableVFX = 0x8,
}

View File

@@ -0,0 +1,9 @@
namespace MareSynchronos.API.Data.Enum;
[Flags]
public enum GroupUserInfo
{
None = 0x0,
IsModerator = 0x2,
IsPinned = 0x4
}

View File

@@ -0,0 +1,11 @@
namespace MareSynchronos.API.Data.Enum;
[Flags]
public enum GroupUserPermissions
{
NoneSet = 0x0,
Paused = 0x1,
DisableAnimations = 0x2,
DisableSounds = 0x4,
DisableVFX = 0x8,
}

View File

@@ -0,0 +1,8 @@
namespace MareSynchronos.API.Data.Enum;
public enum MessageSeverity
{
Information,
Warning,
Error
}

View File

@@ -0,0 +1,9 @@
namespace MareSynchronos.API.Data.Enum;
public enum ObjectKind
{
Player = 0,
MinionOrMount = 1,
Companion = 2,
Pet = 3,
}

View File

@@ -0,0 +1,12 @@
namespace MareSynchronos.API.Data.Enum;
[Flags]
public enum UserPermissions
{
NoneSet = 0,
Paired = 1,
Paused = 2,
DisableAnimations = 4,
DisableSounds = 8,
DisableVFX = 16,
}

View File

@@ -0,0 +1,50 @@
using MareSynchronos.API.Data.Enum;
namespace MareSynchronos.API.Data.Extensions;
public static class GroupPermissionsExtensions
{
public static bool IsDisableAnimations(this GroupPermissions perm)
{
return perm.HasFlag(GroupPermissions.DisableAnimations);
}
public static bool IsDisableSounds(this GroupPermissions perm)
{
return perm.HasFlag(GroupPermissions.DisableSounds);
}
public static bool IsDisableInvites(this GroupPermissions perm)
{
return perm.HasFlag(GroupPermissions.DisableInvites);
}
public static bool IsDisableVFX(this GroupPermissions perm)
{
return perm.HasFlag(GroupPermissions.DisableVFX);
}
public static void SetDisableAnimations(this ref GroupPermissions perm, bool set)
{
if (set) perm |= GroupPermissions.DisableAnimations;
else perm &= ~GroupPermissions.DisableAnimations;
}
public static void SetDisableSounds(this ref GroupPermissions perm, bool set)
{
if (set) perm |= GroupPermissions.DisableSounds;
else perm &= ~GroupPermissions.DisableSounds;
}
public static void SetDisableInvites(this ref GroupPermissions perm, bool set)
{
if (set) perm |= GroupPermissions.DisableInvites;
else perm &= ~GroupPermissions.DisableInvites;
}
public static void SetDisableVFX(this ref GroupPermissions perm, bool set)
{
if (set) perm |= GroupPermissions.DisableVFX;
else perm &= ~GroupPermissions.DisableVFX;
}
}

View File

@@ -0,0 +1,28 @@
using MareSynchronos.API.Data.Enum;
namespace MareSynchronos.API.Data.Extensions;
public static class GroupUserInfoExtensions
{
public static bool IsModerator(this GroupUserInfo info)
{
return info.HasFlag(GroupUserInfo.IsModerator);
}
public static bool IsPinned(this GroupUserInfo info)
{
return info.HasFlag(GroupUserInfo.IsPinned);
}
public static void SetModerator(this ref GroupUserInfo info, bool isModerator)
{
if (isModerator) info |= GroupUserInfo.IsModerator;
else info &= ~GroupUserInfo.IsModerator;
}
public static void SetPinned(this ref GroupUserInfo info, bool isPinned)
{
if (isPinned) info |= GroupUserInfo.IsPinned;
else info &= ~GroupUserInfo.IsPinned;
}
}

View File

@@ -0,0 +1,50 @@
using MareSynchronos.API.Data.Enum;
namespace MareSynchronos.API.Data.Extensions;
public static class GroupUserPermissionsExtensions
{
public static bool IsDisableAnimations(this GroupUserPermissions perm)
{
return perm.HasFlag(GroupUserPermissions.DisableAnimations);
}
public static bool IsDisableSounds(this GroupUserPermissions perm)
{
return perm.HasFlag(GroupUserPermissions.DisableSounds);
}
public static bool IsPaused(this GroupUserPermissions perm)
{
return perm.HasFlag(GroupUserPermissions.Paused);
}
public static bool IsDisableVFX(this GroupUserPermissions perm)
{
return perm.HasFlag(GroupUserPermissions.DisableVFX);
}
public static void SetDisableAnimations(this ref GroupUserPermissions perm, bool set)
{
if (set) perm |= GroupUserPermissions.DisableAnimations;
else perm &= ~GroupUserPermissions.DisableAnimations;
}
public static void SetDisableSounds(this ref GroupUserPermissions perm, bool set)
{
if (set) perm |= GroupUserPermissions.DisableSounds;
else perm &= ~GroupUserPermissions.DisableSounds;
}
public static void SetPaused(this ref GroupUserPermissions perm, bool set)
{
if (set) perm |= GroupUserPermissions.Paused;
else perm &= ~GroupUserPermissions.Paused;
}
public static void SetDisableVFX(this ref GroupUserPermissions perm, bool set)
{
if (set) perm |= GroupUserPermissions.DisableVFX;
else perm &= ~GroupUserPermissions.DisableVFX;
}
}

View File

@@ -0,0 +1,61 @@
using MareSynchronos.API.Data.Enum;
namespace MareSynchronos.API.Data.Extensions;
public static class UserPermissionsExtensions
{
public static bool IsPaired(this UserPermissions perm)
{
return perm.HasFlag(UserPermissions.Paired);
}
public static bool IsPaused(this UserPermissions perm)
{
return perm.HasFlag(UserPermissions.Paused);
}
public static bool IsDisableAnimations(this UserPermissions perm)
{
return perm.HasFlag(UserPermissions.DisableAnimations);
}
public static bool IsDisableSounds(this UserPermissions perm)
{
return perm.HasFlag(UserPermissions.DisableSounds);
}
public static bool IsDisableVFX(this UserPermissions perm)
{
return perm.HasFlag(UserPermissions.DisableVFX);
}
public static void SetPaired(this ref UserPermissions perm, bool paired)
{
if (paired) perm |= UserPermissions.Paired;
else perm &= ~UserPermissions.Paired;
}
public static void SetPaused(this ref UserPermissions perm, bool paused)
{
if (paused) perm |= UserPermissions.Paused;
else perm &= ~UserPermissions.Paused;
}
public static void SetDisableAnimations(this ref UserPermissions perm, bool set)
{
if (set) perm |= UserPermissions.DisableAnimations;
else perm &= ~UserPermissions.DisableAnimations;
}
public static void SetDisableSounds(this ref UserPermissions perm, bool set)
{
if (set) perm |= UserPermissions.DisableSounds;
else perm &= ~UserPermissions.DisableSounds;
}
public static void SetDisableVFX(this ref UserPermissions perm, bool set)
{
if (set) perm |= UserPermissions.DisableVFX;
else perm &= ~UserPermissions.DisableVFX;
}
}

View File

@@ -0,0 +1,30 @@
using MessagePack;
using System.Text.Json.Serialization;
using System.Text.Json;
using System.Text;
using System.Security.Cryptography;
namespace MareSynchronos.API.Data;
[MessagePackObject(keyAsPropertyName: true)]
public class FileReplacementData
{
public FileReplacementData()
{
DataHash = new(() =>
{
var json = JsonSerializer.Serialize(this);
#pragma warning disable SYSLIB0021 // Type or member is obsolete
using SHA256CryptoServiceProvider cryptoProvider = new();
#pragma warning restore SYSLIB0021 // Type or member is obsolete
return BitConverter.ToString(cryptoProvider.ComputeHash(Encoding.UTF8.GetBytes(json))).Replace("-", "", StringComparison.Ordinal);
});
}
[JsonIgnore]
public Lazy<string> DataHash { get; }
public string[] GamePaths { get; set; } = Array.Empty<string>();
public string Hash { get; set; } = string.Empty;
public string FileSwapPath { get; set; } = string.Empty;
}

View File

@@ -0,0 +1,10 @@
using MessagePack;
namespace MareSynchronos.API.Data;
[MessagePackObject(keyAsPropertyName: true)]
public record GroupData(string GID, string? Alias = null)
{
[IgnoreMember]
public string AliasOrGID => string.IsNullOrWhiteSpace(Alias) ? GID : Alias;
}

View File

@@ -0,0 +1,14 @@
using MessagePack;
namespace MareSynchronos.API.Data;
[MessagePackObject(keyAsPropertyName: true)]
public record SignedChatMessage(ChatMessage Message, UserData Sender) : ChatMessage(Message)
{
// Sender and timestamp are set by the server
public UserData Sender { get; set; } = Sender;
public long Timestamp { get; set; } = 0;
// Signature is generated by the server as SHA256(Sender.UID | Timestamp | Destination | Message)
// Where Destination is either the receiver's UID, or the group GID
public string Signature { get; set; } = string.Empty;
}

View File

@@ -0,0 +1,10 @@
using MessagePack;
namespace MareSynchronos.API.Data;
[MessagePackObject(keyAsPropertyName: true)]
public record UserData(string UID, string? Alias = null)
{
[IgnoreMember]
public string AliasOrUID => string.IsNullOrWhiteSpace(Alias) ? UID : Alias;
}

View File

@@ -0,0 +1,12 @@
using MessagePack;
namespace MareSynchronos.API.Dto.Account;
[MessagePackObject(keyAsPropertyName: true)]
public record RegisterReplyDto
{
public bool Success { get; set; } = false;
public string ErrorMessage { get; set; } = string.Empty;
public string UID { get; set; } = string.Empty;
public string SecretKey { get; set; } = string.Empty;
}

View File

@@ -0,0 +1,11 @@
using MessagePack;
namespace MareSynchronos.API.Dto.Account;
[MessagePackObject(keyAsPropertyName: true)]
public record RegisterReplyV2Dto
{
public bool Success { get; set; } = false;
public string ErrorMessage { get; set; } = string.Empty;
public string UID { get; set; } = string.Empty;
}

View File

@@ -0,0 +1,11 @@
using MareSynchronos.API.Data;
using MessagePack;
namespace MareSynchronos.API.Dto;
[MessagePackObject(keyAsPropertyName: true)]
public record AuthReplyDto
{
public string Token { get; set; } = string.Empty;
public string? WellKnown { get; set; }
}

View File

@@ -0,0 +1,9 @@
namespace MareSynchronos.API.Dto.CharaData;
public enum AccessTypeDto
{
Individuals,
ClosePairs,
AllPairs,
Public
}

View File

@@ -0,0 +1,14 @@
using MareSynchronos.API.Data;
using MessagePack;
namespace MareSynchronos.API.Dto.CharaData;
[MessagePackObject(keyAsPropertyName: true)]
public record CharaDataDownloadDto(string Id, UserData Uploader) : CharaDataDto(Id, Uploader)
{
public string GlamourerData { get; init; } = string.Empty;
public string CustomizeData { get; init; } = string.Empty;
public string ManipulationData { get; set; } = string.Empty;
public List<GamePathEntry> FileGamePaths { get; init; } = [];
public List<GamePathEntry> FileSwaps { get; init; } = [];
}

View File

@@ -0,0 +1,9 @@
using MareSynchronos.API.Data;
namespace MareSynchronos.API.Dto.CharaData;
public record CharaDataDto(string Id, UserData Uploader)
{
public string Description { get; init; } = string.Empty;
public DateTime UpdatedDate { get; init; }
}

View File

@@ -0,0 +1,88 @@
using MareSynchronos.API.Data;
using MessagePack;
namespace MareSynchronos.API.Dto.CharaData;
[MessagePackObject(keyAsPropertyName: true)]
public record CharaDataFullDto(string Id, UserData Uploader) : CharaDataDto(Id, Uploader)
{
public DateTime CreatedDate { get; init; }
public DateTime ExpiryDate { get; set; }
public string GlamourerData { get; set; } = string.Empty;
public string CustomizeData { get; set; } = string.Empty;
public string ManipulationData { get; set; } = string.Empty;
public int DownloadCount { get; set; } = 0;
public List<UserData> AllowedUsers { get; set; } = [];
public List<GroupData> AllowedGroups { get; set; } = [];
public List<GamePathEntry> FileGamePaths { get; set; } = [];
public List<GamePathEntry> FileSwaps { get; set; } = [];
public List<GamePathEntry> OriginalFiles { get; set; } = [];
public AccessTypeDto AccessType { get; set; }
public ShareTypeDto ShareType { get; set; }
public List<PoseEntry> PoseData { get; set; } = [];
}
[MessagePackObject(keyAsPropertyName: true)]
public record GamePathEntry(string HashOrFileSwap, string GamePath);
[MessagePackObject(keyAsPropertyName: true)]
public record PoseEntry(long? Id)
{
public string? Description { get; set; } = string.Empty;
public string? PoseData { get; set; } = string.Empty;
public WorldData? WorldData { get; set; }
}
[MessagePackObject]
public record struct WorldData
{
[Key(0)] public LocationInfo LocationInfo { get; set; }
[Key(1)] public float PositionX { get; set; }
[Key(2)] public float PositionY { get; set; }
[Key(3)] public float PositionZ { get; set; }
[Key(4)] public float RotationX { get; set; }
[Key(5)] public float RotationY { get; set; }
[Key(6)] public float RotationZ { get; set; }
[Key(7)] public float RotationW { get; set; }
[Key(8)] public float ScaleX { get; set; }
[Key(9)] public float ScaleY { get; set; }
[Key(10)] public float ScaleZ { get; set; }
}
[MessagePackObject]
public record struct LocationInfo
{
[Key(0)] public uint ServerId { get; set; }
[Key(1)] public uint MapId { get; set; }
[Key(2)] public uint TerritoryId { get; set; }
[Key(3)] public uint DivisionId { get; set; }
[Key(4)] public uint WardId { get; set; }
[Key(5)] public uint HouseId { get; set; }
[Key(6)] public uint RoomId { get; set; }
}
[MessagePackObject]
public record struct PoseData
{
[Key(0)] public bool IsDelta { get; set; }
[Key(1)] public Dictionary<string, BoneData> Bones { get; set; }
[Key(2)] public Dictionary<string, BoneData> MainHand { get; set; }
[Key(3)] public Dictionary<string, BoneData> OffHand { get; set; }
[Key(4)] public BoneData ModelDifference { get; set; }
}
[MessagePackObject]
public record struct BoneData
{
[Key(0)] public bool Exists { get; set; }
[Key(1)] public float PositionX { get; set; }
[Key(2)] public float PositionY { get; set; }
[Key(3)] public float PositionZ { get; set; }
[Key(4)] public float RotationX { get; set; }
[Key(5)] public float RotationY { get; set; }
[Key(6)] public float RotationZ { get; set; }
[Key(7)] public float RotationW { get; set; }
[Key(8)] public float ScaleX { get; set; }
[Key(9)] public float ScaleY { get; set; }
[Key(10)] public float ScaleZ { get; set; }
}

View File

@@ -0,0 +1,11 @@
using MareSynchronos.API.Data;
using MessagePack;
namespace MareSynchronos.API.Dto.CharaData;
[MessagePackObject(keyAsPropertyName: true)]
public record CharaDataMetaInfoDto(string Id, UserData Uploader) : CharaDataDto(Id, Uploader)
{
public bool CanBeDownloaded { get; init; }
public List<PoseEntry> PoseData { get; set; } = [];
}

View File

@@ -0,0 +1,20 @@
using MessagePack;
namespace MareSynchronos.API.Dto.CharaData;
[MessagePackObject(keyAsPropertyName: true)]
public record CharaDataUpdateDto(string Id)
{
public string? Description { get; set; }
public DateTime? ExpiryDate { get; set; }
public string? GlamourerData { get; set; }
public string? CustomizeData { get; set; }
public string? ManipulationData { get; set; }
public List<string>? AllowedUsers { get; set; }
public List<string>? AllowedGroups { get; set; }
public List<GamePathEntry>? FileGamePaths { get; set; }
public List<GamePathEntry>? FileSwaps { get; set; }
public AccessTypeDto? AccessType { get; set; }
public ShareTypeDto? ShareType { get; set; }
public List<PoseEntry>? Poses { get; set; }
}

View File

@@ -0,0 +1,7 @@
namespace MareSynchronos.API.Dto.CharaData;
public enum ShareTypeDto
{
Private,
Shared
}

View File

@@ -0,0 +1,13 @@
using MareSynchronos.API.Data;
using MareSynchronos.API.Dto.Group;
using MareSynchronos.API.Dto.User;
using MessagePack;
namespace MareSynchronos.API.Dto.Chat;
[MessagePackObject(keyAsPropertyName: true)]
public record GroupChatMsgDto(GroupDto Group, SignedChatMessage Message)
{
public GroupDto Group = Group;
public SignedChatMessage Message = Message;
}

View File

@@ -0,0 +1,11 @@
using MareSynchronos.API.Data;
using MareSynchronos.API.Dto.User;
using MessagePack;
namespace MareSynchronos.API.Dto.Chat;
[MessagePackObject(keyAsPropertyName: true)]
public record UserChatMsgDto(SignedChatMessage Message)
{
public SignedChatMessage Message = Message;
}

View File

@@ -0,0 +1,25 @@
using MareSynchronos.API.Data;
using MessagePack;
namespace MareSynchronos.API.Dto;
[MessagePackObject(keyAsPropertyName: true)]
public record ConnectionDto(UserData User)
{
public Version CurrentClientVersion { get; set; } = new(0, 0, 0);
public int ServerVersion { get; set; }
public bool IsAdmin { get; set; }
public bool IsModerator { get; set; }
public ServerInfo ServerInfo { get; set; } = new();
}
[MessagePackObject(keyAsPropertyName: true)]
public record ServerInfo
{
public string ShardName { get; set; } = string.Empty;
public int MaxGroupUserCount { get; set; }
public int MaxGroupsCreatedByUser { get; set; }
public int MaxGroupsJoinedByUser { get; set; }
public Uri FileServerAddress { get; set; } = new Uri("http://nonemptyuri");
public int MaxCharaData { get; set; }
}

View File

@@ -0,0 +1,14 @@
using MessagePack;
namespace MareSynchronos.API.Dto.Files;
[MessagePackObject(keyAsPropertyName: true)]
public record DownloadFileDto : ITransferFileDto
{
public bool FileExists { get; set; } = true;
public string Hash { get; set; } = string.Empty;
public string Url { get; set; } = string.Empty;
public long Size { get; set; } = 0;
public bool IsForbidden { get; set; } = false;
public string ForbiddenBy { get; set; } = string.Empty;
}

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MareSynchronos.API.Dto.Files;
public class FilesSendDto
{
public List<string> FileHashes { get; set; } = new();
public List<string> UIDs { get; set; } = new();
}

View File

@@ -0,0 +1,8 @@
namespace MareSynchronos.API.Dto.Files;
public interface ITransferFileDto
{
string Hash { get; set; }
bool IsForbidden { get; set; }
string ForbiddenBy { get; set; }
}

View File

@@ -0,0 +1,11 @@
using MessagePack;
namespace MareSynchronos.API.Dto.Files;
[MessagePackObject(keyAsPropertyName: true)]
public record UploadFileDto : ITransferFileDto
{
public string Hash { get; set; } = string.Empty;
public bool IsForbidden { get; set; } = false;
public string ForbiddenBy { get; set; } = string.Empty;
}

View File

@@ -0,0 +1,19 @@
using MareSynchronos.API.Data;
using MessagePack;
namespace MareSynchronos.API.Dto.Group;
[MessagePackObject(keyAsPropertyName: true)]
public record BannedGroupUserDto : GroupPairDto
{
public BannedGroupUserDto(GroupData group, UserData user, string reason, DateTime bannedOn, string bannedBy) : base(group, user)
{
Reason = reason;
BannedOn = bannedOn;
BannedBy = bannedBy;
}
public string Reason { get; set; }
public DateTime BannedOn { get; set; }
public string BannedBy { get; set; }
}

View File

@@ -0,0 +1,13 @@
using MareSynchronos.API.Data;
using MessagePack;
namespace MareSynchronos.API.Dto.Group;
[MessagePackObject(keyAsPropertyName: true)]
public record GroupDto(GroupData Group)
{
public GroupData Group { get; set; } = Group;
public string GID => Group.GID;
public string? GroupAlias => Group.Alias;
public string GroupAliasOrGID => Group.AliasOrGID;
}

Some files were not shown because too many files have changed in this diff Show More