Skip to content

Commit

Permalink
Merge pull request #231 from Light-Beacon/nxtverbuilder
Browse files Browse the repository at this point in the history
Nxtverbuilder
  • Loading branch information
Light-Beacon authored Nov 21, 2024
2 parents 568a2e4 + 85779b5 commit b7c29cc
Show file tree
Hide file tree
Showing 302 changed files with 89 additions and 69 deletions.
9 changes: 7 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
/.vscode
/Config
/Cache
*/cache
.cache
*/Private
private.*
__pycache__
.DS_Store
Log
private.*
private.*
output/
Private/
output.xaml
5 changes: 5 additions & 0 deletions Actions/check_mcv.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,13 @@ def main():
#print(f'● 最新 {latest_release_type} 版: {latest_release_id}')
#print(f'● 最新 {latest_snapshot_type} 版: {latest_snapshot_id}')

<<<<<<< HEAD
dir_location = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
version_lib_location = f'{dir_location}{os.sep}Project{os.sep}Libraries{os.sep}Versions{os.sep}'
=======
dir_location = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
version_lib_location = f'{dir_location}{os.sep}Libraries{os.sep}Versions{os.sep}'
>>>>>>> main

release_require_update,latest_release_act = \
update_library(version_mainfest,version_lib_location,
Expand Down
5 changes: 0 additions & 5 deletions Libraries/__LIBRARY__.yml

This file was deleted.

39 changes: 0 additions & 39 deletions Modules/VersionLists.py

This file was deleted.

File renamed without changes.
3 changes: 3 additions & 0 deletions Project/configs/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Server.Update.GitHub.Webhook.Enable: True
Public.domain: news.bugjump.net
Server.Version.By: githash
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<local:MyTextBox x:Name="jumpbox" Height="30" />
<local:MyButton HorizontalAlignment="Center" Width="80"
Grid.Column="1" Text="打开→" EventType="打开帮助"
EventData="{Binding Path=Text,ElementName=jumpbox,StringFormat=https://news.bugjump.net/{0}.json}"/>
EventData="{Binding Path=Text,ElementName=jumpbox,StringFormat=https://${domain}/{0}.json}"/>
</Grid>
</StackPanel>
</local:MyCard>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<local:MyTextBox x:Name="toverbox" Height="30" />
<local:MyButton HorizontalAlignment="Center" Width="80"
Grid.Column="1" Text="打开→" EventType="打开帮助"
EventData="{Binding Path=Text,ElementName=toverbox,StringFormat=https://news.bugjump.net/VersionDetail.json?ver={0}}"/>
EventData="{Binding Path=Text,ElementName=toverbox,StringFormat=https://${domain}/VersionDetail.json?ver={0}}"/>
</Grid>
</StackPanel>
</local:MyCard>
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</local:MyComboBox>
<local:MyButton HorizontalAlignment="Center" Width="80"
Grid.Column="1" Text="打开→" EventType="打开帮助"
EventData="{Binding Path=Text,ElementName=jumpbox,StringFormat=https://news.bugjump.net/{0}.json}"/>
EventData="{Binding Path=Text,ElementName=jumpbox,StringFormat=https://${domain}/{0}.json}"/>
</Grid>
</StackPanel>
</local:MyCard>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions Project/libraries/__LIBRARY__.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: rootlibrary
fill:
canswap: true
s: true
isswaped: ${s}
domain: ${@PublicConf|domain|news.bugjump.net}
9 changes: 5 additions & 4 deletions Modules/APIs.py → Project/modules/APIs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from Interfaces import page_class_handles, PageBase, require, format_code
from homepagebuilder.interfaces import page_class_handles, require
from homepagebuilder.core.page import CodeBasedPage
import json

def get_args(kwargs):
Expand All @@ -10,7 +11,7 @@ def is_true(string:str):
return string and isinstance(string,str) and string.lower() != 'false'

@page_class_handles('apis/status')
class StatusPage(PageBase):
class StatusPage(CodeBasedPage):

@property
def display_name(self):
Expand All @@ -26,7 +27,7 @@ def get_content_type(self, setter):
latest_version = mcv.get_latest()

@page_class_handles('apis/versions/latest')
class LatestVersionAPI(PageBase):
class LatestVersionAPI(CodeBasedPage):

def __init__(self, project):
super().__init__(project)
Expand Down Expand Up @@ -77,7 +78,7 @@ def get_content_type(self, setter):
return 'application/json'

@page_class_handles('apis/versions/latest-card')
class LatestVersionCardAPI(PageBase):
class LatestVersionCardAPI(CodeBasedPage):
def generate(self, *args, **kwargs):
setter = kwargs.get('setter')
card = self.project.base_library.get_card('VersionLatestListCard', False)
Expand Down
9 changes: 9 additions & 0 deletions Project/modules/CheckDomainSafety.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from homepagebuilder.interfaces import config
from homepagebuilder.interfaces.Events import on, ResultOverride

@on('page.generate.start')
def script(_page,context):
if context.setter:
if mod_domain := context.setter.override.get('domain'):
if mod_domain not in config('safe_domains',['news.bugjump.net']):
raise ResultOverride('')
10 changes: 5 additions & 5 deletions Modules/GetLink.py → Project/modules/GetLink.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import re
from Interfaces import script
from homepagebuilder.interfaces import script
from homepagebuilder.core.formatter import format_code

SNAPSHOT_PATTERN = re.compile(r'^[0-9]{2}[w|W][0-9]{2}[A-Fa-f]$')
PRE_RELEASE_PATTERN = re.compile(r'^.*-pre[0-9]+$')
Expand All @@ -23,15 +24,14 @@ def gen_official_link(vid:str):
@script('GetLink')
def get_link(link_type,link_key=None,**kwargs):
card = kwargs['card']
res = kwargs['res']
context = kwargs['context']
name:str = card['version-id']
if card.get('not_finished') == 'true' and link_type != 'Official':
return ''
data = res.data[f'{link_type}Link']
data = context.data[f'{link_type}Link']
if link_key:
return data[link_key]
if '${' in name:
raise KeyError()
name = format_code(name,card,context)
if link_type == 'Official' and name not in data:
return gen_official_link(name)
result = data.get(name)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from Interfaces import script,require,Logger
from homepagebuilder.interfaces import script,require,Logger

mcv = require('MinecraftVersions') # 需求前置 MinecraftVersions
latest_version = mcv.get_latest()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from Interfaces import Logger
from homepagebuilder.interfaces import Logger
import requests
import json
import re
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from Interfaces import script
from homepagebuilder.interfaces import script

@script('SeparatorContent')
def script(card,**_):
Expand Down
4 changes: 2 additions & 2 deletions Modules/ServerJar.py → Project/modules/ServerJar.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from Interfaces import invoke,require,script
from homepagebuilder.interfaces import require,script

mcv = require('MinecraftVersions') # 需求前置 MinecraftVersions
get_server_jar = mcv.get_server_jar

@script('ServerJar')
def script(card,**_):
def get_server_jar_script(card,**_):
return get_server_jar(card['version-id'])
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
from Core.project import Project
from Interfaces import script,require
from homepagebuilder.interfaces import script,require

mcv = require('MinecraftVersions') # 需求前置 MinecraftVersions
MANIFSET = mcv.get_manifset()
FULL_VERSIONS = MANIFSET.get('versions')
ID_LIST = [version.get('id') for version in FULL_VERSIONS]

@script('VersionCategory')
def version_category(cat_name,proj:Project,**_):
def version_category(cat_name,context,**_):
cards = list(filter(lambda card:isinstance(card.get('cats'),list)
and cat_name in card.get('cats'), proj.get_all_card()))
and cat_name in card.get('cats'), context.project.get_all_card()))
cardrefs = [card['card_id'] for card in cards]
cardrefs.sort(key=lambda ver:ID_LIST.index(ver.split(':')[1]))
return str.join(';',cardrefs)
36 changes: 36 additions & 0 deletions Project/modules/VersionLists.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from homepagebuilder.interfaces import require,script,format_code

mcv = require('MinecraftVersions') # 需求前置 MinecraftVersions
MANIFSET = mcv.get_manifset()
FULL_VERSIONS = MANIFSET.get('versions')
ID_LIST = [version.get('id') for version in FULL_VERSIONS]

@script('VersionArchiveList')
def version_achive_list(cat_name,context,card,**_):
components = context.components
cat_name = format_code(code = cat_name,data=card,context=context)
cards = list(filter(lambda card:isinstance(card.get('cats'),list)
and cat_name in card.get('cats'), context.get('project').get_all_card()))
code = '<StackPanel Margin="8,2,8,15">'
cards.sort(key=lambda card:ID_LIST.index(format_code(card['version-id'],
data=card,context=context)))
if len(cards) > 0 and cards[0]['version-type-id'] not in ['Release','April-Fools']:
code += components['VersionLinks/Future'].toxaml(card={},context=context)
for vercard in cards:
if vercard.get('lack'):
code += components['VersionLinks/Lack'].toxaml(card=vercard,context=context)
else:
code += components['VersionLinks/Common'].toxaml(card=vercard,context=context)
code += '</StackPanel>'
return code

@script('VersionLatestList')
def version_latest_list(context,**_):
proj = context.get('project')
components = context.get('components')
code = ''
for version_type in ['release','snapshot']:
if latest_version := mcv.get_latest(version_type):
vercard = proj.base_library.get_card(latest_version,False)
code += components['VersionLinks/Latest'].toxaml(card=vercard,context=context)
return code
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<local:MyListItem Margin="${@IF|${important-version}|10,1,10,1|40,1,10,1}" ToolTip="${version-type} 点击查看该版本更新日志"
Logo="${list-icon}" Title="${version-id}" Info="${@IF|${intro}|${intro}|${version-type}}"
EventType="打开帮助" EventData="https://news.bugjump.net/VersionDetail.json?ver=${version-id}" Type="Clickable" />
EventType="打开帮助" EventData="https://${domain}/VersionDetail.json?ver=${version-id}" Type="Clickable" />
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<local:MyListItem Margin="10,1,10,1" ToolTip="最新${version-type} 点击查看该版本更新日志"
Logo="${list-icon}" Title="最新${version-type} - ${version-id}" Info="${@IF|${intro}|${intro}|${version-type}}"
EventType="打开帮助" EventData="https://news.bugjump.net/VersionDetail.json?ver=${version-id}" Type="Clickable" />
EventType="打开帮助" EventData="https://${domain}/VersionDetail.json?ver=${version-id}" Type="Clickable" />
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit b7c29cc

Please sign in to comment.