Skip to content

Commit

Permalink
added new bulletin generator, updated cc info
Browse files Browse the repository at this point in the history
  • Loading branch information
ItziSpyder committed Sep 1, 2024
1 parent 97c08f8 commit ef642d3
Show file tree
Hide file tree
Showing 6 changed files with 173 additions and 4 deletions.
23 changes: 22 additions & 1 deletion cclive/js/downloads.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@

const CURSEFORGE = 'https://api.curse.tools/v1/cf/mods/946253';
const CF_KEY = '$2a$10$Sfn.ovCOUBg24FD1sBI/fe2cuWc2p/o6o7tVpWtNcnfDcyfjaqxTC';
// this api key is provided by @Josh and is for public use
// no worries if it is leaked

const CURSEFORGE = 'https://api.curseforge.com/v1/mods/946253';
const CURSEFORGE_2 = 'https://api.curse.tools/v1/cf/mods/946253';
const MODRINTH = 'https://api.modrinth.com/v2/project/clickcrystals';
const GITHUB = 'https://api.github.com/repos/clickcrystals-development/ClickCrystals/releases';
const PLANETMC = 'https://www.planetminecraft.com/mod/clickcrystal';
Expand All @@ -24,6 +29,22 @@ function getDownloads() {
}

async function getCurseForge(done) {
fetch(CURSEFORGE, {
method: 'GET',
headers: {
Accept: 'application/json',
'X-API-Key': CF_KEY
}
})
.then(res => res.json())
.then(res => {
dlsCurseForge = res.data.downloadCount;
console.log(dlsCurseForge);
done();
})
}

async function getCurseForge2(done) {
fetch(CURSEFORGE, headers)
.then(res => res.json())
.then(res => {
Expand Down
3 changes: 2 additions & 1 deletion clickcrystals/bulletin.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
{"title": "Release 1.2.5", "desc": "1.21 SUPPORT! New UPDATE!", "fields": [{"title": "Fresh Animations!", "desc": "GUI now animates in and out, along with many other widgets."}, {"title": "New Module", "desc": "SelfGlow by I-No-One"}, {"title": "Scripting Syntax", "desc": "Added new scripts, hotbar hotkeys now possible! Also key inputs and detections are also now possible!"}, {"title": "And much more!", "desc": "Download 1.2.5 for Minecraft Versions 1.20-1.21 NOW!"}]},
{"title": "&bRelease 1.2.6", "desc": "Script entity referencing!", "fields": [{"title": "WIKI HAS BEEN UPDATED", "desc": "Tons of conditions and a few commands to make script experience smoother."}, {"title": "&fEntity referencing!", "desc": "You can now check other player's or entity's armor or held items, and a lot more!"}]},
{"title":"Release 1.2.7","desc":"New Modules, New Script Commands, Script Patches! Find better bypasses with on pre_tick, on post_tick, and on tick!","fields":[{"title":"Patches","desc":"Patched entity_in_range not working and block ID selections with commas not working properly"},{"title":"Scripting","desc":"added script command if entity pos, increased the range for entity selection from 32 to 128, added on post_tick and on pre_tick"},{"title":"New Modules","desc":"Modules Teams, Freelook, and AutoDisconnect by I-No-One!"}]},
{"title":"ClickCrystals Updater Is Out!","desc":"The ClickCrystals team has just launched a new repository for updating ClickCrystals. Check it out at the link below.","fields":[{"title":"&bRepository Info","desc":"This repository is dedicated to managing updates for ClickCrystals. The project is open-source, and everything just in one class! You can find all the necessary files, including the latest updates and patches, in the repository."},{"title":"&rCool Mod that:","desc":"Automated update checks and download (if needed) ClickCrystals"},{"title":"&bDownload Today!","desc":"https://github.com/clickcrystals-development/ClickCrystals-Updater"}]}
{"title":"ClickCrystals Updater Is Out!","desc":"The ClickCrystals team has just launched a new repository for updating ClickCrystals. Check it out at the link below.","fields":[{"title":"&bRepository Info","desc":"This repository is dedicated to managing updates for ClickCrystals. The project is open-source, and everything just in one class! You can find all the necessary files, including the latest updates and patches, in the repository."},{"title":"&rCool Mod that:","desc":"Automated update checks and download (if needed) ClickCrystals"},{"title":"&bDownload Today!","desc":"https://github.com/clickcrystals-development/ClickCrystals-Updater"}]},
{"title":"Release 1.2.8","desc":"Check out the new release 1.2.8!","fields":[{"title":"Scripting","desc":"if hunger, if jumping"},{"title":"Patches","desc":"fix while cmd not working when scheduled under wait cmd, fix online scripts and online configs downtime, fix hand swing on team detector module # i no one, fix auto disconnect players in render distance check # i no one"},{"title":"GUI","desc":"new online scripts screen"},{"title":"Add","desc":"setting to disable loading screen, setting to disable modules from printing in chat, mod menu integration and an option to disable it in advanced settings # i no one"}]}
]
}

Expand Down
4 changes: 2 additions & 2 deletions clickcrystals/info.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"latest": "1.2.7",
"motd": "Update 1.2.7, New Modules, New Script Commands, Script Patches! Find better bypasses with on pre_tick, on post_tick, and on tick!",
"latest": "1.2.8",
"motd": "&bCheck out the new update 1.2.8, new online script screen. Custom loading screen disabler, and mod menu integration!",

"versionMappings": {
"1.21": "1.21",
Expand Down
26 changes: 26 additions & 0 deletions clickcrystals/tools/bulletin2.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ClickCrystals | Bulletin2</title>
<link rel="stylesheet" href="./bulletin2/css/bulletin2.css">
<link rel="shortcut icon" href="../assets/clickcrystals.png" type="image/x-icon">
</head>
<body class="main">
<script src="../../common/toolsbg.js"></script>

<h1>ClickCrystals Bulletin Generator v2</h1>
<div class="textareas">
<div class="text">
<h3>Input: Markdown</h3>
<textarea name="" id="input"></textarea>
</div>
<div class="text">
<h3>Output: JSON</h3>
<textarea name="" id="output"></textarea>
</div>
</div>
</body>
<script src="./bulletin2/js/bulletin2.js"></script>
</html>
46 changes: 46 additions & 0 deletions clickcrystals/tools/bulletin2/css/bulletin2.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
body {
background-color: black;
margin: 0;
padding: 0;

color: white;

font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

h1 {
text-align: center;
margin-top: 50px;
}

.textareas {
width: fit-content;
margin: auto;
margin-top: 20px;
}
#output {
background-color: rgb(45, 44, 44);
color: white;
font-family: 'Courier New', Courier, monospace;
}
#input {
background-color: rgb(215, 209, 209);
color: black;
font-size: 17px;
}

textarea {
padding: 10px;
border: none;
resize: none;
background-color: darkgray;
border-radius: 10px;
width: 500px;
height: 400px;
margin: 10px;
}

.text {
display: inline-block;
text-align: center;
}
75 changes: 75 additions & 0 deletions clickcrystals/tools/bulletin2/js/bulletin2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@

const input = document.getElementById('input');
const output = document.getElementById('output');

document.addEventListener('keyup', onKeyPress);

function onKeyPress(e) {
var ann = readMarkdown(input.value);
output.value = JSON.stringify(ann);
}


function readMarkdown(str) {
var lines = str.split('\n');
var title = "Release <version>";
var desc = "Check out the new release, ClickCrystals v<version>!";
var fields = [];

var currentField = null;

for (var i = 0; i < lines.length; i++) {
var line = lines[i];
if (line.trim().length == 0)
continue;
if (line.match(/\s*```\w*\s*/gm) != null)
continue;

if (line.match(/\s*Version:\s*.+\s*/gmi) != null) {
line = line.replace(/\s*Version:\s*/gmi, '');
title = "Release " + line
desc = "Check out the new release, ClickCrystals v" + line + "!";
}
else if (line.match(/\s*Desc(ription)?:\s*.+\s*/gmi) != null) {
line = line.replace(/\s*Desc(ription)?:\s*/gmi, '');
desc = line
}
else if (line.match(/\s*.+:\s*/gm) != null) {
line = line.trim().replace(/:/, '');
if (currentField != null)
fields.push(currentField);
currentField = new Field(line, '');
}
else if (line.match(/\s*-\s*.+\s*/gm) != null) {
line = line.trim().replace(/\s*-\s*/, '');
if (currentField != null) {
currentField.desc += currentField.desc.length == 0 ? '' : ', ';
currentField.desc += line;
}
}
}

return new Ann(title, desc, fields);
}

class Ann {
title
desc
fields

constructor(title, desc, fields) {
this.title = title;
this.desc = desc;
this.fields = fields;
}
}

class Field {
title
desc

constructor(title, desc) {
this.title = title;
this.desc = desc;
}
}

0 comments on commit ef642d3

Please sign in to comment.