add kiwiirc applet

This commit is contained in:
sheepish
2023-06-15 12:05:02 +00:00
committed by Spine
parent 6be39becc1
commit 7bd6cdc805
24 changed files with 178 additions and 249 deletions

View File

@@ -27,6 +27,7 @@ variables:
MEMCACHED_NAMESPACE: $CI_COMMIT_SHORT_SHA
COMPOSER_HOME: ${CI_PROJECT_DIR}/.composer
CYPRESS_CACHE_FOLDER: ${CI_PROJECT_DIR}/node_modules/.cypress-cache
GIT_SUBMODULE_STRATEGY: recursive
phpstan:
stage: analyze

3
.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "public/static/assets"]
path = public/static/assets
url = ../website-static-assets.git

View File

@@ -103,5 +103,5 @@ twig-flush:
.PHONY: update
update:
git pull
git pull --recurse-submodules
composer install --no-dev --optimize-autoloader --no-progress

View File

@@ -292,6 +292,7 @@ defined('DEBUG_TRACE') or define('DEBUG_TRACE', '');
// ------------------------------------------------------------------------
// IRC settings
defined('IRC_PUBLIC_SERVER') or define('IRC_PUBLIC_SERVER', 'irc.' . SITE_HOST);
defined('DISABLE_IRC') or define('DISABLE_IRC', false);
defined('IRC_HTTP_SOCKET_ADDRESS') or define('IRC_HTTP_SOCKET_ADDRESS', 'http://localhost:51011/');
@@ -786,6 +787,7 @@ defined('VALID_PAGE') or define('VALID_PAGE', [
'user',
'userhistory',
'view',
'webirc',
]);
// Maximum length of a custom user title.

1
public/static/assets Submodule

Submodule public/static/assets added at 90f16704d2

1
public/static/highlight.mp3 Symbolic link
View File

@@ -0,0 +1 @@
assets/kiwi/static/highlight.mp3

1
public/static/highlight.ogg Symbolic link
View File

@@ -0,0 +1 @@
assets/kiwi/static/highlight.ogg

Binary file not shown.

View File

@@ -1,93 +0,0 @@
#
# This java file is a part of the
#
# - Plouf's Java IRC Client -
#
# Copyright (C) 2004 Philippe Detournay
#
# This file is licensed under the GPL license
#
# All contacts : theplouf@yahoo.com
#
#
# Syntax :
# Comments begin with the # character. This character must be the first character of the line.
# A data line has three parts : the data id, the data id description, the data string.
# - Data id : An hexadecimal figure identifying the string.
# - Data description : Begins by [ and ends by ]. The description is not parsed and
# can be any string.
# - Data string : The string itself. Parameters are specified using the %i syntax.
#
# Trailing spaces can be added using the \s escape character.
0001 [INTERPRETOR_NOT_ON_CHANNEL] Not on a channel
0002 [INTERPRETOR_UNKNOWN_DCC] %1 : unknown dcc subcommand
0003 [INTERPRETOR_INSUFFICIENT_PARAMETERS] %1 : insufficient parameters
0004 [INTERPRETOR_BAD_CONTEXT] %1 : unable to perform in current context
0005 [INTERPRETOR_CANNOT_CTCP_IN_DCCCHAT] Cannot send CTCP codes via DCC Chat
0006 [INTERPRETOR_UNKNOWN_CONFIG] %1 : unknown config subcommand
0007 [INTERPRETOR_TIMESTAMP_ON] Timestamp enabled
0008 [INTERPRETOR_TIMESTAMP_OFF] Timestamp disabled
0009 [INTERPRETOR_SMILEYS_ON] Graphical smileys enabled
000a [INTERPRETOR_SMILEYS_OFF] Graphical smileys disabled
000b [INTERPRETOR_IGNORE_ON] Now ignoring %1
000c [INTERPRETOR_IGNORE_OFF] Not ignoring %1 anymore
000d [INTERPRETOR_MULTISERVER_DISABLED] Multiserver support is disabled
0101 [DCC_WAITING_INCOMING] Waiting for incoming connection...
0102 [DCC_UNABLE_TO_OPEN_CONNECTION] Unable to open connection : %1
0103 [DCC_CONNECTION_ESTABLISHED] DCC Connection established
0104 [DCC_CONNECTION_CLOSED] Connection closed
0105 [DCC_ERROR] Error : %1
0106 [DCC_UNABLE_TO_SEND_TO] %1 : unable to send to %2
0107 [DCC_BAD_CONTEXT] Unable to execute command from current context
0108 [DCC_NOT_CONNECTED] Not connected
0109 [DCC_UNABLE_PASSIVE_MODE] Unable to initialize passive mode
010a [CTCP_PING_REPLY] [%1 PING reply] : %2 seconds
010b [DCC_STREAM_CLOSED] Stream closed
0201 [IDENT_FAILED_LAUNCH] Failed to launch Ident server : %1
0202 [IDENT_REQUEST] Ident request from %1
0203 [IDENT_ERROR] Error occurred
0204 [IDENT_REPLIED] Replied %1
0205 [IDENT_DEFAULT_USER] default user
0206 [IDENT_NO_USER] No user for request
0207 [IDENT_RUNNING_ON_PORT] Ident server running on port %1
0208 [IDENT_LEAVING] Ident server leaving : %1
0209 [IDENT_NONE] none
020a [IDENT_UNKNOWN] unknown
020b [IDENT_UNDEFINED] Undefined result
0301 [FILE_SAVEAS] Save file as
0401 [ABOUT_ABOUT] About
0402 [ABOUT_PROGRAMMING] Programming
0403 [ABOUT_DESIGN] Design
0404 [ABOUT_THANKS] Thanks to
0405 [ABOUT_SUPPORT] for support, ideas and testing
0406 [ABOUT_GPL] This software is licensed under the GPL license
0501 [SERVER_UNABLE_TO_CONNECT] Unable to connect : %1
0502 [SERVER_UNABLE_TO_CONNECT_STILL] Unable to connect to %1 : currently trying to connect to %2
0503 [SERVER_DISCONNECTING] Disconnecting from %1
0504 [SERVER_CONNECTING] Connecting...
0505 [SERVER_NOT_CONNECTED] Not connected
0506 [SERVER_LOGIN] Logging in...
0507 [SERVER_DISCONNECTED] Disconnected from %1
0508 [SERVER_ERROR] Error : %1
0509 [SERVER_AUTOREJOIN_ATTEMPT] Attempting to rejoin channel %1...
050a [SERVER_AUTOREJOIN_FAILED] Unable to rejoin channel %1
071a [GUI_CHANGE_NICK] Change nick to
071b [GUI_COPY_WINDOW] Copy text
071c [GUI_DCC_CHAT_WARNING_TITLE] Warning
071d [GUI_DCC_CHAT_WARNING_TEXT] Do you want to accept DCC chat from %1?
0801 [ASL_MALE] Boy, %1 years old, %2
0802 [ASL_FEMALE] Girl, %1 years old, %2
0803 [ASL_UNKNOWN] %1 years old from %2
0901 [REPLY_IDLE] %1 has been idle for %2
0902 [REPLY_SIGNON] %1 connected on %2
ffff [ERROR_NOT_DEFINED] Undefined string

Binary file not shown.

View File

@@ -1,75 +0,0 @@
#
# This java file is a part of the
#
# - Plouf's Java IRC Client -
#
# Copyright (C) 2004 Philippe Detournay
#
# This file is licensed under the GPL license
#
# All contacts : theplouf@yahoo.com
#
#
# Syntax :
# Comments begin with the # character. This character must be the first character of the line.
# A data line has three parts : the data id, the data id description, the data string.
# - Data id : An hexadecimal figure identifying the string.
# - Data description : Begins by [ and ends by ]. The description is not parsed and
# can be any string.
# - Data string : The string itself. Parameters are specified using the %i syntax.
#
# Trailing spaces can be added using the \s escape character.
8601 [SOURCE_YOU_KICKED] You've been kicked out of %1 by %2
8602 [SOURCE_STATUS] Status
8603 [SOURCE_CHANLIST] Channels for %1
8604 [SOURCE_CHANLIST_RETREIVING] Retrieving channels...
8605 [SOURCE_HAS_JOINED] %1 has joined %2
8606 [SOURCE_HAS_LEFT] %1 has left %2
8607 [SOURCE_HAS_BEEN_KICKED_BY] %1 has been kicked by %2
8608 [SOURCE_HAS_QUIT] %1 has quit
8609 [SOURCE_TOPIC_IS] Topic is %1
860a [SOURCE_CHANGED_TOPIC] %1 changed topic to %2
860b [SOURCE_CHANNEL_MODE] %1 sets channel mode to %2
860c [SOURCE_CHANNEL_MODE_IS] Channel mode is %1
860d [SOURCE_USER_MODE] %1 sets mode %2 on %3
860e [SOURCE_KNOWN_AS] %1 is now known as %2
860f [SOURCE_YOUR_MODE] Mode changed to %1
8610 [SOURCE_YOUR_NICK] Your nick is now %1
8611 [SOURCE_INFO] Infos
8612 [SOURCE_AWAY] %1 is away
8613 [SOURCE_YOU_INVITED] %1 invites you to join %2
8614 [SOURCE_YOU_JOINED_AS] You're talking in %1 as %2
8701 [GUI_WHOIS] Whois
8702 [GUI_QUERY] Query
8703 [GUI_KICK] Kick
8704 [GUI_BAN] Ban
8705 [GUI_KICKBAN] Kick + Ban
8706 [GUI_OP] Op
8707 [GUI_DEOP] DeOp
8708 [GUI_VOICE] Voice
8709 [GUI_DEVOICE] DeVoice
870a [GUI_PING] Ping
870b [GUI_VERSION] Version
870c [GUI_TIME] Time
870d [GUI_FINGER] Finger
870e [GUI_RETREIVING_FILE] Receiving file (%1 bytes)
870f [GUI_SENDING_FILE] Sending file (%1 bytes)
8710 [GUI_TERMINATED] %1 terminated
8711 [GUI_FAILED] %1 failed
8712 [GUI_CLOSE] Close
8713 [GUI_DISCONNECT] Disconnect
8714 [GUI_CHANNELS] Channels
8715 [GUI_HELP] Help
8716 [GUI_PRIVATE] private
8717 [GUI_PUBLIC] public
8718 [GUI_CONNECT] Connect
8719 [GUI_ABOUT] About
871a [GUI_CHANGE_NICK] New nick
871c [GUI_FONT] Font
871d [GUI_FONT_WINDOW] Select font
871e [GUI_FONT_WINDOW_OK] Ok
871f [GUI_ENTER_TEXT_HERE] Enter text here...
ffff [ERROR_NOT_DEFINED] Undefined string

Binary file not shown.

View File

@@ -1,74 +1,6 @@
<?php
View::show_header('IRC');
$IRCKey = $Viewer->IRCKey();
if (empty($IRCKey)) {
?>
<div class="thin">
<div class="header">
<h3 id="irc">IRC Rules - Please read these carefully!</h3>
</div>
<div class="box pad" style="padding: 10px 10px 10px 20px;">
<p>
<strong>Please set your IRC Key on your <a href="user.php?action=edit&amp;id=<?=
$Viewer->id() ?>">profile</a> first! For more information on IRC, please read the <a href="wiki.php?action=article&amp;name=IRC+-+How+to+join">wiki article</a>.</strong>
</p>
</div>
</div>
<?php
} else {
if (!isset($_POST['accept'])) {
?>
<div class="thin">
<div class="header">
<h3 id="irc">IRC Rules - Please read these carefully!</h3>
</div>
<div class="box pad" style="padding: 10px 10px 10px 20px;">
<?= $Twig->render('rules/irc.twig'); ?>
<form class="confirm_form center" name="chat" method="post" action="chat.php">
<input type="hidden" name="auth" value="<?= $Viewer->auth() ?>" />
<input type="submit" name="accept" value="I agree to these rules" />
</form>
</div>
</div>
<?php
} else {
$nick = $Viewer->username();
$nick = preg_replace('/[^a-zA-Z0-9\[\]\\`\^\{\}\|_]/', '', $nick);
if (strlen($nick) == 0) {
$nick = SITE_NAME.'Guest????';
} else {
if (is_numeric(substr($nick, 0, 1))) {
$nick = '_' . $nick;
}
}
?>
<div class="thin">
<div class="header">
<h3 id="general">IRC</h3>
</div>
<div class="box pad" style="padding: 10px 0px 10px 0px;">
<div style="padding: 0px 10px 10px 20px;">
<p>If you have an IRC client, refer to <a href="wiki.php?action=article&amp;name=IRC+-+How+to+join">this wiki article</a> for information on how to connect. (IRC applet users are automatically identified with Drone.)</p>
</div>
<applet codebase="<?= STATIC_SERVER ?>/irc/" code="IRCApplet.class" archive="irc.jar,sbox.jar" width="800" height="600" align="center">
<param name="nick" value="<?=$nick?>" />
<param name="alternatenick" value="OpsGuest????" />
<param name="name" value="Java IRC User" />
<param name="host" value="<?=BOT_SERVER?>" />
<param name="multiserver" value="true" />
<param name="autorejoin" value="false" />
<param name="gui" value="sbox" />
<param name="pixx:highlight" value="true" />
<param name="pixx:highlightnick" value="true" />
<param name="pixx:prefixops" value="true" />
<param name="sbox:scrollspeed" value="5" />
</applet>
</div>
</div>
<?php
}
}
View::show_footer();
require_once(match ($_REQUEST['action'] ?? '') {
'webirc' => 'webirc.php',
default => 'join.php',
});

5
sections/chat/join.php Normal file
View File

@@ -0,0 +1,5 @@
<?php
echo $Twig->render('chat/index.twig', [
'user' => $Viewer,
]);

24
sections/chat/webirc.php Normal file
View File

@@ -0,0 +1,24 @@
<?php
if (!$Viewer->disableIRC() && !$Viewer->IRCKey()) {
$ircKey = randomString(32);
$Viewer->setField('IRCKey', $ircKey)->modify();
}
$userMan = new Gazelle\Manager\User;
$ircNick = str_replace('.', '', $Viewer->username());
if (!$ircNick || $userMan->findByUsername($ircNick)) {
$ircNick = str_replace('.', '_', $Viewer->username());
if ($userMan->findByUsername($ircNick)) {
$ircNick = str_replace('.', '%2E', $Viewer->username());
}
}
if (is_numeric(substr($ircNick, 0, 1))) {
$ircNick = '_' . $ircNick;
}
echo $Twig->render('chat/webirc.twig', [
'user' => $Viewer,
'irc_nick' => $ircNick,
]);

View File

@@ -83,7 +83,7 @@ recheck your spam folder), join the <tt>#recovery</tt> channel on IRC.</p>
<blockquote>
<h4>IRC details</h4>
<p>Server: <tt>irc.orpheus.network</tt><br />
<p>Server: <tt><?= IRC_PUBLIC_SERVER ?></tt><br />
Port: 6667 or +7000 for SSL</p>
</blockquote>

38
templates/chat/index.twig Normal file
View File

@@ -0,0 +1,38 @@
{{ header('Chat') }}
{% if user.disableIRC %}
<div class="thin">
<div class="header">
<h3 id="irc">IRC Privileges Disabled</h3>
</div>
<div class="box pad" style="padding: 10px 10px 10px 20px;">
<strong>Your IRC privileges are disabled.</strong>
</div>
</div>
{% else %}
<div class="thin">
<div class="header">
<h3 id="irc">IRC Rules - Please read these carefully!</h3>
</div>
<div class="box pad" style="padding: 10px 10px 10px 20px;">
{% include 'rules/irc.twig' %}
</div>
</div>
<div class="thin">
<div class="header">
<h3 id="general">Join the Chat</h3>
</div>
<div class="box pad" style="padding: 10px 0px 10px 0px;">
<div style="padding: 0px 10px 10px 20px;">
<p>If you have an IRC client, refer to <a href="wiki.php?action=article&amp;name=irc">
this wiki article</a> for information on how to connect.</p>
<p>Alternatively you can use our web client.</p>
<p>
<a href="chat.php?action=webirc" target="_blank" class="ircjoin">
<button style="padding: .5em">Join Chat (opens new window)</button>
</a>
</p>
</div>
</div>
</div>
{% endif %}
{{ footer() }}

View File

@@ -0,0 +1,89 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1">
<meta name="referrer" content="same-origin" />
<link rel="shortcut icon" href="/favicon.ico" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
<title>{{ constant('SITE_NAME') }} Chat</title>
<style>
/* target specific styles */
body {
/* disable the 'pull down to refresh' on mobiles */
overflow: hidden;
}
.kiwi-noscript-warn {
text-align: center;
font-weight: bold;
padding: 1em;
}
</style>
<link href="{{ constant('STATIC_SERVER') }}/assets/kiwi/static/css/app.c63fa69d.css" rel="preload" as="style">
<link href="{{ constant('STATIC_SERVER') }}/assets/kiwi/static/js/app.ed817c69.js" rel="preload" as="script">
<link href="{{ constant('STATIC_SERVER') }}/assets/kiwi/static/js/vendor.a2ff8ba8.js" rel="preload" as="script">
<link href="{{ constant('STATIC_SERVER') }}/assets/kiwi/static/css/app.c63fa69d.css" rel="stylesheet">
</head>
<body>
{% if user.disableIRC %}
<div>Your IRC privileges are disabled.</div>
{% else %}
<noscript>
<div class="kiwi-noscript-warn">
Please enable JavaScript and refresh the page to use this website.
</div>
</noscript>
<script type="application/json" name="kiwiconfig">
{
"windowTitle": "{{ constant('SITE_NAME') }} Chat",
"startupScreen": "welcome",
"restricted": true,
"useMonospace": true,
"sidebarDefault": "nicklist",
"theme": "Dark",
"themes": [
{ "name": "Default", "url": "{{ constant('STATIC_SERVER') }}/assets/kiwi/static/themes/default" },
{ "name": "Dark", "url": "{{ constant('STATIC_SERVER') }}/assets/kiwi/static/themes/dark" },
{ "name": "Coffee", "url": "{{ constant('STATIC_SERVER') }}/assets/kiwi/static/themes/coffee" },
{ "name": "GrayFox", "url": "{{ constant('STATIC_SERVER') }}/assets/kiwi/static/themes/grayfox" },
{ "name": "Nightswatch", "url": "{{ constant('STATIC_SERVER') }}/assets/kiwi/static/themes/nightswatch" },
{ "name": "Osprey", "url": "{{ constant('STATIC_SERVER') }}/assets/kiwi/static/themes/osprey" },
{ "name": "Radioactive", "url": "{{ constant('STATIC_SERVER') }}/assets/kiwi/static/themes/radioactive" },
{ "name": "Sky", "url": "{{ constant('STATIC_SERVER') }}/assets/kiwi/static/themes/sky" },
{ "name": "Elite", "url": "{{ constant('STATIC_SERVER') }}/assets/kiwi/static/themes/elite" }
],
"startupOptions" : {
"server": "{{ constant('IRC_PUBLIC_SERVER') }}",
"port": 8000,
"tls": true,
"direct": true,
"nick": "{{ irc_nick }}",
"channel": "#orpheus",
"greetingText": "Welcome to {{ constant('SITE_NAME') }} IRC",
"buttonText": "Join",
"showPassword": true
},
"buffers": {
"show_link_previews": false,
"inline_link_auto_previews": false,
"inline_link_auto_previews_query": false,
"messageLayout": "compact",
"alert_on": "highlight",
"show_timestamps": true,
"show_hostnames": true,
"who_loop": false,
"nicklist_avatars": false
},
"plugins": [
{"name": "hermes_join", "url": "{{ constant('STATIC_SERVER') }}/assets/kiwi/plugins/hermes_join.js"}
],
"hermes": {
"ircuser": "{{ user.username }}",
"irckey": "{{ user.IRCKey }}"
}
}
</script>
<div id="app"></div>
<script type="text/javascript" src="{{ constant('STATIC_SERVER') }}/assets/kiwi/static/js/vendor.a2ff8ba8.js"></script>
<script type="text/javascript" src="{{ constant('STATIC_SERVER') }}/assets/kiwi/static/js/app.ed817c69.js"></script>
{% endif %}

View File

@@ -92,7 +92,7 @@
<li id="nav_collages"{{ _self.active(document == 'collages') }}><a href="collages.php">Collages</a> </li>
<li id="nav_requests"{{ _self.active(document == 'requests') }}><a href="requests.php">Requests</a> </li>
<li id="nav_forums"{{ _self.active(document == 'forums') }}><a href="forums.php">Forums</a> </li>
<li id="nav_irc"{{ _self.active(document == 'chat') }}><a href="wiki.php?action=article&amp;name=irc">IRC</a> </li>
<li id="nav_irc"{{ _self.active(document == 'chat') }}><a href="chat.php">IRC</a> </li>
<li id="nav_top10"{{ _self.active(document == 'top10') }}><a href="top10.php">Top 10</a> </li>
<li id="nav_rules"{{ _self.active(document == 'rules') }}><a href="rules.php">Rules</a> </li>
<li id="nav_wiki"{{ _self.active(document == 'wiki') }}><a href="wiki.php">Wiki</a> </li>

View File

@@ -4,7 +4,7 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<meta name="referrer" content="none, no-referrer, same-origin" />
<meta name="referrer" content="same-origin" />
<title>{{ page_title }}</title>
<link rel="shortcut icon" href="/favicon.ico" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />

View File

@@ -4,7 +4,7 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<meta name="referrer" content="none, no-referrer, same-origin" />
<meta name="referrer" content="same-origin" />
<title>{{ page_title }}</title>
<link rel="shortcut icon" href="/favicon.ico" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />

View File

@@ -9,8 +9,8 @@
Since this is a new installation, you can log in directly without having to confirm your account.
{% else %}
An email has been sent to the address that you provided. After you confirm your email address, you will be able to log into your account.
If you do not receive a response within a couple of hours, you may try contacting staff on IRC. Join <tt>irc.orpheus.network</tt>,
channel <tt>#disabled</tt>. Depending on the timezone you may have to wait, but you will receive a response.
If you do not receive a response within a couple of hours, you may try contacting staff on IRC. Join <code>{{ constant('IRC_PUBLIC_SERVER') }}</code>,
channel <code>#disabled</code>. Depending on the timezone you may have to wait, but you will receive a response.
{% endif %}
{% else %}
{% if invite %}

View File

@@ -30,7 +30,7 @@ account is still unconfirmed, a new email will be sent to the address you
gave when signing up.<p>
<p>When all else fails, try contacting staff on IRC. Join
<tt>irc.orpheus.network</tt>, channel <tt>#disabled</tt>. Depending on the
<code>{{ constant('IRC_PUBLIC_SERVER') }}</code>, channel <code>#disabled</code>. Depending on the
timezone you may have to wait, but you will receive a response.</li>
</div>

View File

@@ -26,7 +26,7 @@ correct it and try again.</li>
<li>The invitation has already been used, either by you or someone else.
You should contact the person who invited you, and they can check their
invitees. Otherwise you may try contacting staff on IRC. Join
<tt>irc.orpheus.network</tt>, channel <tt>#disabled</tt>. Depending on the
<code>{{ constant('IRC_PUBLIC_SERVER') }}</code>, channel <code>#disabled</code>. Depending on the
timezone you may have to wait, but you will receive a response.</li>
</ul>