mirror of https://github.com/pissnet/pissircd
commit
94c04fda0e
Binary file not shown.
@ -0,0 +1,179 @@
|
||||
// logotool.js
|
||||
// Reconstruct src/version.c.SH with the logo banner of your choice!
|
||||
// Hacked together by owo on pissnet <https://github.com/Prouser123>
|
||||
// To create a logo: 'figlet -f big <message> > new_logo.txt'
|
||||
// 'node extras/logotool.js'
|
||||
|
||||
const fs = require("fs")
|
||||
|
||||
// Load in the source file
|
||||
const scriptFile = fs.readFileSync("src/version.c.SH")
|
||||
|
||||
// Step 0: Figure out where the logo definition is
|
||||
|
||||
const start = scriptFile.indexOf("char unreallogo[]")
|
||||
// -2 to get rid of the two newlines before this match
|
||||
// This means the last char is the closing }; of the logo definition
|
||||
const end = scriptFile.indexOf("char *dalinfotext[] =") - 2
|
||||
|
||||
|
||||
const unrealLogoDefinition = scriptFile.slice(start, end).toString()
|
||||
|
||||
console.log(`Found unreal logo definition at indexes ${start}-${end}`)
|
||||
|
||||
//console.log(`"${unrealLogoDefinition}"`)
|
||||
|
||||
/**
|
||||
*
|
||||
* char unreallogo[] =
|
||||
* {
|
||||
* [11 ascii points (eg. 1,2,3,4,5,6,7,8,9,10,11, )]
|
||||
* };
|
||||
*
|
||||
*/
|
||||
|
||||
// 1. Remove the {} blocks so we are left with just the code points, comma seperated.
|
||||
|
||||
// +3 to start after the { and \n
|
||||
const openingBracket = unrealLogoDefinition.indexOf("{") + 3
|
||||
const closingBracket = unrealLogoDefinition.indexOf("};")
|
||||
|
||||
let addresses = unrealLogoDefinition.slice(openingBracket, closingBracket)
|
||||
|
||||
//console.log("'" + addresses + "'")
|
||||
|
||||
|
||||
// 2. Create an array of ascii code points
|
||||
const codePoints = addresses.split(",")
|
||||
|
||||
|
||||
// 2b. print the current message
|
||||
console.log("Current message:\n------------------------------------------------------------")
|
||||
console.log(String.fromCharCode(...codePoints))
|
||||
|
||||
// 3. Take input for the new message
|
||||
// TODO: Integrate with figlet
|
||||
console.log("------------------------------------------------------------")
|
||||
console.log("To create a logo: 'figlet -f big <message> > new_logo.txt'")
|
||||
console.log(" 'node extras/logotool.js'")
|
||||
console.log("\nClose enough! :tm:")
|
||||
console.log("------------------------------------------------------------")
|
||||
console.log("Loading new logo from new_logo.txt")
|
||||
|
||||
const newLogo = fs.readFileSync("new_logo.txt")
|
||||
|
||||
let keys = []
|
||||
newLogo.forEach(l => keys.push(l))
|
||||
|
||||
console.log("------------------------------------------------------------")
|
||||
//console.log(String.fromCharCode(...keys))
|
||||
//console.log("------------------------------------------------------------")
|
||||
|
||||
// 3.1. Remove trailing lines
|
||||
/*
|
||||
Each trailing line is made of:
|
||||
|
||||
56x 32 (space)
|
||||
1x 10 (\n)
|
||||
|
||||
eg: 32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
|
||||
32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
|
||||
32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,10
|
||||
|
||||
(moved across multiple lines for readability)
|
||||
*/
|
||||
|
||||
|
||||
// Regex to remove instances of blank lines (as defined above)
|
||||
|
||||
// bugfix: 56x for the default "UnrealIRCd logo", but custom logos have different widths
|
||||
// using 2+ spaces in a row followed by newline for now.
|
||||
keys2 = keys.toString().replace(/((,32){2,},10){1,}/gm, "").split(",")
|
||||
|
||||
// If last item is a 10 (newline), remove it
|
||||
// bugfix: try commenting this out since ircd places the git string on the same line as the chars
|
||||
// (should be on it's own n)
|
||||
//if (keys2[keys2.length-1] = "10") keys2.pop()
|
||||
|
||||
|
||||
/*
|
||||
UNUSED
|
||||
------
|
||||
if (keys2.length % 2 != 0) {
|
||||
keys2.push("0")
|
||||
// Index is odd! we need to add an extra character for padding
|
||||
|
||||
}*/
|
||||
|
||||
console.log(String.fromCharCode(...keys2))
|
||||
console.log("------------------------------------------------------------")
|
||||
|
||||
// Step $x - add name of product for some reason?
|
||||
// eg. original message has "UnrealIRCd" as last line
|
||||
|
||||
// Step 4 - Re-construct version.c.SH
|
||||
|
||||
// Step 4.1 - Get the file *around* our indexes (aka the whole file except the definition)
|
||||
const fileBeforeDef = scriptFile.slice(0, start)
|
||||
const fileAfterDef = scriptFile.slice(end, scriptFile.length)
|
||||
|
||||
// debug file outputs disabled | fs.writeFileSync("test.txt", `${fileBeforeDef}${fileAfterDef}`)
|
||||
|
||||
// Step 4.1 - Prepare for creation of new logo definition
|
||||
// (See line 20) We ideally want to match tbe format of 11 ascii points per line
|
||||
|
||||
|
||||
// ceil just in case (round up to next whole number)
|
||||
// eg. 28.8 -> 29
|
||||
const rows = Math.ceil(keys2.length / 11)
|
||||
|
||||
console.log(`(debug) We need **${rows}** rows to match the existing 11 points / line format!`)
|
||||
|
||||
const rowsData = []
|
||||
|
||||
for (row = 0; row < rows; row++) {
|
||||
// Iterate this every row
|
||||
|
||||
const rowData = []
|
||||
|
||||
|
||||
// Get the first 11 items from keys2
|
||||
for (i = 0; i < 11; i++) {
|
||||
//console.log("(debug) Getting item " + i)
|
||||
const charcode = keys2.shift()
|
||||
|
||||
// Only push if chars are available (otherwise we get undefined elements in rowData)
|
||||
charcode ? rowData.push(charcode) : "skip; no elements left"
|
||||
|
||||
}
|
||||
|
||||
// Push this row's chars to the global "list of rows"
|
||||
rowsData.push(rowData)
|
||||
}
|
||||
|
||||
//console.log(rowsData)
|
||||
|
||||
// Step 4.2 - Format rowsData into a logo definition
|
||||
const stringRows = []
|
||||
|
||||
for (i = 0; i < rowsData.length; i++) {
|
||||
// Add the contents of each row to a variable, comma seperated
|
||||
let rowContents = rowsData[i].join(",")
|
||||
// Add a comma to the end except on the last line
|
||||
if ((i + 1 != rowsData.length)) rowContents += ","
|
||||
// Now our format for this line should match the requirements (line 21), so we can push it to a output array!
|
||||
stringRows.push(rowContents)
|
||||
}
|
||||
|
||||
// Step 4.3 - Create the *new* logo definition
|
||||
|
||||
const newLogoDef = `char unreallogo[] =
|
||||
{
|
||||
${stringRows.join("\n")}};\n`
|
||||
|
||||
//console.log(newLogoDef)
|
||||
|
||||
// Step 4.4 - Write the new file
|
||||
fs.writeFileSync("src/version.c.SH", `${fileBeforeDef}${newLogoDef}${fileAfterDef}`)
|
||||
|
||||
// debug file outputs disabled | fs.writeFileSync("src/version.c.SH.original", scriptFile)
|
@ -1,243 +0,0 @@
|
||||
/* include/setup.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define the directory where the unrealircd binary is located */
|
||||
#undef BINDIR
|
||||
|
||||
/* Specify the build directory */
|
||||
#undef BUILDDIR
|
||||
|
||||
/* Define the location of the cached remote include files */
|
||||
#undef CACHEDIR
|
||||
|
||||
/* Define the location of the configuration files */
|
||||
#undef CONFDIR
|
||||
|
||||
/* Define the location of permanent data files */
|
||||
#undef DATADIR
|
||||
|
||||
/* The default permissions for configuration files. Set to 0 to prevent
|
||||
unrealircd from calling chmod() on the files. */
|
||||
#undef DEFAULT_PERMISSIONS
|
||||
|
||||
/* Define the location of the documentation */
|
||||
#undef DOCDIR
|
||||
|
||||
/* Define if you have getrusage */
|
||||
#undef GETRUSAGE_2
|
||||
|
||||
/* Define if you have the <glob.h> header file. */
|
||||
#undef GLOBH
|
||||
|
||||
/* Define if ssl library has ASN1_TIME_diff */
|
||||
#undef HAS_ASN1_TIME_diff
|
||||
|
||||
/* Define if ssl library has SSL_CTX_set1_curves_list */
|
||||
#undef HAS_SSL_CTX_SET1_CURVES_LIST
|
||||
|
||||
/* Define if ssl library has SSL_CTX_set_min_proto_version */
|
||||
#undef HAS_SSL_CTX_SET_MIN_PROTO_VERSION
|
||||
|
||||
/* Define if ssl library has SSL_CTX_set_security_level */
|
||||
#undef HAS_SSL_CTX_SET_SECURITY_LEVEL
|
||||
|
||||
/* Define if ssl library has X509_get0_notAfter */
|
||||
#undef HAS_X509_get0_notAfter
|
||||
|
||||
/* Define if you have crypt */
|
||||
#undef HAVE_CRYPT
|
||||
|
||||
/* Define if you have epoll */
|
||||
#undef HAVE_EPOLL
|
||||
|
||||
/* Define to 1 if you have the `epoll_create' function. */
|
||||
#undef HAVE_EPOLL_CREATE
|
||||
|
||||
/* Define to 1 if you have the `epoll_ctl' function. */
|
||||
#undef HAVE_EPOLL_CTL
|
||||
|
||||
/* Define to 1 if you have the `epoll_wait' function. */
|
||||
#undef HAVE_EPOLL_WAIT
|
||||
|
||||
/* Define to 1 if you have the `explicit_bzero' function. */
|
||||
#undef HAVE_EXPLICIT_BZERO
|
||||
|
||||
/* Define to 1 if you have the `getrusage' function. */
|
||||
#undef HAVE_GETRUSAGE
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if you have the `kevent' function. */
|
||||
#undef HAVE_KEVENT
|
||||
|
||||
/* Define to 1 if you have the `kqueue' function. */
|
||||
#undef HAVE_KQUEUE
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the `poll' function. */
|
||||
#undef HAVE_POLL
|
||||
|
||||
/* Define if you have PS_STRINGS */
|
||||
#undef HAVE_PSSTRINGS
|
||||
|
||||
/* Define if you have pstat */
|
||||
#undef HAVE_PSTAT
|
||||
|
||||
/* Define if you have POSIX threads libraries and header files. */
|
||||
#undef HAVE_PTHREAD
|
||||
|
||||
/* Have PTHREAD_PRIO_INHERIT. */
|
||||
#undef HAVE_PTHREAD_PRIO_INHERIT
|
||||
|
||||
/* Define if you have setproctitle */
|
||||
#undef HAVE_SETPROCTITLE
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if you have the `strlcat' function. */
|
||||
#undef HAVE_STRLCAT
|
||||
|
||||
/* Define to 1 if you have the `strlcpy' function. */
|
||||
#undef HAVE_STRLCPY
|
||||
|
||||
/* Define to 1 if you have the `strlncat' function. */
|
||||
#undef HAVE_STRLNCAT
|
||||
|
||||
/* Define to 1 if you have the `strlncpy' function. */
|
||||
#undef HAVE_STRLNCPY
|
||||
|
||||
/* Define to 1 if you have the `syslog' function. */
|
||||
#undef HAVE_SYSLOG
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the `times' function. */
|
||||
#undef HAVE_TIMES
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define the location of the log files */
|
||||
#undef LOGDIR
|
||||
|
||||
/* Set to the maximum number of connections you want */
|
||||
#undef MAXCONNECTIONS_REQUEST
|
||||
|
||||
/* Define the location of the modules */
|
||||
#undef MODULESDIR
|
||||
|
||||
/* machine is bigendian */
|
||||
#undef NATIVE_BIG_ENDIAN
|
||||
|
||||
/* machine is littleendian */
|
||||
#undef NATIVE_LITTLE_ENDIAN
|
||||
|
||||
/* Set to the nickname history length you want */
|
||||
#undef NICKNAMEHISTORYLENGTH
|
||||
|
||||
/* Define if you want OperOverride disabled */
|
||||
#undef NO_OPEROVERRIDE
|
||||
|
||||
/* Define if you want opers to have to use /invite to join +s/+p channels */
|
||||
#undef OPEROVERRIDE_VERIFY
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#undef PACKAGE_URL
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* Define the location of permanent data files */
|
||||
#undef PERMDATADIR
|
||||
|
||||
/* Define the path of the pid file */
|
||||
#undef PIDFILE
|
||||
|
||||
/* Define the location of private libraries */
|
||||
#undef PRIVATELIBDIR
|
||||
|
||||
/* Define to necessary symbol if this constant uses a non-standard name on
|
||||
your system. */
|
||||
#undef PTHREAD_CREATE_JOINABLE
|
||||
|
||||
/* Define if you have the <sys/rusage.h> header file. */
|
||||
#undef RUSAGEH
|
||||
|
||||
/* Define the directory where the unrealircd start stop scripts is located */
|
||||
#undef SCRIPTDIR
|
||||
|
||||
/* Link... statically(?) (defining this macro will probably cause the build
|
||||
tofail) */
|
||||
#undef STATIC_LINKING
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define if you have the <sys/syslog.h> header file. */
|
||||
#undef SYSSYSLOGH
|
||||
|
||||
/* Define if you have times */
|
||||
#undef TIMES_2
|
||||
|
||||
/* Define the location of private temporary files */
|
||||
#undef TMPDIR
|
||||
|
||||
/* Define if your system prepends an underscore to symbols */
|
||||
#undef UNDERSCORE
|
||||
|
||||
/* Generation version number (e.g.: X for X.Y.Z) */
|
||||
#undef UNREAL_VERSION_GENERATION
|
||||
|
||||
/* Major version number (e.g.: Y for X.Y.Z) */
|
||||
#undef UNREAL_VERSION_MAJOR
|
||||
|
||||
/* Minor version number (e.g.: Z for X.Y.Z) */
|
||||
#undef UNREAL_VERSION_MINOR
|
||||
|
||||
/* Version suffix such as a beta marker or release candidate marker. (e.g.:
|
||||
-rcX for unrealircd-3.2.9-rcX) */
|
||||
#undef UNREAL_VERSION_SUFFIX
|
||||
|
||||
/* Define if you have libcurl installed to get remote includes and MOTD
|
||||
support */
|
||||
#undef USE_LIBCURL
|
||||
|
||||
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
|
||||
significant byte first (like Motorola and SPARC, unlike Intel). */
|
||||
#if defined AC_APPLE_UNIVERSAL_BUILD
|
||||
# if defined __BIG_ENDIAN__
|
||||
# define WORDS_BIGENDIAN 1
|
||||
# endif
|
||||
#else
|
||||
# ifndef WORDS_BIGENDIAN
|
||||
# undef WORDS_BIGENDIAN
|
||||
# endif
|
||||
#endif
|