Commit b0854a58 authored by Maki's avatar Maki 🌺
Browse files

Initial commit, still unfinished

parents
node_modules
dist
\ No newline at end of file
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"domain-server": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss",
"skipTests": true
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/domain-server",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"aot": true,
"assets": ["src/favicon.ico", "src/assets"],
"styles": ["src/styles.scss"],
"stylePreprocessorOptions": {
"includePaths": ["node_modules/"]
},
"scripts": []
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb",
"maximumError": "10kb"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "domain-server:build"
},
"configurations": {
"production": {
"browserTarget": "domain-server:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "domain-server:build"
}
}
}
}
},
"defaultProject": "domain-server"
}
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries
# You can see what browsers were selected by your queries by running:
# npx browserslist
> 0.5%
last 2 versions
Firefox ESR
not dead
not IE 9-11 # For IE 9-11 support, remove 'not'.
\ No newline at end of file
import { Injectable, NgModule } from "@angular/core";
import {
ActivatedRouteSnapshot,
CanActivate,
Router,
RouterModule,
RouterStateSnapshot,
Routes,
} from "@angular/router";
import { map, take } from "rxjs/operators";
import { NetworkingComponent } from "./networking/networking.component";
import { NodesComponent } from "./nodes/nodes.component";
import { OverviewComponent } from "./overview/overview.component";
import { PermissionsComponent } from "./permissions/permissions.component";
import { SettingsService } from "./settings.service";
import { WizardComponent } from "./wizard/wizard.component";
@Injectable({ providedIn: "root" })
class WizardGuard implements CanActivate {
constructor(
private readonly router: Router,
private readonly settingsService: SettingsService,
) {}
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
return this.settingsService.settings$.pipe(
take(1),
map(settings => !settings.wizard.completed_once),
);
}
}
const routes: Routes = [
{
path: "",
pathMatch: "full",
redirectTo: "overview",
},
{
path: "wizard",
component: WizardComponent,
canActivate: [WizardGuard],
},
// general
{ path: "overview", component: OverviewComponent },
// settings
{ path: "permissions", component: PermissionsComponent },
{ path: "networking", component: NetworkingComponent },
// advanced
{ path: "nodes", component: NodesComponent },
{
path: "**",
redirectTo: "overview",
},
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule],
})
export class AppRoutingModule {}
<div class="loading" *ngIf="loading">
<h1>Loading...</h1>
<br />
<mdc-linear-progress></mdc-linear-progress>
</div>
<div class="app" *ngIf="!loading">
<app-sidebar *ngIf="wizard.completed_once"></app-sidebar>
<div class="content">
<router-outlet></router-outlet>
</div>
</div>
.app {
width: 100%;
height: 100%;
display: flex;
flex-direction: row;
.content {
flex-grow: 1;
height: 100%;
overflow-y: auto;
}
}
.loading {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
* {
margin: 0;
}
.mdc-linear-progress {
width: 300px;
}
}
import { Component, OnInit } from "@angular/core";
import { Router } from "@angular/router";
import { Wizard } from "./models/settings.model";
import { SettingsService } from "./settings.service";
@Component({
selector: "app-root",
templateUrl: "app.component.html",
styleUrls: ["app.component.scss"],
})
export class AppComponent implements OnInit {
loading = true;
wizard: Wizard;
constructor(
private readonly settingsService: SettingsService,
private readonly router: Router,
) {}
ngOnInit() {
// no need to unsubscribe here
this.settingsService.settings$.subscribe(settings => {
this.loading = settings == null;
if (this.loading) return;
this.wizard = settings.wizard;
if (this.wizard.completed_once == false)
this.router.navigate(["wizard"]);
});
}
}
import { HttpClientModule } from "@angular/common/http";
import { NgModule } from "@angular/core";
import { ReactiveFormsModule, FormsModule } from "@angular/forms";
import { BrowserModule } from "@angular/platform-browser";
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import { AppRoutingModule } from "./app-routing.module";
import { AppComponent } from "./app.component";
import { MaterialModule } from "./material.module";
import { OverviewComponent } from "./overview/overview.component";
import { SidebarComponent } from "./sidebar/sidebar.component";
import { WizardComponent } from "./wizard/wizard.component";
import { NodesComponent } from "./nodes/nodes.component";
import { KeyValueStartsWithPipe } from "./pipes/key-value-starts-with.pipe";
import { NetworkingComponent } from "./networking/networking.component";
import { PermissionsComponent } from "./permissions/permissions.component";
import { PrettifyCamelCasePipe } from "./pipes/prettify-camel-case.pipe";
@NgModule({
declarations: [
AppComponent,
OverviewComponent,
SidebarComponent,
WizardComponent,
NodesComponent,
KeyValueStartsWithPipe,
NetworkingComponent,
PermissionsComponent,
PrettifyCamelCasePipe,
],
imports: [
BrowserModule,
AppRoutingModule,
BrowserAnimationsModule,
MaterialModule,
HttpClientModule,
ReactiveFormsModule,
],
providers: [],
bootstrap: [AppComponent],
})
export class AppModule {}
import {
MdcButtonModule,
MdcCardModule,
MdcCheckboxModule,
MdcChipsModule,
MDCDataTableModule,
MdcDrawerModule,
MdcFormFieldModule,
MdcIconButtonModule,
MdcIconModule,
MdcLinearProgressModule,
MdcListModule,
MdcMenuModule,
MdcMenuSurfaceModule,
MdcSelectModule,
MdcSnackbarModule,
MdcSwitchModule,
MdcTabBarModule,
MdcTextFieldModule,
} from "@angular-mdc/web";
import { NgModule } from "@angular/core";
const modules = [
MdcButtonModule,
MdcCardModule,
MdcCheckboxModule,
MdcChipsModule,
MDCDataTableModule,
MdcDrawerModule,
MdcFormFieldModule,
MdcIconButtonModule,
MdcIconModule,
MdcLinearProgressModule,
MdcListModule,
MdcMenuModule,
MdcMenuSurfaceModule,
MdcSelectModule,
MdcSnackbarModule,
MdcSwitchModule,
MdcTabBarModule,
MdcTextFieldModule,
];
@NgModule({ exports: modules })
export class MaterialModule {}
export interface Assignments {
fulfilled: {
[id: string]: {
type: string;
};
};
queued: {
[id: string]: {
type: string;
};
};
}
export interface Node {
local: {
ip: string;
port: number;
};
pool: string;
public: {
ip: string;
port: number;
};
type: string;
uptime: string;
username: string;
uuid: string;
version: string;
}
export type Nodes = Node[];
export interface AssetServer {
assets_filesize_limit: number;
assets_path: string;
enabled: boolean;
}
export interface AudioBuffer {
dynamic_jitter_buffer: boolean;
max_frames_over_desired: string;
repetition_with_fade: string;
static_desired_jitter_buffer_frames: string;
use_stdev_for_desired_calc: string;
window_seconds_for_desired_calc_on_too_many_starves: string;
window_seconds_for_desired_reduction: string;
window_starve_threshold: string;
}
export interface AudioEnv {
codec_preference_order: string;
enable_filter: boolean;
noise_muting_threshold: string;
}
export interface AudioThreading {
auto_threads: boolean;
num_threads: string;
throttle_backoff: number;
throttle_start: number;
}
export interface BackupRule {
Name: string;
backupInterval: number;
maxBackupVersions: number;
}
export interface AutomaticContentArchives {
backup_rules: BackupRule[];
}
export interface AvatarMixer {
auto_threads: boolean;
connection_rate: string;
max_node_send_bandwidth: number;
num_threads: string;
priority_fraction: string;
}
export interface Avatars {
avatar_whitelist: string;
max_avatar_height: number;
min_avatar_height: number;
replacement_avatar: string;
}
export interface Broadcasting {
downstream_servers: string;
upstream_servers: string;
users: string;
}
export interface Descriptors {
description: string;
hosts: string;
maturity: string;
tags: string;
}
export interface EntityScriptServer {
entity_pps_per_script: number;
max_total_entity_pps: number;
}
export interface EntityServerSettings {
NoBackup: boolean;
NoPersist: boolean;
backupDirectoryPath: string;
clockSkew: string;
debugReceiving: boolean;
debugSending: boolean;
debugTimestampNow: boolean;
dynamicDomainVerificationTimeMax: string;
dynamicDomainVerificationTimeMin: string;
entityScriptSourceWhitelist: string;
maxTmpLifetime: string;
persistFileDownload: boolean;
persistFilePath: string;
persistInterval: string;
statusHost: string;
statusPort: string;
verboseDebug: boolean;
wantEditLogging: boolean;
wantTerseEditLogging: boolean;
}
export enum AutomaticNetworking {
full = "full",
ip = "ip",
disabled = "disabled",
}
export interface Metaverse {
access_token: string;
automatic_networking: AutomaticNetworking;
enable_packet_verification: boolean;
id: string;
local_port: string;
}
export interface Oauth {
"admin-roles": string;
"admin-users": string;
cert: string;
"cert-fingerprint": string;
"client-id": string;
enable: boolean;
hostname: string;
key: string;
provider: string;
}
export interface BasePermission {
id_can_adjust_locks: boolean;
id_can_connect: boolean;
id_can_connect_past_max_capacity: boolean;
id_can_get_and_set_private_user_data: boolean;
id_can_kick: boolean;
id_can_replace_content: boolean;
id_can_rez: boolean;
id_can_rez_certified: boolean;
id_can_rez_tmp: boolean;
id_can_rez_tmp_certified: boolean;
id_can_write_to_asset_server: boolean; // to be deleted
}
export const NoPermission: BasePermission = {
id_can_adjust_locks: false,
id_can_connect: false,
id_can_connect_past_max_capacity: false,
id_can_get_and_set_private_user_data: false,
id_can_kick: false,
id_can_replace_content: false,
id_can_rez: false,
id_can_rez_certified: false,
id_can_rez_tmp: false,
id_can_rez_tmp_certified: false,
id_can_write_to_asset_server: false, // to be deleted
};
export const FullPermission: BasePermission = {
id_can_adjust_locks: true,
id_can_connect: true,
id_can_connect_past_max_capacity: true,
id_can_get_and_set_private_user_data: true,
id_can_kick: true,
id_can_replace_content: true,
id_can_rez: true,
id_can_rez_certified: true,
id_can_rez_tmp: true,
id_can_rez_tmp_certified: true,
id_can_write_to_asset_server: true, // to be deleted
};
export const ConnectPermission: BasePermission = {
id_can_adjust_locks: false,
id_can_connect: true,
id_can_connect_past_max_capacity: false,
id_can_get_and_set_private_user_data: false,
id_can_kick: false,
id_can_replace_content: false,
id_can_rez: false,
id_can_rez_certified: false,
id_can_rez_tmp: false,
id_can_rez_tmp_certified: false,
id_can_write_to_asset_server: false, // to be deleted
};
export const CreatePermission: BasePermission = {
id_can_adjust_locks: true,
id_can_connect: true,
id_can_connect_past_max_capacity: false,
id_can_get_and_set_private_user_data: false,
id_can_kick: false,
id_can_replace_content: true,
id_can_rez: true,
id_can_rez_certified: true,
id_can_rez_tmp: true,
id_can_rez_tmp_certified: true,
id_can_write_to_asset_server: true, // to be deleted
};
export interface UserPermission extends BasePermission {
permissions_id: string; // username
}
export interface StandardPermission extends BasePermission {
permissions_id: "anonymous" | "friends" | "localhost" | "logged-in";
}
export interface Security {
ac_subnet_whitelist: string;
group_forbiddens: string;
group_permissions: string;
http_username: string;
ip_permissions: string;
mac_permissions: string;
machine_fingerprint_permissions: string;
maximum_user_capacity: string;
maximum_user_capacity_redirect_location: string;
multi_kick_logged_in: boolean;