60 Commits
v1b18 ... v1

Author SHA1 Message Date
Masu Baumgartner
39a1bdeb5d Merge pull request #373 from Moonlight-Panel/v1_FixWingsContentLenght
Fix Content-Lenght for wings
2024-04-01 12:46:30 +02:00
Masu Baumgartner
18f107e485 A possible hotfix 2024-04-01 10:45:01 +00:00
Masu Baumgartner
b56b94041f Update README.md 2024-03-04 11:02:32 +01:00
Marcel Baumgartner
1a3b339983 Merge pull request #369 from NaysKutzu/patch-1
Update README.md
2024-02-09 14:22:39 +01:00
NaysKutzu
106af71c17 Update README.md
Update the logo because it won't be displayed due to your captcha on the page
2024-02-09 14:20:46 +01:00
Marcel Baumgartner
cb1da9f5cd Removed old license 2024-02-06 21:38:33 +01:00
Marcel Baumgartner
743b0b1c1b Updated license 2024-02-06 21:37:32 +01:00
Marcel Baumgartner
8fe695f0cf Merge pull request #367 from gOOvER/issuetemplates
added issue templates
2024-02-03 09:09:09 +01:00
Marcel Baumgartner
344ea046f2 Merge pull request #366 from gOOvER/dependabot
added dependabot.yml to autocheck action updates
2024-02-03 09:08:57 +01:00
Marcel Baumgartner
73a014500d Merge pull request #365 from gOOvER/updateworkflow
update workflow files to latest releases
2024-02-03 09:08:38 +01:00
gOOvER
d3f8ba5434 added issue templates 2024-02-03 08:44:05 +01:00
gOOvER
c068679f9b added dependabot.yml to autocheck action updates 2024-02-03 08:27:36 +01:00
gOOvER
9dfba1e6c4 update workflow files to latest releases 2024-02-03 08:24:07 +01:00
Marcel Baumgartner
27f9ca551c Create FUNDING.yml 2024-01-31 10:35:55 +01:00
Marcel Baumgartner
4d69e8bacb Merge pull request #361 from Dannyx1604/patch-1
Update README.md (grammar check)
2024-01-25 21:43:00 +01:00
Dannyx
ed2d33c69b Update README.md (grammar check) 2024-01-25 21:39:48 +01:00
Marcel Baumgartner
d880189f2b Hotfix for WingsServerConverter 2024-01-12 19:45:18 +01:00
Marcel Baumgartner
9221a66597 Merge pull request #324 from Moonlight-Panel/FixLetsEncrypt
Added additional logs for lets encrypt certificates
2023-10-13 23:02:45 +02:00
Marcel Baumgartner
e1c4f8a2a9 Added additional logs for lets encrypt certificates 2023-10-13 23:02:23 +02:00
Marcel Baumgartner
84d39c1c75 Merge pull request #318 from Moonlight-Panel/AddBotCheck
Implemented a basic bot check
2023-09-18 18:59:02 +02:00
Marcel Baumgartner
9abd9d86b2 Implemented a basic bot check 2023-09-18 18:58:32 +02:00
Marcel Baumgartner
73a07761f8 Merge pull request #317 from Moonlight-Panel/AddManualMalwareScan
Added manual malware scan
2023-09-12 10:50:29 +02:00
Marcel Baumgartner
ebe2d9d7ef Added manual malware scan 2023-09-12 08:49:12 +00:00
Marcel Baumgartner
48b12fde90 Merge pull request #316 from Moonlight-Panel/FixIpBinding
Fixed ip binding
2023-09-10 03:13:31 +02:00
Marcel Baumgartner
8ac4fae9c1 Fixed ip binding 2023-09-10 03:12:54 +02:00
Marcel Baumgartner
d224f1e1bb Merge pull request #315 from Moonlight-Panel/FixStartup
Fixed startup for new instances
2023-09-10 03:00:46 +02:00
Marcel Baumgartner
13131e6fca Fixed startup for new instances 2023-09-10 03:00:09 +02:00
Marcel Baumgartner
26fdfe112b Merge pull request #313 from Moonlight-Panel/FixProfileMenu
Fixed profile menu
2023-09-09 09:48:59 +02:00
Marcel Baumgartner
ecf0d372e5 Fixed profile menu 2023-09-09 09:47:44 +02:00
Marcel Baumgartner
e281cfadbd Fixed typo 2023-09-07 20:45:00 +02:00
Marcel Baumgartner
ae2228e08a Added release build. Modified canary build events 2023-09-07 20:09:04 +02:00
Marcel Baumgartner
3f5a7504fa Merge branch 'main' of https://github.com/Moonlight-Panel/Moonlight 2023-09-07 18:14:26 +02:00
Marcel Baumgartner
f8af48aeab Added canary build action. Not tested yet 2023-09-07 18:14:22 +02:00
Marcel Baumgartner
9b9656892d Update README.md 2023-09-06 20:18:16 +02:00
Marcel Baumgartner
db2c6ec30d Merge pull request #311 from Moonlight-Panel/FixAuthDesign
Fixed login and register oauth2 view
2023-09-06 20:06:08 +02:00
Marcel Baumgartner
e46122b030 Fixed login and register oauth2 view 2023-09-06 20:05:38 +02:00
Marcel Baumgartner
1a9836a884 Merge pull request #309 from Moritz-Deiaco/main
added a 'moonlight worth' scrollbar
2023-09-06 19:58:34 +02:00
Marcel Baumgartner
ef930400c8 Fixed issues with other scrollbars 2023-09-06 19:58:12 +02:00
Moritz
450a954b9d Merge branch 'Moonlight-Panel:main' into main 2023-09-06 19:51:07 +02:00
Moritz
31ba5f04cc somechanges for uwu 2023-09-06 19:48:38 +02:00
Moritz
6ca024d6cb made the corners squared like masuwu wanted 2023-09-06 19:33:39 +02:00
Marcel Baumgartner
cef5cb11cb Merge pull request #310 from Moonlight-Panel/NewStartup
Switched to new startup
2023-09-06 19:26:31 +02:00
Marcel Baumgartner
e91a9b2239 Switched to new startup 2023-09-06 19:25:01 +02:00
Moritz
d7ca9d1fe6 added a 'moonlight worth' scrollbar 2023-09-06 19:14:09 +02:00
Marcel Baumgartner
564745b4a2 Merge pull request #308 from Moonlight-Panel/AddAutoLetsEncrypt
Added auto lets encrypt certificate issuing
2023-09-06 17:45:00 +02:00
Marcel Baumgartner
74361b7a4a Small changes 2023-09-06 17:40:56 +02:00
Marcel Baumgartner
7a992d71fb Merge pull request #305 from Moonlight-Panel/FixSharedDomain
Fixed shared domain loading
2023-09-06 17:19:51 +02:00
Marcel Baumgartner
b8d30f0380 Fixed shared domain loading 2023-09-06 17:19:32 +02:00
Marcel Baumgartner
07d7df8188 Merge pull request #304 from Moonlight-Panel/UpdateBadScriptFilter
Updated bad script filters
2023-09-06 17:08:22 +02:00
Marcel Baumgartner
2ddb8723af Updated bad script filters 2023-09-06 17:07:48 +02:00
Marcel Baumgartner
caf990dd4e Merge pull request #302 from Moonlight-Panel/FixHostRename
Fixed host file system rename
2023-09-06 15:43:53 +02:00
Marcel Baumgartner
d0401a1709 Fixed host file system rename 2023-09-06 13:42:48 +00:00
Marcel Baumgartner
67974123db Added some config files for codespaces. Modified for codespaces 2023-09-06 13:10:57 +00:00
Marcel Baumgartner
05817a8866 Added devcontainer for testing 2023-09-06 14:05:38 +02:00
Marcel Baumgartner
707776f1ed Merge pull request #301 from Moonlight-Panel/NewBadScriptScan
Added new bad script scan in order to find reduce scan time
2023-09-05 01:24:20 +02:00
Marcel Baumgartner
4ba7634b94 Added new bad script scan in order to find reduce scan time 2023-09-05 01:23:31 +02:00
Marcel Baumgartner
732abe53e0 Implemented a basic https certificate issuing using lets encrypt 2023-09-04 21:58:26 +02:00
Marcel Baumgartner
37b1288ae6 Update README.md 2023-09-04 21:24:04 +02:00
Marcel Baumgartner
dda302ebf1 Merge pull request #300 from Moonlight-Panel/SmallFixes
Fixed some small bugs
2023-08-31 01:29:12 +02:00
Marcel Baumgartner
f1aace98c3 Fixed some small bugs 2023-08-31 01:28:56 +02:00
52 changed files with 1393 additions and 751 deletions

View File

@@ -0,0 +1,20 @@
{
"name": "C# (.NET)",
"image": "mcr.microsoft.com/devcontainers/dotnet:0-6.0",
"customizations": {
"vscode": {
"settings": {},
"extensions": [
"streetsidesoftware.code-spell-checker"
]
}
},
"portsAttributes": {
"5118": {
"label": "Moonlight",
"onAutoForward": "notify"
}
}
}

2
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1,2 @@
# These are supported funding model platforms
ko_fi: masuowo

96
.github/ISSUE_TEMPLATE/bug-report.yml vendored Normal file
View File

@@ -0,0 +1,96 @@
name: Bug Report
description: Something isn't working quite right in the software.
labels: [not confirmed]
body:
- type: markdown
attributes:
value: |
Bug reports should only be used for reporting issues with how the software works. For assistance installing this software, as well as debugging issues with dependencies, please use our [Discord server](https://discord.gg/TJaspT7A8p).
- type: textarea
attributes:
label: Current Behavior
description: Please provide a clear & concise description of the issue.
validations:
required: true
- type: textarea
attributes:
label: Expected Behavior
description: Please describe what you expected to happen.
validations:
required: true
- type: textarea
attributes:
label: Steps to Reproduce
description: Please be as detailed as possible when providing steps to reproduce, failure to provide steps will result in this issue being closed.
validations:
required: true
- type: input
id: panel-version
attributes:
label: Panel Version
description: Version number of your Panel (latest is not a version)
placeholder: 1.4.0
validations:
required: true
- type: input
id: daemon-version
attributes:
label: Daemon Version
description: Version number of your Daemon (latest is not a version)
placeholder: 1.4.2
validations:
required: true
- type: input
id: wings-version
attributes:
label: Wings Version
description: Version number of your Wings (latest is not a version)
placeholder: 1.4.2
validations:
required: true
- type: input
id: image-details
attributes:
label: Games and/or Images Affected
description: Please include the specific game(s) or Image(s) you are running into this bug with.
placeholder: Minecraft (Paper), Minecraft (Forge)
- type: input
id: docker-image
attributes:
label: Docker Image
description: The specific Docker image you are using for the game(s) above.
placeholder: ghcr.io/xxx/yolks:java_17
- type: textarea
id: panel-logs
attributes:
label: Error Logs
description: |
Run the following command to collect logs on your system.
Panel: `docker logs moonlight`
Wings: `sudo wings diagnostics`
placeholder: logs here
render: bash
validations:
required: false
- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Please [search here](https://github.com/Moonlight-Panel/Moonlight/issues) to see if an issue already exists for your problem.
options:
- label: I have searched the existing issues before opening this issue.
required: true
- label: I have provided all relevant details, including the specific game and Docker images I am using if this issue is related to running a server.
required: true
- label: I have checked in the Discord server and believe this is a bug with the software, and not a configuration issue with my specific system.
required: true

8
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@@ -0,0 +1,8 @@
blank_issues_enabled: true
contact_links:
- name: Installation Help
url: https://discord.gg/TJaspT7A8p
about: Please visit our Discord for help with your installation.
- name: General Question
url: https://discord.gg/TJaspT7A8p
about: Please visit our Discord for general questions about Moonlight Panel.

View File

@@ -0,0 +1,32 @@
name: Feature Request
description: Suggest a new feature or improvement for the software.
labels: [feature request]
body:
- type: checkboxes
attributes:
label: Is there an existing feature request for this?
description: Please [search here](https://github.com/Moonlight-Panel/Moonlight/issues?q=is%3Aissue) to see if someone else has already suggested this.
options:
- label: I have searched the existing issues before opening this feature request.
required: true
- type: textarea
attributes:
label: Describe the feature you would like to see.
description: "A clear & concise description of the feature you'd like to have added, and what issues it would solve."
validations:
required: true
- type: textarea
attributes:
label: Describe the solution you'd like.
description: "You must explain how you'd like to see this feature implemented. Technical implementation details are not necessary, rather an idea of how you'd like to see this feature used."
validations:
required: true
- type: textarea
attributes:
label: Additional context to this request.
description: "Add any other context or screenshots about the feature request."
validations:
required: false

12
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,12 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
# Maintain Github workflows
- package-ecosystem: "github-actions"
directory: "/" # Must be set to / although they're located in .github/workflows
schedule:
interval: "daily"

View File

@@ -0,0 +1,27 @@
name: Canary Docker Build
on:
workflow_dispatch:
pull_request:
types:
- closed
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login into docker hub
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PW }}
- name: Build and Push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Moonlight/Dockerfile
push: true
tags: moonlightpanel/moonlight:canary
platforms: linux/amd64,linux/arm64

View File

@@ -0,0 +1,25 @@
name: Release Docker Build
on:
workflow_dispatch:
release:
types: [ published ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login into docker hub
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PW }}
- name: Build and Push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Moonlight/Dockerfile
push: true
tags: moonlightpanel/moonlight:beta
platforms: linux/amd64,linux/arm64

View File

@@ -13,6 +13,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Build Docker image
run: docker build -t moonlightpanel/moonlight:${{ github.sha }} -f Moonlight/Dockerfile .

View File

@@ -0,0 +1,3 @@
<values>
<value name="mac.address" type="string">a6a05ab0b1614c08281b54fc3b3339170b0f57a5e246c20b7393333dfa28f8f1</value>
</values>

View File

@@ -0,0 +1,3 @@
<values>
<value name="StillAlive" type="qword">133564417297189136</value>
</values>

View File

@@ -0,0 +1,3 @@
<values>
<value name="MachineId" type="string">{A6A05AB0-B161-4C08-281B-54FC3B333917}</value>
</values>

35
.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,35 @@
{
"version": "0.2.0",
"configurations": [
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/dotnet/vscode-csharp/blob/main/debugger-launchjson.md.
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/Moonlight/bin/Debug/net6.0/Moonlight.dll",
"args": [],
"cwd": "${workspaceFolder}/Moonlight",
"stopAtEntry": false,
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/Views"
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
}
]
}

41
.vscode/tasks.json vendored Normal file
View File

@@ -0,0 +1,41 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/Moonlight.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/Moonlight.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"--project",
"${workspaceFolder}/Moonlight.sln"
],
"problemMatcher": "$msCompile"
}
]
}

121
LICENSE Normal file
View File

@@ -0,0 +1,121 @@
Creative Commons Legal Code
CC0 1.0 Universal
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
HEREUNDER.
Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator
and subsequent owner(s) (each and all, an "owner") of an original work of
authorship and/or a database (each, a "Work").
Certain owners wish to permanently relinquish those rights to a Work for
the purpose of contributing to a commons of creative, cultural and
scientific works ("Commons") that the public can reliably and without fear
of later claims of infringement build upon, modify, incorporate in other
works, reuse and redistribute as freely as possible in any form whatsoever
and for any purposes, including without limitation commercial purposes.
These owners may contribute to the Commons to promote the ideal of a free
culture and the further production of creative, cultural and scientific
works, or to gain reputation or greater distribution for their Work in
part through the use and efforts of others.
For these and/or other purposes and motivations, and without any
expectation of additional consideration or compensation, the person
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
is an owner of Copyright and Related Rights in the Work, voluntarily
elects to apply CC0 to the Work and publicly distribute the Work under its
terms, with knowledge of his or her Copyright and Related Rights in the
Work and the meaning and intended legal effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights ("Copyright and
Related Rights"). Copyright and Related Rights include, but are not
limited to, the following:
i. the right to reproduce, adapt, distribute, perform, display,
communicate, and translate a Work;
ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or
likeness depicted in a Work;
iv. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(a), below;
v. rights protecting the extraction, dissemination, use and reuse of data
in a Work;
vi. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation
thereof, including any amended or successor version of such
directive); and
vii. other similar, equivalent or corresponding rights throughout the
world based on applicable law or treaty, and any national
implementations thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention
of, applicable law, Affirmer hereby overtly, fully, permanently,
irrevocably and unconditionally waives, abandons, and surrenders all of
Affirmer's Copyright and Related Rights and associated claims and causes
of action, whether now known or unknown (including existing as well as
future claims and causes of action), in the Work (i) in all territories
worldwide, (ii) for the maximum duration provided by applicable law or
treaty (including future time extensions), (iii) in any current or future
medium and for any number of copies, and (iv) for any purpose whatsoever,
including without limitation commercial, advertising or promotional
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
member of the public at large and to the detriment of Affirmer's heirs and
successors, fully intending that such Waiver shall not be subject to
revocation, rescission, cancellation, termination, or any other legal or
equitable action to disrupt the quiet enjoyment of the Work by the public
as contemplated by Affirmer's express Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason
be judged legally invalid or ineffective under applicable law, then the
Waiver shall be preserved to the maximum extent permitted taking into
account Affirmer's express Statement of Purpose. In addition, to the
extent the Waiver is so judged Affirmer hereby grants to each affected
person a royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmer's Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future
time extensions), (iii) in any current or future medium and for any number
of copies, and (iv) for any purpose whatsoever, including without
limitation commercial, advertising or promotional purposes (the
"License"). The License shall be deemed effective as of the date CC0 was
applied by Affirmer to the Work. Should any part of the License for any
reason be judged legally invalid or ineffective under applicable law, such
partial invalidity or ineffectiveness shall not invalidate the remainder
of the License, and in such case Affirmer hereby affirms that he or she
will not (i) exercise any of his or her remaining Copyright and Related
Rights in the Work or (ii) assert any associated claims and causes of
action with respect to the Work, in either case contrary to Affirmer's
express Statement of Purpose.
4. Limitations and Disclaimers.
a. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
b. Affirmer offers the Work as-is and makes no representations or
warranties of any kind concerning the Work, express, implied,
statutory or otherwise, including without limitation warranties of
title, merchantability, fitness for a particular purpose, non
infringement, or the absence of latent or other defects, accuracy, or
the present or absence of errors, whether or not discoverable, all to
the greatest extent permissible under applicable law.
c. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any person's Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the
Work.
d. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to
this CC0 or use of the Work.

View File

@@ -1,128 +0,0 @@
<h3>Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License (modified)</h3>
<p>By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.</p>
<p id="s1"><strong>Section 1 Definitions.</strong></p>
<ol type="a">
<li id="s1a"><strong>Adapted Material</strong> means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.</li>
<li id="s1b"><strong>Adapter's License</strong> means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.</li>
<li id="s1c"><strong>BY-NC-SA Compatible License</strong> means a license listed at <a href="//creativecommons.org/compatiblelicenses"> creativecommons.org/compatiblelicenses</a>, approved by Creative Commons as essentially the equivalent of this Public License.</li>
<li id="s1d"><strong>Copyright and Similar Rights</strong> means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section <a href="#s2b">2(b)(1)-(2)</a> are not Copyright and Similar Rights.</li>
<li id="s1e"><strong>Effective Technological Measures</strong> means those measures that, in the absence of proper authority, may not
be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar
international agreements.</li>
<li id="s1f"><strong>Exceptions and Limitations</strong> means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.</li>
<li id="s1g"><strong>License Elements</strong> means the license attributes listed in the name of a Creative Commons Public License. The License Elements of this Public License are Attribution, NonCommercial, and ShareAlike.</li>
<li id="s1h"><strong>Licensed Material</strong> means the artistic or literary work, database, or other material to which the Licensor applied this Public License.</li>
<li id="s1i"><strong>Licensed Rights</strong> means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.</li>
<li id="s1j"><strong>Licensor</strong> means the individual(s) or entity(ies) granting rights under this Public License.</li>
<li id="s1k"><strong>NonCommercial</strong> means not primarily intended for or directed towards commercial advantage or monetary compensation. This also includes free hosting services or simmular which have no direct permission from the moonlight panel team to use this software. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange.</li>
<li id="s1l"><strong>Share</strong> means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.</li>
<li id="s1m"><strong>Sui Generis Database Rights</strong> means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.</li>
<li id="s1n"><strong>You</strong> means the individual or entity exercising the Licensed Rights under this Public License. <strong>Your</strong> has a corresponding meaning.</li>
</ol>
<p id="s2"><strong>Section 2 Scope.</strong></p>
<ol type="a">
<li id="s2a"><strong>License grant</strong>.
<ol>
<li id="s2a1">Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
<ol type="A">
<li id="s2a1A">reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and</li>
<li id="s2a1B">produce, reproduce, and Share Adapted Material for NonCommercial purposes only.</li>
</ol>
</li><li id="s2a2"><span style="text-decoration: underline;">Exceptions and Limitations</span>. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.</li>
<li id="s2a3"><span style="text-decoration: underline;">Term</span>. The term of this Public License is specified in Section <a href="#s6a">6(a)</a>.</li>
<li id="s2a4"><span style="text-decoration: underline;">Media and formats; technical modifications allowed</span>. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section <a href="#s2a4">2(a)(4)</a> never produces Adapted Material.</li>
<li id="s2a5"><span style="text-decoration: underline;">Downstream recipients</span>.
<div class="para">
<ol type="A">
<li id="s2a5A"><span style="text-decoration: underline;">Offer from the Licensor Licensed Material</span>. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.</li>
<li id="s2a5B"><span style="text-decoration: underline;">Additional offer from the Licensor Adapted Material</span>. Every recipient of Adapted Material from You automatically receives an offer from the Licensor to exercise the Licensed Rights in the Adapted Material under the conditions of the Adapters License You apply.</li>
<li id="s2a5C"><span style="text-decoration: underline;">No downstream restrictions</span>. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.</li>
</ol>
</div>
</li><li id="s2a6"><span style="text-decoration: underline;">No endorsement</span>. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section <a href="#s3a1Ai">3(a)(1)(A)(i)</a>.</li>
</ol>
</li><li id="s2b"><p><strong>Other rights</strong>.</p>
<ol>
<li id="s2b1">Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.</li>
<li id="s2b2">Patent and trademark rights are not licensed under this Public License.</li>
<li id="s2b3">To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial purposes.</li>
</ol>
</li>
</ol>
<p id="s3"><strong>Section 3 License Conditions.</strong></p>
<p>Your exercise of the Licensed Rights is expressly made subject to the following conditions.</p>
<ol type="a">
<li id="s3a"><p><strong>Attribution</strong>.</p>
<ol>
<li id="s3a1"><p>If You Share the Licensed Material (including in modified form), You must:</p>
<ol type="A">
<li id="s3a1A">retain the following if it is supplied by the Licensor with the Licensed Material:
<ol type="i">
<li id="s3a1Ai">identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);</li>
<li id="s3a1Aii">a copyright notice;</li>
<li id="s3a1Aiii">a notice that refers to this Public License; </li>
<li id="s3a1Aiv">a notice that refers to the disclaimer of warranties;</li>
<li id="s3a1Av">a URI or hyperlink to the Licensed Material to the extent reasonably practicable;</li>
</ol>
</li><li id="s3a1B">indicate if You modified the Licensed Material and retain an indication of any previous modifications; and</li>
<li id="s3a1C">indicate the Licensed Material is licensed under this Public License,
and include the text of, or the URI or hyperlink to, this Public
License.</li>
</ol>
</li>
<li id="s3a2">You may satisfy the conditions in Section <a href="#s3a1">3(a)(1)</a> in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.</li>
<li id="s3a3">If requested by the Licensor, You must remove any of the information required by Section <a href="#s3a1A">3(a)(1)(A)</a> to the extent reasonably practicable.</li>
</ol>
</li>
<li id="s3b"><strong>ShareAlike</strong>.
<p>In addition to the conditions in Section <a href="#s3a">3(a)</a>, if You Share Adapted Material You produce, the following conditions also apply.</p>
<ol>
<li id="s3b1">The Adapters License You apply must be a Creative Commons license with the same License Elements, this version or later, or a BY-NC-SA Compatible License.</li>
<li id="s3b2">You must include the text of, or the URI or hyperlink to, the Adapter's License You apply. You may satisfy this condition in any reasonable manner based on the medium, means, and context in which You Share Adapted Material.</li>
<li id="s3b3">You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, Adapted Material that restrict exercise of the rights granted under the Adapter's License You apply.</li>
</ol>
</li>
</ol>
<p id="s4"><strong>Section 4 Sui Generis Database Rights.</strong></p>
<p>Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:</p>
<ol type="a">
<li id="s4a">for the avoidance of doubt, Section <a href="#s2a1">2(a)(1)</a> grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only;</li>
<li id="s4b">if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material, including for purposes of Section <a href="#s3b">3(b)</a>; and</li>
<li id="s4c">You must comply with the conditions in Section <a href="#s3a">3(a)</a> if You Share all or a substantial portion of the contents of the database.</li>
</ol>
For the avoidance of doubt, this Section <a href="#s4">4</a> supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
<p id="s5"><strong>Section 5 Disclaimer of Warranties and Limitation of Liability.</strong></p>
<ol style="font-weight: bold;" type="a">
<li id="s5a"><strong>Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.</strong></li>
<li id="s5b"><strong>To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.</strong></li>
</ol>
<ol start="3" type="a">
<li id="s5c">The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.</li>
</ol>
<p id="s6"><strong>Section 6 Term and Termination.</strong></p>
<ol type="a">
<li id="s6a">This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.</li>
<li id="s6b">
<p>Where Your right to use the Licensed Material has terminated under Section <a href="#s6a">6(a)</a>, it reinstates:</p>
<ol>
<li id="s6b1">automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or</li>
<li id="s6b2">upon express reinstatement by the Licensor.</li>
</ol>
For the avoidance of doubt, this Section <a href="#s6b">6(b)</a> does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.</li>
<li id="s6c">For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.</li>
<li id="s6d">Sections <a href="#s1">1</a>, <a href="#s5">5</a>, <a href="#s6">6</a>, <a href="#s7">7</a>, and <a href="#s8">8</a> survive termination of this Public License.</li>
</ol>
<p id="s7"><strong>Section 7 Other Terms and Conditions.</strong></p>
<ol type="a">
<li id="s7a">The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.</li>
<li id="s7b">Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.</li>
</ol>
<p id="s8"><strong>Section 8 Interpretation.</strong></p>
<ol type="a">
<li id="s8a">For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.</li>
<li id="s8b">To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.</li>
<li id="s8c">No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.</li>
<li id="s8d">Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.</li>
</ol>
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, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN 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

@@ -8,8 +8,7 @@ using Newtonsoft.Json;
public class ConfigV1
{
[JsonProperty("Moonlight")]
public MoonlightData Moonlight { get; set; } = new();
[JsonProperty("Moonlight")] public MoonlightData Moonlight { get; set; } = new();
public class MoonlightData
{
@@ -26,6 +25,8 @@ public class ConfigV1
[Description("Specify the latency threshold which has to be reached in order to trigger the warning message")]
public int LatencyCheckThreshold { get; set; } = 1000;
[JsonProperty("LetsEncrypt")] public LetsEncrypt LetsEncrypt { get; set; } = new();
[JsonProperty("Auth")] public AuthData Auth { get; set; } = new();
[JsonProperty("Database")] public DatabaseData Database { get; set; } = new();
@@ -48,7 +49,8 @@ public class ConfigV1
[JsonProperty("Cleanup")] public CleanupData Cleanup { get; set; } = new();
[JsonProperty("DiscordNotifications")] public DiscordNotificationsData DiscordNotifications { get; set; } = new();
[JsonProperty("DiscordNotifications")]
public DiscordNotificationsData DiscordNotifications { get; set; } = new();
[JsonProperty("Statistics")] public StatisticsData Statistics { get; set; } = new();
@@ -63,6 +65,33 @@ public class ConfigV1
[JsonProperty("Tickets")] public TicketsData Tickets { get; set; } = new();
}
public class LetsEncrypt
{
[JsonProperty("Enable")]
[Description("Enable automatic lets encrypt certificate issuing. This is a beta feature")]
public bool Enable { get; set; } = false;
[JsonProperty("ExpireEmail")]
[Description("Lets encrypt will send you an email upon certificate expiration to this address")]
public string ExpireEmail { get; set; } = "your@email.test";
[JsonProperty("CountryCode")]
[Description("Country code to use for generating the certificate")]
public string CountryCode { get; set; } = "DE";
[JsonProperty("State")]
[Description("State to use for generating the certificate")]
public string State { get; set; } = "Germany";
[JsonProperty("Locality")]
[Description("Locality to use for generating the certificate")]
public string Locality { get; set; } = "Bavaria";
[JsonProperty("Organization")]
[Description("Organization to use for generating the certificate")]
public string Organization { get; set; } = "Moonlight Panel";
}
public class TicketsData
{
[JsonProperty("WelcomeMessage")]
@@ -73,7 +102,8 @@ public class ConfigV1
public class StripeData
{
[JsonProperty("ApiKey")]
[Description("Put here your stripe api key if you add subscriptions. Currently the only billing option is stripe which is enabled by default and cannot be turned off. This feature is still experimental")]
[Description(
"Put here your stripe api key if you add subscriptions. Currently the only billing option is stripe which is enabled by default and cannot be turned off. This feature is still experimental")]
public string ApiKey { get; set; } = "";
}
@@ -86,6 +116,14 @@ public class ConfigV1
[JsonProperty("DenyRegister")]
[Description("Prevent every new user to register")]
public bool DenyRegister { get; set; } = false;
[JsonProperty("CheckForBots")]
[Description("Check for bots when a user has been registered")]
public bool CheckForBots { get; set; } = true;
[JsonProperty("BlockLinuxUsers")]
[Description("Blocks linux users from registering")]
public bool BlockLinuxUsers { get; set; } = false;
}
public class CleanupData
@@ -107,7 +145,8 @@ public class ConfigV1
public long Uptime { get; set; } = 6;
[JsonProperty("Enable")]
[Description("The cleanup system provides a fair way for stopping unused servers and staying stable even with overallocation. A detailed explanation: docs.endelon-hosting.de/erklaerungen/cleanup")]
[Description(
"The cleanup system provides a fair way for stopping unused servers and staying stable even with overallocation. A detailed explanation: docs.endelon-hosting.de/erklaerungen/cleanup")]
public bool Enable { get; set; } = false;
[JsonProperty("MinUptime")]
@@ -121,9 +160,7 @@ public class ConfigV1
[JsonProperty("Host")] public string Host { get; set; } = "your.database.host";
[JsonProperty("Password")]
[Blur]
public string Password { get; set; } = "secret";
[JsonProperty("Password")] [Blur] public string Password { get; set; } = "secret";
[JsonProperty("Port")] public long Port { get; set; } = 3306;
@@ -141,6 +178,7 @@ public class ConfigV1
[Blur]
public string Token { get; set; } = Guid.NewGuid().ToString();
}
public class DiscordBotData
{
[JsonProperty("Enable")]
@@ -164,7 +202,8 @@ public class ConfigV1
public class DiscordNotificationsData
{
[JsonProperty("Enable")]
[Description("The discord notification system sends you a message everytime a event like a new support chat message is triggered with usefull data describing the event")]
[Description(
"The discord notification system sends you a message everytime a event like a new support chat message is triggered with usefull data describing the event")]
public bool Enable { get; set; } = false;
[JsonProperty("WebHook")]
@@ -201,19 +240,23 @@ public class ConfigV1
public class HeadersData
{
[JsonProperty("Color")]
[Description("This specifies the color of the embed generated by platforms like discord when someone posts a link to your moonlight instance")]
[Description(
"This specifies the color of the embed generated by platforms like discord when someone posts a link to your moonlight instance")]
public string Color { get; set; } = "#4b27e8";
[JsonProperty("Description")]
[Description("This specifies the description text of the embed generated by platforms like discord when someone posts a link to your moonlight instance and can also help google to index your moonlight instance correctly")]
[Description(
"This specifies the description text of the embed generated by platforms like discord when someone posts a link to your moonlight instance and can also help google to index your moonlight instance correctly")]
public string Description { get; set; } = "the next generation hosting panel";
[JsonProperty("Keywords")]
[Description("To help search engines like google to index your moonlight instance correctly you can specify keywords seperated by a comma here")]
[Description(
"To help search engines like google to index your moonlight instance correctly you can specify keywords seperated by a comma here")]
public string Keywords { get; set; } = "moonlight";
[JsonProperty("Title")]
[Description("This specifies the title of the embed generated by platforms like discord when someone posts a link to your moonlight instance")]
[Description(
"This specifies the title of the embed generated by platforms like discord when someone posts a link to your moonlight instance")]
public string Title { get; set; } = "Moonlight - endelon.link";
}
@@ -223,9 +266,7 @@ public class ConfigV1
[JsonProperty("Server")] public string Server { get; set; } = "your.mail.host";
[JsonProperty("Password")]
[Blur]
public string Password { get; set; } = "secret";
[JsonProperty("Password")] [Blur] public string Password { get; set; } = "secret";
[JsonProperty("Port")] public int Port { get; set; } = 465;
@@ -263,19 +304,19 @@ public class ConfigV1
[JsonProperty("ClientId")] public string ClientId { get; set; }
[JsonProperty("ClientSecret")]
[Blur]
public string ClientSecret { get; set; }
[JsonProperty("ClientSecret")] [Blur] public string ClientSecret { get; set; }
}
public class RatingData
{
[JsonProperty("Enabled")]
[Description("The rating systems shows a user who is registered longer than the set amout of days a popup to rate this platform if he hasnt rated it before")]
[Description(
"The rating systems shows a user who is registered longer than the set amout of days a popup to rate this platform if he hasnt rated it before")]
public bool Enabled { get; set; } = false;
[JsonProperty("Url")]
[Description("This is the url a user who rated above a set limit is shown to rate you again. Its recommended to put your google or trustpilot rate link here")]
[Description(
"This is the url a user who rated above a set limit is shown to rate you again. Its recommended to put your google or trustpilot rate link here")]
public string Url { get; set; } = "https://link-to-google-or-smth";
[JsonProperty("MinRating")]
@@ -290,7 +331,8 @@ public class ConfigV1
public class SecurityData
{
[JsonProperty("Token")]
[Description("This is the moonlight app token. It is used to encrypt and decrypt data and validate tokens and sessions")]
[Description(
"This is the moonlight app token. It is used to encrypt and decrypt data and validate tokens and sessions")]
[Blur]
public string Token { get; set; } = Guid.NewGuid().ToString();
@@ -306,7 +348,8 @@ public class ConfigV1
[JsonProperty("ReCaptcha")] public ReCaptchaData ReCaptcha { get; set; } = new();
[JsonProperty("BlockDatacenterIps")]
[Description("If this option is enabled, users with an ip from datacenters will not be able to access the panel")]
[Description(
"If this option is enabled, users with an ip from datacenters will not be able to access the panel")]
public bool BlockDatacenterIps { get; set; } = true;
[JsonProperty("AllowCloudflareIps")]
@@ -317,22 +360,20 @@ public class ConfigV1
public class ReCaptchaData
{
[JsonProperty("Enable")]
[Description("Enables repatcha at places like the register page. For information how to get your recaptcha credentails go to google.com/recaptcha/about/")]
[Description(
"Enables repatcha at places like the register page. For information how to get your recaptcha credentails go to google.com/recaptcha/about/")]
public bool Enable { get; set; } = false;
[JsonProperty("SiteKey")]
[Blur]
public string SiteKey { get; set; } = "recaptcha site key here";
[JsonProperty("SiteKey")] [Blur] public string SiteKey { get; set; } = "recaptcha site key here";
[JsonProperty("SecretKey")]
[Blur]
public string SecretKey { get; set; } = "recaptcha secret here";
[JsonProperty("SecretKey")] [Blur] public string SecretKey { get; set; } = "recaptcha secret here";
}
public class SentryData
{
[JsonProperty("Enable")]
[Description("Sentry is a way to monitor application crashes and performance issues in real time. Enable this option only if you set a sentry dsn")]
[Description(
"Sentry is a way to monitor application crashes and performance issues in real time. Enable this option only if you set a sentry dsn")]
public bool Enable { get; set; } = false;
[JsonProperty("Dsn")]

View File

@@ -113,13 +113,18 @@ public class EventSystem
return Task.CompletedTask;
}
public Task<T> WaitForEvent<T>(string id, object handle, Func<T, bool> filter)
public Task<T> WaitForEvent<T>(string id, object handle, Func<T, bool>? filter = null)
{
var taskCompletionSource = new TaskCompletionSource<T>();
Func<T, Task> action = async data =>
{
if (filter.Invoke(data))
if (filter == null)
{
taskCompletionSource.SetResult(data);
await Off(id, handle);
}
else if(filter.Invoke(data))
{
taskCompletionSource.SetResult(data);
await Off(id, handle);

View File

@@ -110,15 +110,15 @@ public class HostFileAccess : FileAccess
if (fileData.IsFile)
File.Delete(currhp + fileData.Name);
else
Directory.Delete(currhp + fileData.Name);
Directory.Delete(currhp + fileData.Name, true);
}
public override async Task Move(FileData fileData, string newPath)
{
if (fileData.IsFile)
File.Move(currhp + fileData.Name, newPath);
File.Move(currhp + fileData.Name, BasePath + newPath);
else
Directory.Move(currhp + fileData.Name, newPath);
Directory.Move(currhp + fileData.Name, BasePath + newPath);
}
public override Task Compress(params FileData[] files)

View File

@@ -54,4 +54,37 @@ public static class StringHelper
return input.Substring(0, halfLength);
}
public static bool EndsInOneOf(string suffix, IEnumerable<string> strings)
{
foreach (string str in strings)
{
if (suffix.EndsWith(str))
{
return true;
}
}
return false;
}
public static bool ContainsOneOf(string textToSearch, IEnumerable<string> strings, out string foundText)
{
foreach (string str in strings)
{
if (textToSearch.Contains(str))
{
foundText = str;
return true;
}
}
foundText = "";
return false;
}
public static bool ContainsOneOf(string textToSearch, IEnumerable<string> strings)
{
return ContainsOneOf(textToSearch, strings, out _);
}
}

View File

@@ -225,7 +225,7 @@ public class WingsConsole : IDisposable
// we need to set the install state here
// See https://github.com/pterodactyl/panel/issues/4853
// for more details
await UpdateServerState(ServerState.Installing);
//await UpdateServerState(ServerState.Installing);
}
foreach (var line in eventData.Args)

View File

@@ -61,6 +61,10 @@ public class WingsServerConverter
.First(x => x.Id == server.Image.Id);
// Container
if(server.DockerImageIndex >= image.DockerImages.Count() || server.DockerImageIndex == -1)
wingsServer.Settings.Container.Image = image.DockerImages.Last().Name;
else
wingsServer.Settings.Container.Image = image.DockerImages[server.DockerImageIndex].Name;
// Egg

View File

@@ -0,0 +1,33 @@
using Microsoft.AspNetCore.Mvc;
using Moonlight.App.Events;
using Moonlight.App.Services;
namespace Moonlight.App.Http.Controllers.WellKnown;
[ApiController]
[Route(".well-known/acme-challenge")]
public class AcmeController : Controller
{
private readonly LetsEncryptService LetsEncryptService;
private readonly EventSystem Event;
public AcmeController(LetsEncryptService letsEncryptService, EventSystem eventSystem)
{
LetsEncryptService = letsEncryptService;
Event = eventSystem;
}
[HttpGet("{token}")]
public async Task<ActionResult> Get([FromRoute] string token)
{
if (string.IsNullOrEmpty(LetsEncryptService.HttpChallenge) || string.IsNullOrEmpty(LetsEncryptService.HttpChallengeToken))
return Problem();
if (string.IsNullOrEmpty(token) || LetsEncryptService.HttpChallengeToken != token)
return Problem();
await Event.Emit("letsEncrypt.challengeFetched");
return Ok(LetsEncryptService.HttpChallenge);
}
}

View File

@@ -0,0 +1,78 @@
using Moonlight.App.Database.Entities;
using Moonlight.App.Helpers;
using Moonlight.App.Models.Misc;
using Moonlight.App.Services;
namespace Moonlight.App.MalwareScans;
public class BadScriptsScan : MalwareScan
{
public override string Name => "BadScripts Scan";
public override string Description => "This scanner tries to find scripts like proxies or other bad stuff";
public async override Task<MalwareScanResult?> Scan(Server server, IServiceProvider serviceProvider)
{
var serverService = serviceProvider.GetRequiredService<ServerService>();
var fileAccess = await serverService.CreateFileAccess(server, null!);
string[] fileExtensions =
{
".py",
".js",
".json",
".txt",
".sh",
".env",
".md",
".html",
".htm"
};
string[] badWords =
{
"cloudscraper",
"shadowsocks",
"karma-ddos",
"quake",
"nuked by",
"nuke bot",
"t-e-s-tweb",
"nezha",
"rblxwild.com",
"proxyscrape",
"vless://",
"vmess://",
"trojan://",
"shadowrocket",
"urfate/afk-bot",
"token vc spammer",
"pretreer.com",
"madfutters.com",
"ultrafut",
"selfcord.py",
"https://github.com/go-gost/gost",
"nodejs-proxy"
};
var files = await fileAccess.Ls();
var filteredFiles = files.Where(x =>
StringHelper.EndsInOneOf(x.Name, fileExtensions));
foreach (var file in filteredFiles)
{
var content = await fileAccess.Read(file);
var processableContent = content.ToLower();
if (StringHelper.ContainsOneOf(processableContent, badWords, out string foundText))
{
return new()
{
Title = "Software which is not allowed",
Description = $"Found bad word in script '{file.Name}': '{foundText}'",
Author = "Marcel Baumgartner"
};
}
}
return null;
}
}

View File

@@ -1,54 +0,0 @@
using Moonlight.App.Database.Entities;
using Moonlight.App.Models.Misc;
using Moonlight.App.Services;
namespace Moonlight.App.MalwareScans;
public class DiscordNukeScan : MalwareScan
{
public override string Name => "Discord nuke";
public override string Description => "Discord nuke bot detector";
public override async Task<MalwareScanResult?> Scan(Server server, IServiceProvider serviceProvider)
{
var serverService = serviceProvider.GetRequiredService<ServerService>();
var access = await serverService.CreateFileAccess(server, null!);
var files = await access.Ls();
var filteredFiles = files.Where(x =>
x.Name.EndsWith(".py") ||
x.Name.EndsWith(".js") ||
x.Name.EndsWith(".json") ||
x.Name.EndsWith(".env"));
foreach (var file in filteredFiles)
{
var content = await access.Read(file);
var filteredContent = content.ToLower();
if (filteredContent.Contains("quake") ||
filteredContent.Contains("nuked by") ||
filteredContent.Contains("nuke bot") ||
(filteredContent.Contains("fucked by") && filteredContent.Contains("nuke"))) // fucked by in context with nuke
{
return new()
{
Title = "Discord nuke bot",
Description = "Found suspicious content which may indicate there is a nuke bot running",
Author = "Marcel Baumgartner"
};
}
if (files.Any(x => x.Name == "nukes.json"))
{
return new()
{
Title = "Discord nuke bot",
Description = "Found suspicious content which may indicate there is a nuke bot running",
Author = "Marcel Baumgartner"
};
}
}
return null;
}
}

View File

@@ -1,35 +0,0 @@
using Moonlight.App.Database.Entities;
using Moonlight.App.Models.Misc;
using Moonlight.App.Services;
namespace Moonlight.App.MalwareScans;
public class MinerScan : MalwareScan
{
public override string Name => "Miner (NEZHA)";
public override string Description => "Probably a miner";
public override async Task<MalwareScanResult?> Scan(Server server, IServiceProvider serviceProvider)
{
var serverService = serviceProvider.GetRequiredService<ServerService>();
var access = await serverService.CreateFileAccess(server, null!);
var files = await access.Ls();
foreach (var file in files.Where(x => x.IsFile && (x.Name.EndsWith(".sh") || x.Name.EndsWith(".yml")) || x.Name == "bed"))
{
var content = await access.Read(file);
if (content.ToLower().Contains("nezha"))
{
return new()
{
Title = "Miner",
Description = "Miner start script (NEZHA)",
Author = "Marcel Baumgartner"
};
}
}
return null;
}
}

View File

@@ -1,36 +0,0 @@
using Moonlight.App.Database.Entities;
using Moonlight.App.Models.Misc;
using Moonlight.App.Services;
namespace Moonlight.App.MalwareScans;
public class ProxyScan : MalwareScan
{
public override string Name => "Proxy software";
public override string Description => "Software to use nodes as a proxy";
public override async Task<MalwareScanResult?> Scan(Server server, IServiceProvider serviceProvider)
{
var serverService = serviceProvider.GetRequiredService<ServerService>();
var access = await serverService.CreateFileAccess(server, null!);
var files = await access.Ls();
foreach (var file in files.Where(x => x.Name.EndsWith(".sh")))
{
var fileContent = await access.Read(file);
var processableContent = fileContent.ToLower();
if (processableContent.Contains("t-e-s-tweb"))
{
return new MalwareScanResult()
{
Title = "Proxy software",
Description = "Software to use nodes as a proxy",
Author = "Marcel Baumgartner"
};
}
}
return null;
}
}

View File

@@ -1,35 +0,0 @@
using Moonlight.App.Database.Entities;
using Moonlight.App.Models.Misc;
using Moonlight.App.Services;
namespace Moonlight.App.MalwareScans;
public class SelfBotCodeScan : MalwareScan
{
public override string Name => "Selfbot code scan";
public override string Description => "This scan is a simple selfbot code scan provided by moonlight";
public override async Task<MalwareScanResult?> Scan(Server server, IServiceProvider serviceProvider)
{
var serverService = serviceProvider.GetRequiredService<ServerService>();
var access = await serverService.CreateFileAccess(server, null!);
var fileElements = await access.Ls();
foreach (var script in fileElements.Where(x => x.Name.EndsWith(".py") && x.IsFile))
{
var rawScript = await access.Read(script);
if (rawScript.Contains("https://discord.com/api") && !rawScript.Contains("https://discord.com/api/oauth2") && !rawScript.Contains("https://discord.com/api/webhook") || rawScript.Contains("https://rblxwild.com")) //TODO: Export to plugins, add regex for checking
{
return new MalwareScanResult
{
Title = "Potential selfbot",
Description = $"Suspicious script file: {script.Name}",
Author = "Marcel Baumgartner"
};
}
}
return null;
}
}

View File

@@ -1,30 +0,0 @@
using Moonlight.App.Database.Entities;
using Moonlight.App.Models.Misc;
using Moonlight.App.Services;
namespace Moonlight.App.MalwareScans;
public class SelfBotScan : MalwareScan
{
public override string Name => "Selfbot Scan";
public override string Description => "This scan is a simple selfbot scan provided by moonlight";
public override async Task<MalwareScanResult?> Scan(Server server, IServiceProvider serviceProvider)
{
var serverService = serviceProvider.GetRequiredService<ServerService>();
var access = await serverService.CreateFileAccess(server, null!);
var fileElements = await access.Ls();
if (fileElements.Any(x => x.Name == "tokens.txt"))
{
return new MalwareScanResult
{
Title = "Found SelfBot",
Description = "Detected suspicious 'tokens.txt' file which may contain tokens for a selfbot",
Author = "Marcel Baumgartner"
};
}
return null;
}
}

View File

@@ -17,7 +17,6 @@ public class ConfigService
public ConfigService(StorageService storageService)
{
StorageService = storageService;
StorageService.EnsureCreated();
if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("ML_CONFIG_PATH")))
Path = Environment.GetEnvironmentVariable("ML_CONFIG_PATH")!;

View File

@@ -5,6 +5,7 @@ using CloudFlare.Client.Api.Parameters.Data;
using CloudFlare.Client.Api.Result;
using CloudFlare.Client.Api.Zones;
using CloudFlare.Client.Api.Zones.DnsRecord;
using CloudFlare.Client.Client.Zones;
using CloudFlare.Client.Enumerators;
using Microsoft.EntityFrameworkCore;
using Moonlight.App.Database.Entities;
@@ -82,12 +83,27 @@ public class DomainService
if (!ConfigService.Get().Moonlight.Domains.Enable)
return Array.Empty<Zone>();
var domains = GetData(
await Client.Zones.GetAsync(new()
var domains = new List<Zone>();
var initialResponse = await Client.Zones.GetAsync();
domains.AddRange(GetData(initialResponse));
// Check if there are more pages
while (initialResponse.ResultInfo.Page < initialResponse.ResultInfo.TotalPage)
{
AccountId = AccountId
})
// Get the next page of data
var nextPageResponse = await Client.Zones.GetAsync(
displayOptions: new()
{
Page = initialResponse.ResultInfo.Page + 1
}
);
var nextPageZones = GetData(nextPageResponse);
domains.AddRange(nextPageZones);
initialResponse = nextPageResponse;
}
var sharedDomains = SharedDomainRepository.Get().ToArray();

View File

@@ -13,6 +13,7 @@ public class StorageService
Directory.CreateDirectory(PathBuilder.Dir("storage", "backups"));
Directory.CreateDirectory(PathBuilder.Dir("storage", "logs"));
Directory.CreateDirectory(PathBuilder.Dir("storage", "plugins"));
Directory.CreateDirectory(PathBuilder.Dir("storage", "certs"));
await UpdateResources();

View File

@@ -0,0 +1,180 @@
using System.Security.Cryptography.X509Certificates;
using Certes;
using Certes.Acme;
using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.Http.Connections;
using Moonlight.App.Events;
using Moonlight.App.Helpers;
namespace Moonlight.App.Services;
public class LetsEncryptService
{
private readonly ConfigService ConfigService;
private readonly string LetsEncryptCertPath;
private readonly EventSystem Event;
private X509Certificate2 Certificate;
public string HttpChallenge { get; private set; } = "";
public string HttpChallengeToken { get; private set; } = "";
public LetsEncryptService(ConfigService configService, EventSystem eventSystem)
{
ConfigService = configService;
Event = eventSystem;
LetsEncryptCertPath = PathBuilder.File("storage", "certs", "letsencrypt.pfx");
}
public async Task AutoProcess()
{
try
{
if (!ConfigService.Get().Moonlight.LetsEncrypt.Enable)
return;
if (await CheckNeedsRenewal())
{
try
{
await Renew();
}
catch (Exception e)
{
Logger.Error("Unable to issue lets encrypt certificate");
Logger.Error(e);
}
}
else
Logger.Info("Skipping lets encrypt renewal");
await LoadCertificate();
}
catch(Exception e)
{
Logger.Error("Unhandled exception while auto proccessing lets encrypt certificates");
Logger.Error(e);
}
}
private Task LoadCertificate()
{
try
{
Certificate = new X509Certificate2(
LetsEncryptCertPath,
ConfigService.Get().Moonlight.Security.Token
);
Logger.Info($"Loaded ssl certificate. '{Certificate.FriendlyName}' issued by '{Certificate.IssuerName.Name}'");
}
catch (Exception e)
{
Logger.Warn("Unable to load ssl certificates");
Logger.Warn(e);
}
return Task.CompletedTask;
}
private async Task Renew()
{
Logger.Info("Renewing lets encrypt certificate");
var uri = new Uri(ConfigService.Get().Moonlight.AppUrl);
var config = ConfigService.Get().Moonlight.LetsEncrypt;
if (uri.HostNameType == UriHostNameType.IPv4 || uri.HostNameType == UriHostNameType.IPv6)
{
Logger.Warn("You cannot use an ip to issue a lets encrypt certificate");
return;
}
var acmeContext = new AcmeContext(WellKnownServers.LetsEncryptV2);
Logger.Info($"Starting lets encrypt certificate issuing. Using acme server '{acmeContext.DirectoryUri}'");
var account = await acmeContext.NewAccount(config.ExpireEmail, true);
Logger.Info("Creating order");
var order = await acmeContext.NewOrder(new[] { uri.Host });
var authZ = (await order.Authorizations()).First();
var challenge = await authZ.Http();
HttpChallengeToken = challenge.Token;
HttpChallenge = challenge.KeyAuthz;
Logger.Info("Waiting for http challenge to complete");
Task.Run(async () =>
{
await Task.Delay(TimeSpan.FromSeconds(3));
try
{
await challenge.Validate();
Logger.Info("Tried to validate");
}
catch (Exception e)
{
Logger.Error("Unable to validate challenge");
Logger.Error(e);
}
});
await Event.WaitForEvent<Object>("letsEncrypt.challengeFetched", this);
Logger.Info("Generating certificate");
var privateKey = KeyFactory.NewKey(KeyAlgorithm.ES256);
var certificate = await order.Generate(new CsrInfo
{
CountryName = config.CountryCode,
State = config.State,
Locality = config.Locality,
Organization = config.Organization,
OrganizationUnit = "Dev",
CommonName = uri.Host
}, privateKey);
var builder = certificate.ToPfx(privateKey);
var certBytes = builder.Build(
uri.Host,
ConfigService.Get().Moonlight.Security.Token
);
Logger.Info($"Saved lets encrypt certificate to '{LetsEncryptCertPath}'");
await File.WriteAllBytesAsync(LetsEncryptCertPath, certBytes);
}
private Task<bool> CheckNeedsRenewal()
{
if (!File.Exists(LetsEncryptCertPath))
{
Logger.Info("No lets encrypt certificate found");
return Task.FromResult(true);
}
var existingCert = new X509Certificate2(LetsEncryptCertPath, ConfigService.Get().Moonlight.Security.Token);
var expirationDate = existingCert.NotAfter;
if (DateTime.Now < expirationDate)
{
Logger.Info($"Lets encrypt certificate valid until {Formatter.FormatDate(expirationDate)}");
return Task.FromResult(false);
}
Logger.Info("Lets encrypt certificate expired");
return Task.FromResult(true);
}
public X509Certificate2? SelectCertificate(ConnectionContext? context, string? domain)
{
if (context == null)
return null;
return Certificate;
}
}

View File

@@ -20,13 +20,9 @@ public class MalwareScanService
{
var defaultScans = new List<MalwareScan>
{
new SelfBotScan(),
new MinerJarScan(),
new SelfBotCodeScan(),
new FakePlayerPluginScan(),
new MinerScan(),
new ProxyScan(),
new DiscordNukeScan()
new BadScriptsScan()
};
var scans = await PluginService.BuildMalwareScans(defaultScans.ToArray());

View File

@@ -13,11 +13,6 @@ public class PluginService
public readonly List<MoonlightPlugin> Plugins = new();
public readonly Dictionary<MoonlightPlugin, string> PluginFiles = new();
public PluginService()
{
ReloadPlugins().Wait();
}
public Task ReloadPlugins()
{
PluginFiles.Clear();

View File

@@ -3,6 +3,7 @@ using JWT.Algorithms;
using JWT.Builder;
using JWT.Exceptions;
using Microsoft.EntityFrameworkCore;
using Microsoft.JSInterop;
using Moonlight.App.Database.Entities;
using Moonlight.App.Helpers;
using Moonlight.App.Perms;
@@ -16,6 +17,7 @@ public class IdentityService
private readonly Repository<User> UserRepository;
private readonly CookieService CookieService;
private readonly IHttpContextAccessor HttpContextAccessor;
private readonly IJSRuntime JsRuntime;
private readonly string Secret;
public User User { get; private set; }
@@ -29,11 +31,13 @@ public class IdentityService
CookieService cookieService,
Repository<User> userRepository,
IHttpContextAccessor httpContextAccessor,
ConfigService configService)
ConfigService configService,
IJSRuntime jsRuntime)
{
CookieService = cookieService;
UserRepository = userRepository;
HttpContextAccessor = httpContextAccessor;
JsRuntime = jsRuntime;
Secret = configService
.Get()
@@ -260,4 +264,21 @@ public class IdentityService
Permissions.IsReadyOnly = true;
}
public async Task<bool> GetBotStatus()
{
var webDriverStatus = await JsRuntime
.InvokeAsync<bool>("moonlight.utils.getWebDriverStatus");
if (webDriverStatus)
return true;
var languagesStatus = await JsRuntime
.InvokeAsync<bool>("moonlight.utils.getLanguagesStatus");
if (languagesStatus)
return true;
return false;
}
}

View File

@@ -62,6 +62,19 @@ public class UserService
throw new DisplayException("This email is blacklisted");
}
if (ConfigService.Get().Moonlight.Auth.BlockLinuxUsers && IdentityService.Device.Contains("Linux"))
throw new DisplayException("This operation was disabled");
if (ConfigService.Get().Moonlight.Auth.CheckForBots)
{
var isABot = await IdentityService.GetBotStatus();
if (isABot)
{
throw new DisplayException("This operation was disabled");
}
}
// Check if the email is already taken
var emailTaken = UserRepository.Get().FirstOrDefault(x => x.Email == email) != null;

View File

@@ -17,6 +17,7 @@
<PackageReference Include="BlazorDownloadFile" Version="2.4.0.2" />
<PackageReference Include="BlazorMonaco" Version="2.1.0" />
<PackageReference Include="BlazorTable" Version="1.17.0" />
<PackageReference Include="Certes" Version="3.0.4" />
<PackageReference Include="CloudFlare.Client" Version="6.1.4" />
<PackageReference Include="CurrieTechnologies.Razor.SweetAlert2" Version="5.5.0" />
<PackageReference Include="Discord.Net" Version="3.10.0" />

View File

@@ -1,316 +1,17 @@
using BlazorDownloadFile;
using BlazorTable;
using HealthChecks.UI.Client;
using Moonlight.App.ApiClients.CloudPanel;
using Moonlight.App.ApiClients.Daemon;
using Moonlight.App.ApiClients.Modrinth;
using Moonlight.App.ApiClients.Paper;
using Moonlight.App.ApiClients.Telemetry;
using Moonlight.App.ApiClients.Wings;
using Moonlight.App.Database;
using Moonlight.App.Diagnostics.HealthChecks;
using Moonlight.App.Events;
using Moonlight.App.Helpers;
using Moonlight.App.Helpers.Wings;
using Moonlight.App.LogMigrator;
using Moonlight.App.Repositories;
using Moonlight.App.Repositories.Domains;
using Moonlight.App.Repositories.Servers;
using Moonlight.App.Services;
using Moonlight.App.Services.Addon;
using Moonlight.App.Services.Background;
using Moonlight.App.Services.DiscordBot;
using Moonlight.App.Services.Files;
using Moonlight.App.Services.Interop;
using Moonlight.App.Services.Mail;
using Moonlight.App.Services.Minecraft;
using Moonlight.App.Services.Notifications;
using Moonlight.App.Services.Plugins;
using Moonlight.App.Services.Sessions;
using Moonlight.App.Services.Statistics;
using Moonlight.App.Services.SupportChat;
using Moonlight.App.Services.Tickets;
using Sentry;
using Serilog;
using Serilog.Events;
using Stripe;
using SubscriptionService = Moonlight.App.Services.SubscriptionService;
namespace Moonlight
{
public class Program
{
private static readonly Startup Startup = new();
public static async Task Main(string[] args)
{
var storageService = new StorageService();
await storageService.EnsureCreated();
Console.WriteLine("Moonlight Panel");
Console.WriteLine($"Copyright {DateTime.UtcNow.Year} moonlightpanel.xyz");
Console.WriteLine();
var configService = new ConfigService(storageService);
var shouldUseSentry = configService
.Get()
.Moonlight.Sentry.Enable;
if (configService.DebugMode)
{
if (shouldUseSentry)
{
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Verbose()
.Enrich.FromLogContext()
.WriteTo.Console(
outputTemplate: "{Timestamp:HH:mm:ss} [{Level:u3}] {SourceContext} {Message:lj}{NewLine}{Exception}")
.WriteTo.File(PathBuilder.File("storage", "logs", $"{DateTime.UtcNow:yyyy-MM-dd}.log"))
.WriteTo.Sentry(options =>
{
options.MinimumBreadcrumbLevel = LogEventLevel.Debug;
options.MinimumEventLevel = LogEventLevel.Warning;
})
.CreateLogger();
}
else
{
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Verbose()
.Enrich.FromLogContext()
.WriteTo.Console(
outputTemplate: "{Timestamp:HH:mm:ss} [{Level:u3}] {SourceContext} {Message:lj}{NewLine}{Exception}")
.WriteTo.File(PathBuilder.File("storage", "logs", $"{DateTime.UtcNow:yyyy-MM-dd}.log"))
.CreateLogger();
}
}
else
{
if (shouldUseSentry)
{
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Information()
.Enrich.FromLogContext()
.WriteTo.Console(
outputTemplate: "{Timestamp:HH:mm:ss} [{Level:u3}] {SourceContext} {Message:lj}{NewLine}{Exception}")
.WriteTo.Sentry(options =>
{
options.MinimumBreadcrumbLevel = LogEventLevel.Information;
options.MinimumEventLevel = LogEventLevel.Warning;
})
.WriteTo.File(PathBuilder.File("storage", "logs", $"{DateTime.UtcNow:yyyy-MM-dd}.log"))
.CreateLogger();
}
else
{
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Information()
.Enrich.FromLogContext()
.WriteTo.Console(
outputTemplate: "{Timestamp:HH:mm:ss} [{Level:u3}] {SourceContext} {Message:lj}{NewLine}{Exception}")
.WriteTo.File(PathBuilder.File("storage", "logs", $"{DateTime.UtcNow:yyyy-MM-dd}.log"))
.CreateLogger();
}
}
Logger.Info("Running pre-init tasks");
var databaseCheckupService = new DatabaseCheckupService(configService);
await databaseCheckupService.Perform();
var builder = WebApplication.CreateBuilder(args);
var pluginService = new PluginService();
await pluginService.BuildServices(builder.Services);
// Switch to logging.net injection
// TODO: Enable in production
builder.Logging.ClearProviders();
builder.Logging.AddProvider(new LogMigratorProvider());
// Add services to the container.
builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor()
.AddHubOptions(options =>
{
options.MaximumReceiveMessageSize = 10000000;
options.ClientTimeoutInterval = TimeSpan.FromSeconds(30);
options.HandshakeTimeout = TimeSpan.FromSeconds(10);
});
builder.Services.AddHttpContextAccessor();
builder.Services.AddHealthChecks()
.AddCheck<DatabaseHealthCheck>("Database")
.AddCheck<NodeHealthCheck>("Nodes")
.AddCheck<DaemonHealthCheck>("Daemons");
// Sentry
if (shouldUseSentry)
{
builder.WebHost.UseSentry(options =>
{
options.Dsn = configService
.Get()
.Moonlight.Sentry.Dsn;
options.Debug = configService.DebugMode;
options.DiagnosticLevel = SentryLevel.Warning;
options.TracesSampleRate = 1.0;
options.DiagnosticLogger = new SentryDiagnosticsLogger(SentryLevel.Warning);
});
}
// Databases
builder.Services.AddDbContext<DataContext>();
// Repositories
builder.Services.AddScoped<UserRepository>();
builder.Services.AddScoped<NodeRepository>();
builder.Services.AddScoped<ServerRepository>();
builder.Services.AddScoped<ServerBackupRepository>();
builder.Services.AddScoped<ImageRepository>();
builder.Services.AddScoped<DomainRepository>();
builder.Services.AddScoped<SharedDomainRepository>();
builder.Services.AddScoped<RevokeRepository>();
builder.Services.AddScoped<NotificationRepository>();
builder.Services.AddScoped<DdosAttackRepository>();
builder.Services.AddScoped<SubscriptionRepository>();
builder.Services.AddScoped<LoadingMessageRepository>();
builder.Services.AddScoped<NewsEntryRepository>();
builder.Services.AddScoped<NodeAllocationRepository>();
builder.Services.AddScoped<StatisticsRepository>();
builder.Services.AddScoped(typeof(Repository<>));
// Services
builder.Services.AddSingleton<ConfigService>();
builder.Services.AddSingleton<StorageService>();
builder.Services.AddScoped<CookieService>();
builder.Services.AddScoped<IdentityService>();
builder.Services.AddScoped<IpLocateService>();
builder.Services.AddScoped<AlertService>();
builder.Services.AddScoped<SmartTranslateService>();
builder.Services.AddScoped<UserService>();
builder.Services.AddScoped<TotpService>();
builder.Services.AddScoped<ToastService>();
builder.Services.AddScoped<NodeService>();
builder.Services.AddScoped<ServerService>();
builder.Services.AddSingleton<PaperService>();
builder.Services.AddScoped<ClipboardService>();
builder.Services.AddSingleton<ResourceService>();
builder.Services.AddScoped<DomainService>();
builder.Services.AddScoped<OneTimeJwtService>();
builder.Services.AddSingleton<NotificationServerService>();
builder.Services.AddScoped<NotificationAdminService>();
builder.Services.AddScoped<ModalService>();
builder.Services.AddScoped<SmartDeployService>();
builder.Services.AddScoped<WebSpaceService>();
builder.Services.AddScoped<StatisticsViewService>();
builder.Services.AddSingleton<DateTimeService>();
builder.Services.AddSingleton<EventSystem>();
builder.Services.AddScoped<FileDownloadService>();
builder.Services.AddScoped<ForgeService>();
builder.Services.AddScoped<FabricService>();
builder.Services.AddSingleton<BucketService>();
builder.Services.AddScoped<RatingService>();
builder.Services.AddScoped<ReCaptchaService>();
builder.Services.AddScoped<IpBanService>();
builder.Services.AddSingleton<OAuth2Service>();
builder.Services.AddScoped<DynamicBackgroundService>();
builder.Services.AddScoped<ServerAddonPluginService>();
builder.Services.AddScoped<KeyListenerService>();
builder.Services.AddScoped<PopupService>();
builder.Services.AddScoped<SubscriptionService>();
builder.Services.AddScoped<BillingService>();
builder.Services.AddSingleton<PluginStoreService>();
builder.Services.AddSingleton<TicketServerService>();
builder.Services.AddScoped<TicketClientService>();
builder.Services.AddScoped<TicketAdminService>();
builder.Services.AddScoped<MalwareScanService>();
builder.Services.AddSingleton<IpVerificationService>();
builder.Services.AddScoped<SessionClientService>();
builder.Services.AddSingleton<SessionServerService>();
builder.Services.AddScoped<MailService>();
// Support chat
builder.Services.AddSingleton<SupportChatServerService>();
builder.Services.AddScoped<SupportChatClientService>();
builder.Services.AddScoped<SupportChatAdminService>();
// Helpers
builder.Services.AddSingleton<SmartTranslateHelper>();
builder.Services.AddScoped<WingsApiHelper>();
builder.Services.AddScoped<WingsServerConverter>();
builder.Services.AddSingleton<WingsJwtHelper>();
builder.Services.AddScoped<WingsConsoleHelper>();
builder.Services.AddSingleton<PaperApiHelper>();
builder.Services.AddSingleton<HostSystemHelper>();
builder.Services.AddScoped<DaemonApiHelper>();
builder.Services.AddScoped<CloudPanelApiHelper>();
builder.Services.AddScoped<ModrinthApiHelper>();
builder.Services.AddScoped<TelemetryApiHelper>();
// Background services
builder.Services.AddSingleton<DiscordBotService>();
builder.Services.AddSingleton<StatisticsCaptureService>();
builder.Services.AddSingleton<DiscordNotificationService>();
builder.Services.AddSingleton<CleanupService>();
builder.Services.AddSingleton<MalwareBackgroundScanService>();
builder.Services.AddSingleton<TelemetryService>();
builder.Services.AddSingleton<TempMailService>();
builder.Services.AddSingleton<DdosProtectionService>();
builder.Services.AddSingleton(pluginService);
// Other
builder.Services.AddSingleton<MoonlightService>();
// Third party services
builder.Services.AddBlazorTable();
builder.Services.AddBlazorContextMenu();
builder.Services.AddBlazorDownloadFile();
StripeConfiguration.ApiKey = configService
.Get()
.Moonlight.Stripe.ApiKey;
var app = builder.Build();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
// Sentry
if (shouldUseSentry)
{
app.UseSentryTracing();
}
app.UseStaticFiles();
app.UseRouting();
app.UseWebSockets();
app.MapControllers();
app.MapBlazorHub();
app.MapFallbackToPage("/_Host");
app.MapHealthChecks("/_health", new()
{
ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
});
// AutoStart services
_ = app.Services.GetRequiredService<CleanupService>();
_ = app.Services.GetRequiredService<DiscordBotService>();
_ = app.Services.GetRequiredService<StatisticsCaptureService>();
_ = app.Services.GetRequiredService<DiscordNotificationService>();
_ = app.Services.GetRequiredService<MalwareBackgroundScanService>();
_ = app.Services.GetRequiredService<TelemetryService>();
_ = app.Services.GetRequiredService<TempMailService>();
_ = app.Services.GetRequiredService<DdosProtectionService>();
_ = app.Services.GetRequiredService<MoonlightService>();
// Discord bot service
//var discordBotService = app.Services.GetRequiredService<DiscordBotService>();
await app.RunAsync();
await Startup.Init(args);
await Startup.Start();
}
}
}

View File

@@ -9,7 +9,7 @@
"ASPNETCORE_ENVIRONMENT": "Development",
"ML_DEBUG": "true"
},
"applicationUrl": "http://moonlight.owo:5118;https://localhost:7118;http://localhost:5118",
"applicationUrl": "http://localhost:5118;http://moonlight.owo:5118",
"dotnetRunMessages": true
},
"Live DB":
@@ -21,7 +21,7 @@
"ML_DEBUG": "true",
"ML_CONFIG_PATH": "storage\\configs\\live_config.json"
},
"applicationUrl": "http://moonlight.owo:5118;https://localhost:7118;http://localhost:5118",
"applicationUrl": "http://moonlight.owo:5118;http://localhost:5118",
"dotnetRunMessages": true
},
"Dev DB 1":
@@ -33,7 +33,7 @@
"ML_DEBUG": "true",
"ML_CONFIG_PATH": "storage\\configs\\dev_1_config.json"
},
"applicationUrl": "http://moonlight.owo:5118;https://localhost:7118;http://localhost:5118",
"applicationUrl": "http://moonlight.owo:5118;http://localhost:5118",
"dotnetRunMessages": true
},
"Dev DB 2":
@@ -45,7 +45,7 @@
"ML_DEBUG": "true",
"ML_CONFIG_PATH": "storage\\configs\\dev_2_config.json"
},
"applicationUrl": "http://moonlight.owo:5118;https://localhost:7118;http://localhost:5118",
"applicationUrl": "http://moonlight.owo:5118;http://localhost:5118",
"dotnetRunMessages": true
}
}

View File

@@ -1,8 +0,0 @@
# Some explanations
defaultstorage:
This directory is for the default assets of a Moonlight instance, e.g., Lang files, images, etc.
Storage:
This directory is empty in fresh Moonlight instances and will be populated with an example configuration upon first run. Before using Moonlight, this config file has to be modified. Also, resources are going to be copied from the default storage to this storage. To access files in this storage, we recommend using the Path Builder functions to ensure cross-platform compatibility. The storage directory should be mounted to a specific path when using a Docker container, so when the container is replaced or rebuilt,  your storage will not be modified.

View File

@@ -55,11 +55,14 @@
</div>
}
@if (OAuth2Service.Providers.Any())
{
<div class="separator separator-content my-14">
<span class="w-125px text-gray-500 fw-semibold fs-7">
<TL>Or with email</TL>
</span>
</div>
}
<div class="mt-3 mb-3">
<InputText @bind-Value="LoginData.Email" type="email" placeholder="@(SmartTranslateService.Translate("Email"))" class="form-control bg-transparent"/>

View File

@@ -48,11 +48,14 @@
</div>
}
@if (OAuth2Service.Providers.Any())
{
<div class="separator separator-content my-10">
<span class="w-125px text-gray-500 fw-semibold fs-7">
<TL>Or with email</TL>
</span>
</div>
}
<SmartForm Model="UserRegisterModel" OnValidSubmit="CreateUser">
<div class="fv-row mb-4 fv-plugins-icon-container">

View File

@@ -2,7 +2,7 @@
@using BlazorContextMenu
@using Moonlight.App.Helpers
<div class="table-responsive">
<div class="table-responsive single-color-scrollbar">
<div class="dataTables_scroll">
<div class="dataTables_scrollHead">
<div class="dataTables_scrollHeadInner">

View File

@@ -56,8 +56,8 @@
</a>
<!-- Dropdown Menu -->
<div class="dropdown-menu dropdown-menu-end w-275px py-1" aria-labelledby="dropdownMenuLink">
<div class="dropdown-item py-4 bg-light bg-hover-light">
<div class="dropdown-menu dropdown-menu-end w-275px p-5" aria-labelledby="dropdownMenuLink">
<div class="dropdown-item py-4 bg-body bg-hover-body ps-0">
<div class="d-flex align-items-center">
<img alt="Avatar" src="/api/moonlight/avatar/@(User.Id)" class="rounded-circle me-3" width="50" height="50">
<div class="d-flex flex-column">
@@ -75,8 +75,8 @@
</div>
</div>
<hr class="dropdown-divider">
<a href="/profile" class="dropdown-item py-4">Profile</a>
<a href="#" @onclick:preventDefault @onclick="Logout" class="dropdown-item py-4">Logout</a>
<a href="/profile" class="dropdown-item rounded fs-7 py-4">Profile</a>
<a href="#" @onclick:preventDefault @onclick="Logout" class="dropdown-item rounded fs-7 py-4">Logout</a>
</div>
</div>
}

View File

@@ -1,21 +1,27 @@
@using Moonlight.App.Database.Entities
@using Moonlight.App.Services
@using Moonlight.App.Services.Interop
@inject ServerService ServerService
@inject SmartTranslateService SmartTranslateService
@inject MalwareScanService MalwareScanService
@inject AlertService AlertService
<div class="card">
<div class="card-header">
<span class="card-title">
<TL>Reinstall</TL>
<TL>Actions</TL>
</span>
</div>
<div class="card-footer">
<WButton Text="@(SmartTranslateService.Translate("Reinstall"))"
WorkingText="@(SmartTranslateService.Translate("Reinstalling"))"
CssClasses="btn-warning"
WorkingText="@(SmartTranslateService.Translate("Reinstalling"))" CssClasses="btn-warning"
OnClick="Reinstall">
</WButton>
<WButton Text="@(SmartTranslateService.Translate("Scan for malware"))"
WorkingText="@(SmartTranslateService.Translate("Scanning"))" CssClasses="btn-primary ms-3"
OnClick="Scan">
</WButton>
</div>
</div>
@@ -28,4 +34,14 @@
{
await ServerService.Reinstall(Server!);
}
private async Task Scan()
{
var result = await MalwareScanService.Perform(Server);
if (result == null)
await AlertService.Success(SmartTranslateService.Translate("No malware found on this server"));
else
await AlertService.Warning(result.Title, result.Description);
}
}

View File

@@ -13,7 +13,7 @@
@attribute [PermissionRequired(nameof(Permissions.AdminStatistics))]
<AdminStatisticsNavigation />
<AdminStatisticsNavigation Index="0" />
<div class="row mb-2">
<div class="col-12 col-lg-6 col-xl">

View File

@@ -13,7 +13,7 @@
@attribute [PermissionRequired(nameof(Permissions.AdminStatisticsLive))]
<AdminStatisticsNavigation />
<AdminStatisticsNavigation Index="1" />
<div class="row">
<div class="col-12 col-md-3 mb-3">

380
Moonlight/Startup.cs Normal file
View File

@@ -0,0 +1,380 @@
using BlazorDownloadFile;
using BlazorTable;
using HealthChecks.UI.Client;
using Moonlight.App.ApiClients.CloudPanel;
using Moonlight.App.ApiClients.Daemon;
using Moonlight.App.ApiClients.Modrinth;
using Moonlight.App.ApiClients.Paper;
using Moonlight.App.ApiClients.Telemetry;
using Moonlight.App.ApiClients.Wings;
using Moonlight.App.Database;
using Moonlight.App.Diagnostics.HealthChecks;
using Moonlight.App.Events;
using Moonlight.App.Helpers;
using Moonlight.App.Helpers.Wings;
using Moonlight.App.LogMigrator;
using Moonlight.App.Repositories;
using Moonlight.App.Repositories.Domains;
using Moonlight.App.Repositories.Servers;
using Moonlight.App.Services;
using Moonlight.App.Services.Background;
using Moonlight.App.Services.DiscordBot;
using Moonlight.App.Services.Files;
using Moonlight.App.Services.Interop;
using Moonlight.App.Services.Mail;
using Moonlight.App.Services.Notifications;
using Moonlight.App.Services.Plugins;
using Moonlight.App.Services.Sessions;
using Moonlight.App.Services.Statistics;
using Moonlight.App.Services.Tickets;
using Sentry;
using Serilog;
using Serilog.Events;
using Stripe;
using SubscriptionService = Moonlight.App.Services.SubscriptionService;
namespace Moonlight;
public class Startup
{
// Base services
private StorageService StorageService;
private ConfigService ConfigService;
private DatabaseCheckupService DatabaseCheckupService;
private EventSystem Event;
private LetsEncryptService LetsEncryptService;
private PluginService PluginService;
// Builders
private WebApplicationBuilder WebApplicationBuilder;
private WebApplication WebApplication;
public async Task Init(string[] args)
{
WebApplicationBuilder = WebApplication.CreateBuilder(args);
await PreInitServices();
await SetupLoggers();
Logger.Info("[1/5] Initialized base services and loggers");
await PreInit();
await Configure();
await BuildServices();
WebApplication = WebApplicationBuilder.Build();
await ConfigurePipeline();
Logger.Info("Initialisation complete!");
}
public async Task Start()
{
Logger.Info("Starting moonlight panel");
await StartBackgroundServices();
await PostInit();
Logger.Info("Done. Going live now!");
if (!Uri.TryCreate(ConfigService.Get().Moonlight.AppUrl, UriKind.RelativeOrAbsolute, out Uri uri))
{
Logger.Fatal("Invalid app url");
return;
}
if(ConfigService.DebugMode || uri.HostNameType == UriHostNameType.IPv4 || !ConfigService.Get().Moonlight.LetsEncrypt.Enable)
await WebApplication.RunAsync();
else
await WebApplication.RunAsync(ConfigService.Get().Moonlight.AppUrl);
}
private Task PreInitServices()
{
StorageService = new();
ConfigService = new(StorageService);
DatabaseCheckupService = new(ConfigService);
Event = new();
LetsEncryptService = new(ConfigService, Event);
PluginService = new();
return Task.CompletedTask;
}
private Task StartBackgroundServices()
{
Logger.Info("[1/2] Starting background services");
_ = WebApplication.Services.GetRequiredService<CleanupService>();
_ = WebApplication.Services.GetRequiredService<DiscordBotService>();
_ = WebApplication.Services.GetRequiredService<StatisticsCaptureService>();
_ = WebApplication.Services.GetRequiredService<DiscordNotificationService>();
_ = WebApplication.Services.GetRequiredService<MalwareBackgroundScanService>();
_ = WebApplication.Services.GetRequiredService<TelemetryService>();
_ = WebApplication.Services.GetRequiredService<TempMailService>();
_ = WebApplication.Services.GetRequiredService<DdosProtectionService>();
_ = WebApplication.Services.GetRequiredService<MoonlightService>();
return Task.CompletedTask;
}
private Task PostInit()
{
Logger.Info("[2/2] Started post init tasks");
Task.Run(async () =>
{
await LetsEncryptService.AutoProcess();
});
return Task.CompletedTask;
}
private async Task PreInit()
{
Logger.Info("[2/5] Running pre init tasks");
await StorageService.EnsureCreated();
await DatabaseCheckupService.Perform();
await PluginService.ReloadPlugins();
}
private Task Configure()
{
Logger.Info("[3/5] Configuring kestrel");
WebApplicationBuilder.WebHost.ConfigureKestrel(options =>
{
options.ConfigureHttpsDefaults(httpsOptions =>
{
httpsOptions.ServerCertificateSelector = LetsEncryptService.SelectCertificate;
});
});
WebApplicationBuilder.Services.AddServerSideBlazor()
.AddHubOptions(options =>
{
options.MaximumReceiveMessageSize = 10000000;
options.ClientTimeoutInterval = TimeSpan.FromSeconds(30);
options.HandshakeTimeout = TimeSpan.FromSeconds(10);
});
WebApplicationBuilder.Services.AddHttpContextAccessor();
WebApplicationBuilder.Services.AddRazorPages();
WebApplicationBuilder.Services.AddHealthChecks()
.AddCheck<DatabaseHealthCheck>("Database")
.AddCheck<NodeHealthCheck>("Nodes")
.AddCheck<DaemonHealthCheck>("Daemons");
if (ConfigService.Get().Moonlight.Sentry.Enable)
{
WebApplicationBuilder.WebHost.UseSentry(options =>
{
options.Dsn = ConfigService
.Get()
.Moonlight.Sentry.Dsn;
options.Debug = ConfigService.DebugMode;
options.DiagnosticLevel = SentryLevel.Warning;
options.TracesSampleRate = 1.0;
options.DiagnosticLogger = new SentryDiagnosticsLogger(SentryLevel.Warning);
});
}
StripeConfiguration.ApiKey = ConfigService
.Get()
.Moonlight.Stripe.ApiKey;
return Task.CompletedTask;
}
private async Task BuildServices()
{
Logger.Info("[4/5] Building services");
await BuildSingletonServices();
await BuildScopedServices();
// Third party services
WebApplicationBuilder.Services.AddBlazorTable();
WebApplicationBuilder.Services.AddBlazorContextMenu();
WebApplicationBuilder.Services.AddBlazorDownloadFile();
await PluginService.BuildServices(WebApplicationBuilder.Services);
}
private Task BuildScopedServices()
{
// Databases
WebApplicationBuilder.Services.AddDbContext<DataContext>();
// Repositories
WebApplicationBuilder.Services.AddScoped<UserRepository>();
WebApplicationBuilder.Services.AddScoped<NodeRepository>();
WebApplicationBuilder.Services.AddScoped<ServerRepository>();
WebApplicationBuilder.Services.AddScoped<ServerBackupRepository>();
WebApplicationBuilder.Services.AddScoped<ImageRepository>();
WebApplicationBuilder.Services.AddScoped<DomainRepository>();
WebApplicationBuilder.Services.AddScoped<SharedDomainRepository>();
WebApplicationBuilder.Services.AddScoped<RevokeRepository>();
WebApplicationBuilder.Services.AddScoped<NotificationRepository>();
WebApplicationBuilder.Services.AddScoped<DdosAttackRepository>();
WebApplicationBuilder.Services.AddScoped<SubscriptionRepository>();
WebApplicationBuilder.Services.AddScoped<LoadingMessageRepository>();
WebApplicationBuilder.Services.AddScoped<NewsEntryRepository>();
WebApplicationBuilder.Services.AddScoped<NodeAllocationRepository>();
WebApplicationBuilder.Services.AddScoped<StatisticsRepository>();
WebApplicationBuilder.Services.AddScoped(typeof(Repository<>));
// Js interopt and session stuff
WebApplicationBuilder.Services.AddScoped<CookieService>();
WebApplicationBuilder.Services.AddScoped<IdentityService>();
WebApplicationBuilder.Services.AddScoped<IpLocateService>();
WebApplicationBuilder.Services.AddScoped<AlertService>();
WebApplicationBuilder.Services.AddScoped<ClipboardService>();
WebApplicationBuilder.Services.AddScoped<ModalService>();
WebApplicationBuilder.Services.AddScoped<FileDownloadService>();
WebApplicationBuilder.Services.AddScoped<KeyListenerService>();
WebApplicationBuilder.Services.AddScoped<PopupService>();
WebApplicationBuilder.Services.AddScoped<SessionClientService>();
WebApplicationBuilder.Services.AddScoped<ReCaptchaService>();
WebApplicationBuilder.Services.AddScoped<DynamicBackgroundService>();
// Main application stuff
WebApplicationBuilder.Services.AddScoped<SmartTranslateService>();
WebApplicationBuilder.Services.AddScoped<UserService>();
WebApplicationBuilder.Services.AddScoped<TotpService>();
WebApplicationBuilder.Services.AddScoped<ToastService>();
WebApplicationBuilder.Services.AddScoped<NodeService>();
WebApplicationBuilder.Services.AddScoped<ServerService>();
WebApplicationBuilder.Services.AddScoped<DomainService>();
WebApplicationBuilder.Services.AddScoped<OneTimeJwtService>();
WebApplicationBuilder.Services.AddScoped<NotificationAdminService>();
WebApplicationBuilder.Services.AddScoped<SmartDeployService>();
WebApplicationBuilder.Services.AddScoped<WebSpaceService>();
WebApplicationBuilder.Services.AddScoped<StatisticsViewService>();
WebApplicationBuilder.Services.AddScoped<RatingService>();
WebApplicationBuilder.Services.AddScoped<IpBanService>();
WebApplicationBuilder.Services.AddScoped<SubscriptionService>();
WebApplicationBuilder.Services.AddScoped<BillingService>();
WebApplicationBuilder.Services.AddScoped<TicketClientService>();
WebApplicationBuilder.Services.AddScoped<TicketAdminService>();
WebApplicationBuilder.Services.AddScoped<MalwareScanService>();
WebApplicationBuilder.Services.AddScoped<MailService>();
WebApplicationBuilder.Services.AddScoped<WingsServerConverter>();
WebApplicationBuilder.Services.AddScoped<WingsConsoleHelper>();
return Task.CompletedTask;
}
private Task BuildSingletonServices()
{
WebApplicationBuilder.Services.AddSingleton(ConfigService);
WebApplicationBuilder.Services.AddSingleton(Event);
WebApplicationBuilder.Services.AddSingleton(PluginService);
WebApplicationBuilder.Services.AddSingleton<StorageService>();
// Api helpers
WebApplicationBuilder.Services.AddSingleton<PaperApiHelper>();
WebApplicationBuilder.Services.AddSingleton<DaemonApiHelper>();
WebApplicationBuilder.Services.AddSingleton<CloudPanelApiHelper>();
WebApplicationBuilder.Services.AddSingleton<ModrinthApiHelper>();
WebApplicationBuilder.Services.AddSingleton<TelemetryApiHelper>();
WebApplicationBuilder.Services.AddSingleton<WingsApiHelper>();
// Main application stuff
WebApplicationBuilder.Services.AddSingleton<HostSystemHelper>();
WebApplicationBuilder.Services.AddSingleton<OAuth2Service>();
WebApplicationBuilder.Services.AddSingleton<PluginStoreService>();
WebApplicationBuilder.Services.AddSingleton<TicketServerService>();
WebApplicationBuilder.Services.AddSingleton<IpVerificationService>();
WebApplicationBuilder.Services.AddSingleton<NotificationServerService>();
WebApplicationBuilder.Services.AddSingleton<DateTimeService>();
WebApplicationBuilder.Services.AddSingleton<MoonlightService>();
WebApplicationBuilder.Services.AddSingleton<ResourceService>();
WebApplicationBuilder.Services.AddSingleton<BucketService>();
// Helpers
WebApplicationBuilder.Services.AddSingleton<SmartTranslateHelper>();
WebApplicationBuilder.Services.AddSingleton<WingsJwtHelper>();
// Background services
WebApplicationBuilder.Services.AddSingleton<DiscordBotService>();
WebApplicationBuilder.Services.AddSingleton<StatisticsCaptureService>();
WebApplicationBuilder.Services.AddSingleton<DiscordNotificationService>();
WebApplicationBuilder.Services.AddSingleton<CleanupService>();
WebApplicationBuilder.Services.AddSingleton<MalwareBackgroundScanService>();
WebApplicationBuilder.Services.AddSingleton<TelemetryService>();
WebApplicationBuilder.Services.AddSingleton<TempMailService>();
WebApplicationBuilder.Services.AddSingleton<DdosProtectionService>();
WebApplicationBuilder.Services.AddSingleton<SessionServerService>();
return Task.CompletedTask;
}
private Task SetupLoggers()
{
var logConfig = new LoggerConfiguration();
if (ConfigService.DebugMode)
logConfig = logConfig.MinimumLevel.Verbose();
else
logConfig = logConfig.MinimumLevel.Information();
if (ConfigService.Get().Moonlight.Sentry.Enable)
{
if (ConfigService.DebugMode)
{
logConfig = logConfig.WriteTo.Sentry(options =>
{
options.MinimumBreadcrumbLevel = LogEventLevel.Debug;
options.MinimumEventLevel = LogEventLevel.Warning;
});
}
else
{
logConfig = logConfig.WriteTo.Sentry(options =>
{
options.MinimumBreadcrumbLevel = LogEventLevel.Information;
options.MinimumEventLevel = LogEventLevel.Warning;
});
}
}
logConfig = logConfig.Enrich.FromLogContext()
.WriteTo.Console(
outputTemplate:
"{Timestamp:HH:mm:ss} [{Level:u3}] {SourceContext} {Message:lj}{NewLine}{Exception}")
.WriteTo.File(PathBuilder.File("storage", "logs", $"{DateTime.UtcNow:yyyy-MM-dd}.log"));
Log.Logger = logConfig.CreateLogger();
WebApplicationBuilder.Logging.ClearProviders();
WebApplicationBuilder.Logging.AddProvider(new LogMigratorProvider());
return Task.CompletedTask;
}
private Task ConfigurePipeline()
{
Logger.Info("[5/5] Configuring pipeline");
if (!WebApplication.Environment.IsDevelopment())
{
WebApplication.UseExceptionHandler("/Error");
}
// Sentry
if (ConfigService.Get().Moonlight.Sentry.Enable)
{
WebApplication.UseSentryTracing();
}
WebApplication.UseStaticFiles();
WebApplication.UseRouting();
WebApplication.UseWebSockets();
WebApplication.MapControllers();
WebApplication.MapBlazorHub();
WebApplication.MapFallbackToPage("/_Host");
WebApplication.MapHealthChecks("/_health", new()
{
ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
});
return Task.CompletedTask;
}
}

View File

@@ -64,9 +64,14 @@
}
::-webkit-scrollbar-thumb {
background-image: -webkit-gradient(linear, left bottom, left top, color-stop(.5, #a520ca), color-stop(1, #2681cc));
}
.single-color-scrollbar::-webkit-scrollbar-thumb {
background: #6964E4;
}
::-webkit-scrollbar-thumb:hover {
.single-color-scrollbar::-webkit-scrollbar-thumb:hover {
background: #6964E4;
}

View File

@@ -292,6 +292,20 @@
},
showNotification: function (title, text, img) {
let notification = new Notification(title, {body: text, icon: img});
},
getWebDriverStatus: function () {
if (navigator.webdriver)
return true;
else
return false;
},
getLanguagesStatus: function()
{
if (!navigator.languages || navigator.languages.length === 0) {
return false;
} else {
return true;
}
}
},
loading: {
@@ -317,17 +331,15 @@
checkConnection: async function (url, threshold) {
const start = performance.now();
try
{
try {
const response = await fetch(url, {mode: 'no-cors'});
const latency = performance.now() - start;
if (latency > threshold)
{
if (latency > threshold) {
moonlight.toasts.warning(`High latency detected: ${latency}ms. Moonlight might feel laggy. Please check your internet connection`);
}
} catch (error) {
}
catch (error) {}
}
},
flashbang: {

View File

@@ -1,37 +1,41 @@
<br/>
<center>
<p align="center">
  <a href="https://github.com/Moonlight-Panel/Moonlight">
    <img src="https://my.endelon-hosting.de/api/moonlight/resources/images/logo.svg" alt="Logo" width="80" height="80">
  </a>
<a href="https://github.com/Moonlight-Panel/Moonlight">
<img src="https://raw.githubusercontent.com/Moonlight-Panel/Resources/main/public/images/logo.svg" alt="Logo" width="80" height="80">
</a>
  <h3 align="center">Moonlight</h3>
<h3 align="center">Moonlight Panel</h3>
  <p align="center">
    The next generation hosting panel
    <br/>
    <br/>
    <a href="https://github.com/Moonlight-Panel/Moonlight/issues">Report Bug</a>
    .
    <a href="https://github.com/Moonlight-Panel/Moonlight/issues">Request Feature</a>
  </p>
<p align="center">
The next generation hosting panel
</p>
</p>
> [!IMPORTANT]
> Moonlight is currently in the process of being rewritten to be more modular and more focused on the users needs. If you want to learn more, have a look [here](https://github.com/Moonlight-Panel/Moonlight/tree/v2)
![Contributors](https://img.shields.io/github/contributors/Moonlight-Panel/Moonlight?color=dark-green) ![Stargazers](https://img.shields.io/github/stars/Moonlight-Panel/Moonlight?style=social) ![Issues](https://img.shields.io/github/issues/Moonlight-Panel/Moonlight)
## About The Project
![Screen Shot](https://media.discordapp.net/attachments/1059911407170228234/1119793539732217876/image.png?width=1340&height=671)
</center>
Moonlight is a new free and open-source alternative to Pterodactyl, allowing users to create their own hosting platform and host all sorts of game servers in Docker containers. With a simple migration from pterodactyl to moonlight ([see guide](https://docs.moonlightpanel.xyz/migrating-from-pterodactyl)) you can easily switch to moonlight and use its features like a server manager, cleanup system, and automatic version switcher, just to name a few.
Moonlight is a new free and open-source alternative to Pterodactyl,
allowing users to create their own hosting platform and host all sorts of game servers in Docker containers.
The moonlight panel was originaly developed for Endelon Hosting and has been split into a independent project.
The goal of moonlight is to provide an all in one solution for hosting businesses and communities for selling, hosting and
using varios services like webspaces, subdomains and docker based servers
If you have any questions or want to chat with us, feel free to join our discord
[https://discord.gg/TJaspT7A8p](https://discord.gg/TJaspT7A8p)
Moonlight's core features are
* Hosting game servers using Wings and Docker
* Creating and managing webspaces using the CloudPanel based web hosting solution
* Adding your domains as shared domains and providing subdomains for users with them
* Live support chat
* Subscription system (sell pass integration WIP)
* Live ticket system
* Subscription system
* Statistics
* and many more
@@ -61,7 +65,7 @@ A full guide on how to install moonlight can be found here:
[https://docs.moonlightpanel.xyz/installing-moonlight](https://docs.moonlightpanel.xyz/installing-moonlight)
Quick installer/updater:
`curl https://install.moonlightpanel.xyz/install > install.sh; bash install.sh`
`curl https://install.moonlightpanel.xyz/installer > install.sh; bash install.sh`
You'd need to select what to install: The Panel, Wings or the daemon
Having any issues?
@@ -96,10 +100,10 @@ Distributed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0
* **Marcel Baumgartner** - *Endelon Hosting* - [Marcel Baumgartner](https://github.com/Marcel-Baumgartner) - *Moonlights core system & frontend*
* **Daniel Balk** - *Endelon Hosting* - [Daniel Balk](https://github.com/Daniel-Balk) - *Notification system & frontend*
* **Spielepapagei** - *Endelon Hosting* - [Spielepapagei](https://github.com/Spielepapagei) - *Discord Bot & support tickets*
* **Dannyx** - *None* - [Dannyx](https://github.com/Dannyx1604) - *Grammer check and translations*
* **Dannyx** - *None* - [Dannyx](https://github.com/Dannyx1604) - *Grammar check and translations*
## Some screenshots
Only user area
Only user area (outdated)
![Screen Shot](https://cdn.discordapp.com/attachments/1059911407170228234/1121635286443634768/dashboard.png)
![Screen Shot](https://cdn.discordapp.com/attachments/1059911407170228234/1121635662475571261/serverlist_.png)