Skip to content

Commit

Permalink
loader: basic classes
Browse files Browse the repository at this point in the history
  • Loading branch information
PeratX committed Sep 17, 2020
1 parent af0f863 commit 98d613d
Show file tree
Hide file tree
Showing 12 changed files with 954 additions and 52 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.idea
.gradle
build
out
661 changes: 661 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

121 changes: 69 additions & 52 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,69 @@
# Mirai Console Loader

## 技术路线

* 主要程序架构采用`Kotlin`编写,实现功能,比如连接更新服务器下载
* 具体逻辑实现采用`JavaScript`编写,实现逻辑,比如自定义启动参数,切换下载源,加载前置包等等

## 具体功能

* 下载和更新服务,支持channel
* 加载JAR进根ClassLoader
* 还有更多

## 下载服务架构

* 总体沿用现在的`mirai-repo`结构
```
mirai-console
|---mirai-console-1.0.0.jar
|---mirai-console-1.0.0.md5
mirai-console-pure
mirai-core-android
packages.json
```
`packages.json`内容
```JSON
{
"mirai-console": {
"name": "Mirai Console",
"description": "Mirai Console后端"
},
"mirai-console-pure": {
"name": "Mirai Console Pure",
"description": "Mirai Console Pure前端实现"
}
}
```

* 添加`package.json`

```JSON
{
"name": "mirai-console",
"channels": {
"stable": ["1.0.0"],
"beta": ["1.0-M4"],
"nightly": ["1.0-M4-dev3"]
}
}
```

* 添加`md5`校验码
# Mirai Console Loader

## 技术路线

* 主要程序架构采用`Java`编写,实现功能,比如连接更新服务器下载
* 具体逻辑实现采用`JavaScript`编写,实现逻辑,比如自定义启动参数,切换下载源,加载前置包等等

## 具体功能

* 下载和更新服务,支持channel
* 加载JAR进根ClassLoader
* 还有更多

## 下载服务架构

* 总体沿用现在的`mirai-repo`结构
```
mirai-console
|---mirai-console-1.0.0.jar
|---mirai-console-1.0.0.md5
mirai-console-pure
mirai-core-android
packages.json
```
`packages.json`内容
```JSON
{
"mirai-console": {
"name": "Mirai Console",
"description": "Mirai Console后端"
},
"mirai-console-pure": {
"name": "Mirai Console Pure",
"description": "Mirai Console Pure前端实现"
}
}
```

* 添加`package.json`

```JSON
{
"name": "mirai-console",
"channels": {
"stable": ["1.0.0"],
"beta": ["1.0-M4"],
"nightly": ["1.0-M4-dev3"]
}
}
```

* 添加`md5`校验码

## 开源许可证

Copyright (C) 2020 iTX Technologies

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
26 changes: 26 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
plugins {
id 'java'
}

group 'org.itxtech'
version '1.0.0-alpha.1'

repositories {
mavenCentral()
}

dependencies {
implementation("org.mozilla:rhino:1.7.13")
implementation("commons-cli:commons-cli:1.4")
implementation("com.google.code.gson:gson:2.8.6")
}

jar {
manifest {
attributes "Main-Class": "org.itxtech.mcl.Loader"
}

from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
}
2 changes: 2 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
rootProject.name = 'mirai-console-loader'

30 changes: 30 additions & 0 deletions src/main/java/org/itxtech/mcl/Loader.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package org.itxtech.mcl;

/*
*
* Mirai Console Loader
*
* Copyright (C) 2020 iTX Technologies
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author PeratX
* @website https://github.com/iTXTech/mirai-console-loader
*
*/
public class Loader {
public static void main(String[] args) {

}
}
27 changes: 27 additions & 0 deletions src/main/java/org/itxtech/mcl/component/DefaultDownloader.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package org.itxtech.mcl.component;

/*
*
* Mirai Console Loader
*
* Copyright (C) 2020 iTX Technologies
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author PeratX
* @website https://github.com/iTXTech/mirai-console-loader
*
*/
public class DefaultDownloader implements Downloader {
}
27 changes: 27 additions & 0 deletions src/main/java/org/itxtech/mcl/component/DefaultLogger.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package org.itxtech.mcl.component;

/*
*
* Mirai Console Loader
*
* Copyright (C) 2020 iTX Technologies
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author PeratX
* @website https://github.com/iTXTech/mirai-console-loader
*
*/
public class DefaultLogger implements Logger {
}
27 changes: 27 additions & 0 deletions src/main/java/org/itxtech/mcl/component/Downloader.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package org.itxtech.mcl.component;

/*
*
* Mirai Console Loader
*
* Copyright (C) 2020 iTX Technologies
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author PeratX
* @website https://github.com/iTXTech/mirai-console-loader
*
*/
public interface Downloader {
}
27 changes: 27 additions & 0 deletions src/main/java/org/itxtech/mcl/component/Logger.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package org.itxtech.mcl.component;

/*
*
* Mirai Console Loader
*
* Copyright (C) 2020 iTX Technologies
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author PeratX
* @website https://github.com/iTXTech/mirai-console-loader
*
*/
public interface Logger {
}
27 changes: 27 additions & 0 deletions src/main/java/org/itxtech/mcl/script/Script.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package org.itxtech.mcl.script;

/*
*
* Mirai Console Loader
*
* Copyright (C) 2020 iTX Technologies
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author PeratX
* @website https://github.com/iTXTech/mirai-console-loader
*
*/
public class Script {
}
27 changes: 27 additions & 0 deletions src/main/java/org/itxtech/mcl/script/ScriptManager.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package org.itxtech.mcl.script;

/*
*
* Mirai Console Loader
*
* Copyright (C) 2020 iTX Technologies
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author PeratX
* @website https://github.com/iTXTech/mirai-console-loader
*
*/
public class ScriptManager {
}

0 comments on commit 98d613d

Please sign in to comment.