Autochangelog Mirror from Virgo (#10195)

This commit is contained in:
Selis
2025-02-18 10:11:48 +01:00
committed by GitHub
parent 5ef81222f6
commit ba36a93f74
18 changed files with 372 additions and 11756 deletions

View File

@@ -3,3 +3,5 @@
GLOBAL_REAL(config, /datum/controller/configuration) = new
GLOBAL_DATUM_INIT(revdata, /datum/getrev, new)
GLOBAL_VAR_INIT(changelog_hash, "")

View File

@@ -14,11 +14,11 @@
debug_log = start_log("[log_path]-debug.log")
//VOREStation Edit End
//changelog_hash = md5('html/changelog.html') //used for telling if the changelog has changed recently //Chomp REMOVE
//ChompADD Start - Better Changelogs
var/latest_changelog = file("html/changelogs_ch/archive/" + time2text(world.timeofday, "YYYY-MM") + ".yml")
changelog_hash = fexists(latest_changelog) ? md5(latest_changelog) : 0 //for telling if the changelog has changed recently
//Newsfile
var/latest_changelog = file("[global.config.directory]/../html/changelogs_ch/archive/" + time2text(world.timeofday, "YYYY-MM") + ".yml") // CHOMPEdit - changelogs_ch
GLOB.changelog_hash = fexists(latest_changelog) ? md5(latest_changelog) : "" //for telling if the changelog has changed recently
to_world_log("Changelog Hash: '[GLOB.changelog_hash]' ([latest_changelog])")
//ChompADD Start - Newsfile
var/savefile/F = new(NEWSFILE)
if(F)
var/title

View File

@@ -36,7 +36,6 @@ var/const/starsys_name = "Virgo-Erigone"
*/
//CHOMPStation Removal End
var/const/game_version = "CHOMPStation" //CHOMPStation Edit TFF 24/12/19 - Chompers
var/changelog_hash = ""
var/servernews_hash = "" //ChompADD - news hash gen
var/game_year = (text2num(time2text(world.realtime, "YYYY")) + 544) //YW EDIT
var/round_progressing = 1

View File

@@ -534,7 +534,7 @@ GLOBAL_LIST_EMPTY(asset_datums)
/datum/asset/changelog_item/New(date)
item_filename = sanitize_filename("[date].yml")
SSassets.transport.register_asset(item_filename, file("html/changelogs_ch/archive/" + item_filename))
SSassets.transport.register_asset(item_filename, file("html/changelogs_ch/archive/" + item_filename)) // CHOMPEdit - changelogs_ch
/datum/asset/changelog_item/send(client)
if (!item_filename)

View File

@@ -10,28 +10,6 @@
"no_image32.png" = 'html/images/no_image32.png',
)
/datum/asset/simple/changelog
assets = list(
"88x31.png" = 'html/88x31.png',
"bug-minus.png" = 'html/bug-minus.png',
"cross-circle.png" = 'html/cross-circle.png',
"hard-hat-exclamation.png" = 'html/hard-hat-exclamation.png',
"image-minus.png" = 'html/image-minus.png',
"image-plus.png" = 'html/image-plus.png',
"map-pencil.png" = 'html/map-pencil.png',
"music-minus.png" = 'html/music-minus.png',
"music-plus.png" = 'html/music-plus.png',
"tick-circle.png" = 'html/tick-circle.png',
"wrench-screwdriver.png" = 'html/wrench-screwdriver.png',
"spell-check.png" = 'html/spell-check.png',
"burn-exclamation.png" = 'html/burn-exclamation.png',
"chevron.png" = 'html/chevron.png',
"chevron-expand.png" = 'html/chevron-expand.png',
"changelog.css" = 'html/changelog.css',
"changelog.js" = 'html/changelog.js',
"changelog.html" = 'html/changelog.html'
)
/datum/asset/simple/arcade
assets = list(
"boss1.gif" = 'icons/UI_Icons/Arcade/boss1.gif',

View File

@@ -4,7 +4,7 @@
/datum/asset/changelog_item/New(date)
item_filename = sanitize_filename("[date].yml")
register_asset(item_filename, file("html/changelogs_ch/archive/" + item_filename))
register_asset(item_filename, file("html/changelogs/archive/" + item_filename))
/datum/asset/changelog_item/send(client)
if (!item_filename)

View File

@@ -25,7 +25,7 @@
var/list/data = list( "dates" = list() )
var/regex/ymlRegex = regex(@"\.yml", "g")
for(var/archive_file in sortList(flist("html/changelogs_ch/archive/")))
for(var/archive_file in sortList(flist("html/changelogs_ch/archive/"))) // CHOMPEdit - changelog_ch
var/archive_date = ymlRegex.Replace(archive_file, "")
data["dates"] = list(archive_date) + data["dates"]

View File

@@ -333,13 +333,11 @@
void = new()
screen += void
// CHOMPAdd Start
if((prefs.lastchangelog != changelog_hash) && isnewplayer(src.mob)) //bolds the changelog button on the interface so we know there are updates.
if((prefs?.read_preference(/datum/preference/text/lastchangelog) != GLOB.changelog_hash) && isnewplayer(src.mob)) //bolds the changelog button on the interface so we know there are updates.
to_chat(src, span_info("You have unread updates in the changelog."))
winset(src, "rpane.changelog", "background-color=#eaeaea;font-style=bold")
if(CONFIG_GET(flag/aggressive_changelog))
src.changes()
// CHOMPAdd End
if(CONFIG_GET(flag/paranoia_logging))
var/alert = FALSE //VOREStation Edit start.

View File

@@ -1,3 +1,5 @@
// Toggles
/// Whether or not to toggle ambient occlusion, the shadows around people
/datum/preference/toggle/ambient_occlusion
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
@@ -93,3 +95,14 @@
savefile_key = "obfuscate_job"
default_value = FALSE
savefile_identifier = PREFERENCE_PLAYER
// Text
/datum/preference/text/lastchangelog
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
savefile_key = "lastchangelog"
savefile_identifier = PREFERENCE_PLAYER
/datum/preference/text/lastchangelog/is_accessible(datum/preferences/preferences)
..()
return FALSE

View File

@@ -483,19 +483,13 @@
/client/verb/changes()
set name = "Changelog"
set category = "OOC.Resources"
// CHOMPedit Start - Better Changelog
//src << browse('html/changelog.html', "window=changes;size=675x650")
//return
// CHOMPAdd Start
if(!GLOB.changelog_tgui)
GLOB.changelog_tgui = new /datum/changelog()
GLOB.changelog_tgui.tgui_interact(usr)
if(prefs.lastchangelog != changelog_hash)
prefs.lastchangelog = changelog_hash
SScharacter_setup.queue_preferences_save(prefs)
// CHOMPAdd End
if(prefs?.read_preference(/datum/preference/text/lastchangelog) != GLOB.changelog_hash)
prefs.write_preference_by_type(/datum/preference/text/lastchangelog, GLOB.changelog_hash)
/mob/verb/observe()
set name = "Observe"

View File

@@ -111,12 +111,10 @@
else
output += "<p><b><a href='byond://?src=\ref[src];open_station_news=1'>Show [using_map.station_name] News<br>(NEW!)</A></b></p>"
//ChompEDIT start: Show Changelog
if(client?.prefs?.lastchangelog == changelog_hash)
if(read_preference(/datum/preference/text/lastchangelog) == GLOB.changelog_hash)
output += "<p><a href='byond://?src=\ref[src];open_changelog=1'>Show Changelog</A><br><i>No Changes</i></p>"
else
output += "<p><b><a href='byond://?src=\ref[src];open_changelog=1'>Show Changelog</A><br>(NEW!)</b></p>"
//ChompEDIT End
output += "</div>"
@@ -357,13 +355,10 @@
else
client.feedback_form = new(client)
//ChompEDIT START
if(href_list["open_changelog"])
client.prefs.lastchangelog = changelog_hash
SScharacter_setup.queue_preferences_save(client.prefs)
write_preference_directly(/datum/preference/text/lastchangelog, GLOB.changelog_hash)
client.changes()
return
//ChompEDIT END
/mob/new_player/proc/handle_server_news()
if(!client)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,3 +0,0 @@
1970-01-01:
ExampleUser:
- tweak: Tweaked something in my example PR!

View File

@@ -1,36 +0,0 @@
################################
# Example Changelog File
#
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
#
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
# When it is, any changes listed below will disappear.
#
# Valid Prefixes:
# bugfix
# wip (For works in progress)
# tweak
# soundadd
# sounddel
# rscadd (general adding of nice things)
# rscdel (general deleting of nice things)
# imageadd
# imagedel
# maptweak
# spellcheck (typo fixes)
# experiment
#################################
# Your name.
author: Cameron
# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
delete-after: True
# Any changes you've made. See valid prefix list above.
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
# SCREW THIS UP AND IT WON'T WORK.
# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
changes:
- rscadd: "psilocybin now makes you hallucinate."

View File

@@ -0,0 +1,342 @@
import dateformat from 'dateformat';
import yaml from 'js-yaml';
import { Component, Fragment } from 'react';
import { resolveAsset } from 'tgui/assets';
import { useBackend } from 'tgui/backend';
import { Window } from 'tgui/layouts';
import {
Box,
Button,
Dropdown,
Icon,
Section,
Stack,
Table,
} from 'tgui-core/components';
import { classes } from 'tgui-core/react';
const icons = {
add: { icon: 'check-circle', color: 'green' },
admin: { icon: 'user-shield', color: 'purple' },
balance: { icon: 'balance-scale-right', color: 'yellow' },
bugfix: { icon: 'bug', color: 'green' },
code_imp: { icon: 'code', color: 'green' },
config: { icon: 'cogs', color: 'purple' },
expansion: { icon: 'check-circle', color: 'green' },
experiment: { icon: 'radiation', color: 'yellow' },
image: { icon: 'image', color: 'green' },
imageadd: { icon: 'tg-image-plus', color: 'green' },
imagedel: { icon: 'tg-image-minus', color: 'red' },
qol: { icon: 'hand-holding-heart', color: 'green' },
refactor: { icon: 'tools', color: 'green' },
rscadd: { icon: 'check-circle', color: 'green' },
rscdel: { icon: 'times-circle', color: 'red' },
server: { icon: 'server', color: 'purple' },
sound: { icon: 'volume-high', color: 'green' },
soundadd: { icon: 'tg-sound-plus', color: 'green' },
sounddel: { icon: 'tg-sound-minus', color: 'red' },
spellcheck: { icon: 'spell-check', color: 'green' },
tgs: { icon: 'toolbox', color: 'purple' },
tweak: { icon: 'wrench', color: 'green' },
unknown: { icon: 'info-circle', color: 'label' },
wip: { icon: 'hammer', color: 'orange' },
};
type Data = { dates: string[] };
export class Changelog extends Component<
{},
{
data:
| string
| { date: string; authors: { name: string; changes: string[] } };
selectedDate: string;
selectedIndex: number;
}
> {
dateChoices: string[];
constructor(props) {
super(props);
this.state = {
data: 'Loading changelog data...',
selectedDate: '',
selectedIndex: 0,
};
this.dateChoices = [];
}
setData(data) {
this.setState({ data });
}
setSelectedDate(selectedDate) {
this.setState({ selectedDate });
}
setSelectedIndex(selectedIndex) {
this.setState({ selectedIndex });
}
getData = (date, attemptNumber = 1) => {
const { act } = useBackend();
const self = this;
const maxAttempts = 6;
if (attemptNumber > maxAttempts) {
return this.setData(
'Failed to load data after ' + maxAttempts + ' attempts',
);
}
act('get_month', { date });
fetch(resolveAsset(date + '.yml')).then(async (changelogData) => {
const result = await changelogData.text();
const errorRegex = /^Cannot find/;
if (errorRegex.test(result)) {
const timeout = 50 + attemptNumber * 50;
self.setData('Loading changelog data' + '.'.repeat(attemptNumber + 3));
setTimeout(() => {
self.getData(date, attemptNumber + 1);
}, timeout);
} else {
self.setData(yaml.load(result, { schema: yaml.CORE_SCHEMA }));
}
});
};
componentDidMount() {
const {
data: { dates = [] },
} = useBackend<Data>();
if (dates) {
dates.forEach((date) =>
this.dateChoices.push(dateformat(date, 'mmmm yyyy', true)),
);
this.setSelectedDate(this.dateChoices[0]);
this.getData(dates[0]);
}
}
render() {
const { data, selectedDate, selectedIndex } = this.state;
const {
data: { dates },
} = useBackend<Data>();
const { dateChoices } = this;
const dateDropdown = dateChoices.length > 0 && (
<Stack mb={1}>
<Stack.Item>
<Button
className="Changelog__Button"
disabled={selectedIndex === 0}
icon={'chevron-left'}
onClick={() => {
const index = selectedIndex - 1;
this.setData('Loading changelog data...');
this.setSelectedIndex(index);
this.setSelectedDate(dateChoices[index]);
window.scrollTo(
0,
document.body.scrollHeight ||
document.documentElement.scrollHeight,
);
return this.getData(dates[index]);
}}
/>
</Stack.Item>
<Stack.Item>
<Dropdown
displayText={selectedDate}
options={dateChoices}
onSelected={(value) => {
const index = dateChoices.indexOf(value);
this.setData('Loading changelog data...');
this.setSelectedIndex(index);
this.setSelectedDate(value);
window.scrollTo(
0,
document.body.scrollHeight ||
document.documentElement.scrollHeight,
);
return this.getData(dates[index]);
}}
selected={selectedDate}
width={'150px'}
/>
</Stack.Item>
<Stack.Item>
<Button
className="Changelog__Button"
disabled={selectedIndex === dateChoices.length - 1}
icon={'chevron-right'}
onClick={() => {
const index = selectedIndex + 1;
this.setData('Loading changelog data...');
this.setSelectedIndex(index);
this.setSelectedDate(dateChoices[index]);
window.scrollTo(
0,
document.body.scrollHeight ||
document.documentElement.scrollHeight,
);
return this.getData(dates[index]);
}}
/>
</Stack.Item>
</Stack>
);
const header = (
<Section>
<h1>VOREStation Changelist</h1>
<p>
{'The GitHub repository can be found '}
<a href="https://github.com/VOREStation/VOREStation">here</a>
{', recent GitHub contributors can be found '}
<a href="https://github.com/VOREStation/VOREStation/pulse/monthly">
here
</a>
.
</p>
<p>
{'Visit our wiki '}
<a href="https://wiki.vore-station.net/Main_Page">here</a>
{', check out our discord server '}
<a href="https://discord.gg/Zd5WMuq">here</a>.
</p>
{dateDropdown}
</Section>
);
const footer = (
<Section>
{dateDropdown}
<h3>VOREStation License</h3>
<p>
{'All code after '}
<a
href={
'https://github.com/VOREStation/VOREStation/commit/' +
'333c566b88108de218d882840e61928a9b759d8f'
}
>
commit 333c566b88108de218d882840e61928a9b759d8f on 2014/31/12 at
4:38 PM PST
</a>
{' is licensed under '}
<a href="https://www.gnu.org/licenses/agpl-3.0.html">GNU AGPL v3</a>
{'. All code before that commit is licensed under '}
<a href="https://www.gnu.org/licenses/gpl-3.0.html">GNU GPL v3</a>
{', including tools unless their readme specifies otherwise. See '}
<a href="https://github.com/VOREStation/VOREStation/blob/master/LICENSE">
LICENSE
</a>
{' and '}
<a href="https://github.com/VOREStation/VOREStation/blob/master/LICENSE-GPL3.txt">
GPLv3.txt
</a>
{' for more details.'}
</p>
<p>
The TGS DMAPI API is licensed as a subproject under the MIT license.
{' See the footer of '}
<a
href={
'https://github.com/VOREStation/VOREStation/blob/master' +
'/code/__DEFINES/tgs.dm'
}
>
code/__DEFINES/tgs.dm
</a>
{' and '}
<a
href={
'https://github.com/VOREStation/VOREStation/blob/master' +
'/code/modules/tgs/LICENSE'
}
>
code/modules/tgs/LICENSE
</a>
{' for the MIT license.'}
</p>
<p>
{'All assets including icons and sound are under a '}
<a href="https://creativecommons.org/licenses/by-sa/3.0/">
Creative Commons 3.0 BY-SA license
</a>
{' unless otherwise indicated.'}
</p>
</Section>
);
const changes =
typeof data === 'object' &&
Object.keys(data).length > 0 &&
Object.entries(data)
.reverse()
.map(([date, authors]) => (
<Section key={date} title={dateformat(date, 'd mmmm yyyy', true)}>
<Box ml={3}>
{Object.entries(authors).map(([name, changes]) => (
<Fragment key={name}>
<h4>{name} changed:</h4>
<Box ml={3}>
<Table>
{(changes as string[]).map((change) => {
const changeType = Object.keys(change)[0];
return (
<Table.Row key={changeType + change[changeType]}>
<Table.Cell
className={classes([
'Changelog__Cell',
'Changelog__Cell--Icon',
])}
>
<Icon
color={
icons[changeType]
? icons[changeType].color
: icons['unknown'].color
}
name={
icons[changeType]
? icons[changeType].icon
: icons['unknown'].icon
}
/>
</Table.Cell>
<Table.Cell className="Changelog__Cell">
{change[changeType]}
</Table.Cell>
</Table.Row>
);
})}
</Table>
</Box>
</Fragment>
))}
</Box>
</Section>
));
return (
<Window title="Changelog" width={675} height={650}>
<Window.Content scrollable>
{header}
{changes}
{typeof data === 'string' && <p>{data}</p>}
{footer}
</Window.Content>
</Window>
);
}
}

View File

@@ -197,6 +197,7 @@
#include "code\_global_vars\logging.dm"
#include "code\_global_vars\misc.dm"
#include "code\_global_vars\mobs.dm"
#include "code\_global_vars\tgui.dm"
#include "code\_global_vars\time_vars.dm"
#include "code\_global_vars\traits.dm"
#include "code\_global_vars\typecache.dm"
@@ -2196,6 +2197,7 @@
#include "code\modules\catalogue\catalogue_data_yw.dm"
#include "code\modules\catalogue\cataloguer.dm"
#include "code\modules\catalogue\cataloguer_visuals.dm"
#include "code\modules\changelog\changelog.dm"
#include "code\modules\client\client defines.dm"
#include "code\modules\client\client procs.dm"
#include "code\modules\client\client procs_vr.dm"
@@ -4766,7 +4768,6 @@
#include "modular_chomp\code\global.dm"
#include "modular_chomp\code\__defines\_planes+layers.dm"
#include "modular_chomp\code\__defines\text.dm"
#include "modular_chomp\code\_global_vars\tgui.dm"
#include "modular_chomp\code\_global_vars\list\names.dm"
#include "modular_chomp\code\_HELPERS\game.dm"
#include "modular_chomp\code\_HELPERS\mobs.dm"
@@ -4775,7 +4776,6 @@
#include "modular_chomp\code\datums\http.dm"
#include "modular_chomp\code\datums\autolathe\engineering_ch.dm"
#include "modular_chomp\code\datums\autolathe\general_ch.dm"
#include "modular_chomp\code\datums\changelog\changelog.dm"
#include "modular_chomp\code\datums\components\dry.dm"
#include "modular_chomp\code\datums\components\hearer.dm"
#include "modular_chomp\code\datums\components\squeak.dm"