Browse Source

remove custom modes

main
ghost 10 months ago
parent
commit
cd7f953d05
  1. 2
      .env
  2. 6
      README.md
  3. 16
      public/css/default.css
  4. 1
      src/Controller/ModuleController.php
  5. 28
      src/Controller/RoomController.php
  6. 2
      templates/default/layout.html.twig
  7. 2
      templates/default/module/post.html.twig
  8. 2
      templates/default/module/room.html.twig
  9. 8
      templates/default/module/rooms.html.twig
  10. 10
      templates/default/room/index.html.twig
  11. 2
      templates/default/room/list.html.twig
  12. 6
      templates/default/user/list.html.twig

2
.env

@ -19,7 +19,7 @@ APP_ENV=dev
APP_SECRET=EDIT_ME APP_SECRET=EDIT_ME
###< symfony/framework-bundle ### ###< symfony/framework-bundle ###
APP_VERSION=1.12.0 APP_VERSION=1.12.1
APP_NAME=KevaChat APP_NAME=KevaChat

6
README.md

@ -64,12 +64,6 @@ Application package contain settings preset, just few steps required to launch:
* Create at least one room namespace with Web UI or CLI `kevacoin-cli keva_namespace "sandbox"` * Create at least one room namespace with Web UI or CLI `kevacoin-cli keva_namespace "sandbox"`
* Provide at least one namespace for default chat room to `env`.`APP_KEVACOIN_ROOM_NAMESPACE_DEFAULT` (for homepage redirects) * Provide at least one namespace for default chat room to `env`.`APP_KEVACOIN_ROOM_NAMESPACE_DEFAULT` (for homepage redirects)
## Modes
KevaChat supported following `mode` in `GET` requests:
* `stream` - useful for iframe integrations on external websites to create news feed or support chats
## Contribution ## Contribution
Project created by people for people: MIT License to use it for other needs e.g. new fork, chat instance or KevaCoin blockchain explorer. Project created by people for people: MIT License to use it for other needs e.g. new fork, chat instance or KevaCoin blockchain explorer.

16
public/css/default.css

@ -287,20 +287,4 @@ footer > form > output
display: block; display: block;
font-weight: bolder; font-weight: bolder;
margin-bottom: 16px; margin-bottom: 16px;
}
/* apply mode corrections */
body[data-mode="stream"] > header
{
display: none;
}
body[data-mode="stream"] > main
{
padding-top: 0;
}
body[data-mode="stream"] > main ul li div a[name]
{
top: -16px;
} }

1
src/Controller/ModuleController.php

@ -188,7 +188,6 @@ class ModuleController extends AbstractController
return $this->render( return $this->render(
'default/module/post.html.twig', 'default/module/post.html.twig',
[ [
'mode' => $request->get('mode'),
'namespace' => $request->get('namespace'), 'namespace' => $request->get('namespace'),
'error' => $request->get('error'), 'error' => $request->get('error'),
'warning' => $request->get('warning'), 'warning' => $request->get('warning'),

28
src/Controller/RoomController.php

@ -32,7 +32,6 @@ class RoomController extends AbstractController
return $this->redirectToRoute( return $this->redirectToRoute(
'room_namespace', 'room_namespace',
[ [
'mode' => $request->get('mode'),
'namespace' => $request->get('namespace') ? $request->get('namespace') : $this->getParameter('app.kevacoin.room.namespace.default'), 'namespace' => $request->get('namespace') ? $request->get('namespace') : $this->getParameter('app.kevacoin.room.namespace.default'),
'_fragment' => 'latest' '_fragment' => 'latest'
] ]
@ -365,7 +364,6 @@ class RoomController extends AbstractController
return $this->redirectToRoute( return $this->redirectToRoute(
'room_namespace', 'room_namespace',
[ [
'mode' => $request->get('mode'),
'namespace' => $request->get('namespace'), 'namespace' => $request->get('namespace'),
'message' => $request->get('message'), 'message' => $request->get('message'),
'sign' => $request->get('sign'), 'sign' => $request->get('sign'),
@ -413,7 +411,6 @@ class RoomController extends AbstractController
return $this->redirectToRoute( return $this->redirectToRoute(
'room_namespace', 'room_namespace',
[ [
'mode' => $request->get('mode'),
'namespace' => $request->get('namespace'), 'namespace' => $request->get('namespace'),
'message' => $request->get('message'), 'message' => $request->get('message'),
'sign' => $request->get('sign'), 'sign' => $request->get('sign'),
@ -437,7 +434,6 @@ class RoomController extends AbstractController
return $this->redirectToRoute( return $this->redirectToRoute(
'room_namespace', 'room_namespace',
[ [
'mode' => $request->get('mode'),
'namespace' => $request->get('namespace'), 'namespace' => $request->get('namespace'),
'message' => $request->get('message'), 'message' => $request->get('message'),
'sign' => $request->get('sign'), 'sign' => $request->get('sign'),
@ -466,7 +462,6 @@ class RoomController extends AbstractController
return $this->redirectToRoute( return $this->redirectToRoute(
'room_namespace', 'room_namespace',
[ [
'mode' => $request->get('mode'),
'namespace' => $request->get('namespace'), 'namespace' => $request->get('namespace'),
'message' => $request->get('message'), 'message' => $request->get('message'),
'sign' => $request->get('sign'), 'sign' => $request->get('sign'),
@ -482,7 +477,6 @@ class RoomController extends AbstractController
return $this->redirectToRoute( return $this->redirectToRoute(
'room_namespace', 'room_namespace',
[ [
'mode' => $request->get('mode'),
'namespace' => $request->get('namespace'), 'namespace' => $request->get('namespace'),
'message' => $request->get('message'), 'message' => $request->get('message'),
'sign' => $request->get('sign'), 'sign' => $request->get('sign'),
@ -501,7 +495,6 @@ class RoomController extends AbstractController
return $this->redirectToRoute( return $this->redirectToRoute(
'room_namespace', 'room_namespace',
[ [
'mode' => $request->get('mode'),
'namespace' => $request->get('namespace'), 'namespace' => $request->get('namespace'),
'message' => $request->get('message'), 'message' => $request->get('message'),
'sign' => $request->get('sign'), 'sign' => $request->get('sign'),
@ -520,7 +513,6 @@ class RoomController extends AbstractController
return $this->redirectToRoute( return $this->redirectToRoute(
'room_namespace', 'room_namespace',
[ [
'mode' => $request->get('mode'),
'namespace' => $request->get('namespace'), 'namespace' => $request->get('namespace'),
'message' => $request->get('message'), 'message' => $request->get('message'),
'sign' => $request->get('sign'), 'sign' => $request->get('sign'),
@ -536,7 +528,6 @@ class RoomController extends AbstractController
return $this->redirectToRoute( return $this->redirectToRoute(
'room_namespace', 'room_namespace',
[ [
'mode' => $request->get('mode'),
'namespace' => $request->get('namespace'), 'namespace' => $request->get('namespace'),
'message' => $request->get('message'), 'message' => $request->get('message'),
'sign' => $request->get('sign'), 'sign' => $request->get('sign'),
@ -556,7 +547,6 @@ class RoomController extends AbstractController
return $this->redirectToRoute( return $this->redirectToRoute(
'room_namespace', 'room_namespace',
[ [
'mode' => $request->get('mode'),
'namespace' => $request->get('namespace'), 'namespace' => $request->get('namespace'),
'message' => $request->get('message'), 'message' => $request->get('message'),
'sign' => $request->get('sign'), 'sign' => $request->get('sign'),
@ -575,7 +565,6 @@ class RoomController extends AbstractController
return $this->redirectToRoute( return $this->redirectToRoute(
'room_namespace', 'room_namespace',
[ [
'mode' => $request->get('mode'),
'namespace' => $request->get('namespace'), 'namespace' => $request->get('namespace'),
'message' => $request->get('message'), 'message' => $request->get('message'),
'sign' => $request->get('sign'), 'sign' => $request->get('sign'),
@ -649,7 +638,6 @@ class RoomController extends AbstractController
return $this->redirectToRoute( return $this->redirectToRoute(
'room_namespace', 'room_namespace',
[ [
'mode' => $request->get('mode'),
'namespace' => $request->get('namespace'), 'namespace' => $request->get('namespace'),
'sign' => $request->get('sign'), 'sign' => $request->get('sign'),
'error' => null, 'error' => null,
@ -722,7 +710,6 @@ class RoomController extends AbstractController
return $this->redirectToRoute( return $this->redirectToRoute(
'room_namespace', 'room_namespace',
[ [
'mode' => $request->get('mode'),
'namespace' => $request->get('namespace'), 'namespace' => $request->get('namespace'),
'sign' => $request->get('sign'), 'sign' => $request->get('sign'),
'message' => null, 'message' => null,
@ -768,7 +755,6 @@ class RoomController extends AbstractController
return $this->redirectToRoute( return $this->redirectToRoute(
'room_namespace', 'room_namespace',
[ [
'mode' => $request->get('mode'),
'namespace' => $request->get('namespace'), 'namespace' => $request->get('namespace'),
'sign' => $request->get('sign'), 'sign' => $request->get('sign'),
'error' => null, 'error' => null,
@ -783,7 +769,6 @@ class RoomController extends AbstractController
return $this->redirectToRoute( return $this->redirectToRoute(
'room_namespace', 'room_namespace',
[ [
'mode' => $request->get('mode'),
'namespace' => $request->get('namespace'), 'namespace' => $request->get('namespace'),
'message' => $request->get('message'), 'message' => $request->get('message'),
'sign' => $request->get('sign'), 'sign' => $request->get('sign'),
@ -813,7 +798,6 @@ class RoomController extends AbstractController
return $this->redirectToRoute( return $this->redirectToRoute(
'room_namespace', 'room_namespace',
[ [
'mode' => $request->get('mode'),
'namespace' => $request->get('namespace'), 'namespace' => $request->get('namespace'),
'message' => $request->get('message'), 'message' => $request->get('message'),
'error' => $this->getParameter('app.maintenance'), 'error' => $this->getParameter('app.maintenance'),
@ -864,7 +848,6 @@ class RoomController extends AbstractController
return $this->redirectToRoute( return $this->redirectToRoute(
'room_list', 'room_list',
[ [
'mode' => $request->get('mode'),
'name' => $name, 'name' => $name,
'error' => $translator->trans('Session token expired') 'error' => $translator->trans('Session token expired')
] ]
@ -877,7 +860,6 @@ class RoomController extends AbstractController
return $this->redirectToRoute( return $this->redirectToRoute(
'room_list', 'room_list',
[ [
'mode' => $request->get('mode'),
'name' => $name, 'name' => $name,
'error' => $translator->trans('Name length out of KevaCoin protocol limits') 'error' => $translator->trans('Name length out of KevaCoin protocol limits')
] ]
@ -890,7 +872,6 @@ class RoomController extends AbstractController
return $this->redirectToRoute( return $this->redirectToRoute(
'room_list', 'room_list',
[ [
'mode' => $request->get('mode'),
'name' => $name, 'name' => $name,
'error' => sprintf( 'error' => sprintf(
$translator->trans('Room name does not match node requirements: %s'), $translator->trans('Room name does not match node requirements: %s'),
@ -906,7 +887,6 @@ class RoomController extends AbstractController
return $this->redirectToRoute( return $this->redirectToRoute(
'room_list', 'room_list',
[ [
'mode' => $request->get('mode'),
'name' => $name, 'name' => $name,
'error' => $translator->trans('Could not create namespace in meta area') 'error' => $translator->trans('Could not create namespace in meta area')
] ]
@ -926,7 +906,6 @@ class RoomController extends AbstractController
return $this->redirectToRoute( return $this->redirectToRoute(
'room_list', 'room_list',
[ [
'mode' => $request->get('mode'),
'name' => $name, 'name' => $name,
'error' => $translator->trans('Room with same name already exists on this node!') 'error' => $translator->trans('Room with same name already exists on this node!')
] ]
@ -939,7 +918,6 @@ class RoomController extends AbstractController
return $this->redirectToRoute( return $this->redirectToRoute(
'room_list', 'room_list',
[ [
'mode' => $request->get('mode'),
'name' => $name, 'name' => $name,
'error' => sprintf( 'error' => sprintf(
$translator->trans('Access denied for host %s!'), $translator->trans('Access denied for host %s!'),
@ -955,7 +933,6 @@ class RoomController extends AbstractController
return $this->redirectToRoute( return $this->redirectToRoute(
'room_list', 'room_list',
[ [
'mode' => $request->get('mode'),
'name' => $name, 'name' => $name,
'error' => sprintf( 'error' => sprintf(
$translator->trans('Access restricted for host %s!'), $translator->trans('Access restricted for host %s!'),
@ -972,7 +949,6 @@ class RoomController extends AbstractController
return $this->redirectToRoute( return $this->redirectToRoute(
'room_list', 'room_list',
[ [
'mode' => $request->get('mode'),
'name' => $name, 'name' => $name,
'error' => sprintf( 'error' => sprintf(
$translator->trans('Please wait for %s seconds before add new room!'), $translator->trans('Please wait for %s seconds before add new room!'),
@ -988,7 +964,6 @@ class RoomController extends AbstractController
return $this->redirectToRoute( return $this->redirectToRoute(
'room_list', 'room_list',
[ [
'mode' => $request->get('mode'),
'name' => $name, 'name' => $name,
'error' => $translator->trans('Insufficient funds') 'error' => $translator->trans('Insufficient funds')
] ]
@ -1046,7 +1021,6 @@ class RoomController extends AbstractController
return $this->redirectToRoute( return $this->redirectToRoute(
'room_list', 'room_list',
[ [
'mode' => $request->get('mode'),
'name' => $name, 'name' => $name,
'warning' => sprintf( 'warning' => sprintf(
$translator->trans('To complete, send %s KVA to %s'), $translator->trans('To complete, send %s KVA to %s'),
@ -1093,7 +1067,6 @@ class RoomController extends AbstractController
return $this->redirectToRoute( return $this->redirectToRoute(
'room_namespace', 'room_namespace',
[ [
'mode' => $request->get('mode'),
'namespace' => $namespace['namespaceId'], 'namespace' => $namespace['namespaceId'],
'error' => null, 'error' => null,
'message' => null, 'message' => null,
@ -1106,7 +1079,6 @@ class RoomController extends AbstractController
return $this->redirectToRoute( return $this->redirectToRoute(
'room_list', 'room_list',
[ [
'mode' => $request->get('mode'),
'name' => $name, 'name' => $name,
'error' => $translator->trans('Internal error! Please feedback') 'error' => $translator->trans('Internal error! Please feedback')
] ]

2
templates/default/layout.html.twig

@ -5,7 +5,7 @@
<title>{% block head_title_content %}{{ app.name }}{% endblock %}</title> <title>{% block head_title_content %}{{ app.name }}{% endblock %}</title>
<link rel="stylesheet" type="text/css" href="{{ url('room_index') }}css/default.css?{{ app.version }}"/> <link rel="stylesheet" type="text/css" href="{{ url('room_index') }}css/default.css?{{ app.version }}"/>
</head> </head>
<body data-mode="{% if request.get('mode') %}stream{% else %}webapp{% endif %}"> <body>
{% block header_container %} {% block header_container %}
<header> <header>
{% block header_content %} {% block header_content %}

2
templates/default/module/post.html.twig

@ -1,5 +1,5 @@
{% if enabled %} {% if enabled %}
<form name="post" action="{{ path('room_post', { mode : mode, namespace : namespace }) }}" method="post"> <form name="post" action="{{ path('room_post', { namespace : namespace }) }}" method="post">
{% if error %} {% if error %}
<output name="error" for="form-post-message">{{ error }}</output> <output name="error" for="form-post-message">{{ error }}</output>
{% endif %} {% endif %}

2
templates/default/module/room.html.twig

@ -1,4 +1,4 @@
<form name="room" action="{{ path('room_add', { mode : request.get('mode') }) }}" method="post"> <form name="room" action="{{ path('room_add') }}" method="post">
{% if request.get('error') %} {% if request.get('error') %}
<output name="error" for="form-room-name">{{ request.get('error') }}</output> <output name="error" for="form-room-name">{{ request.get('error') }}</output>
{% endif %} {% endif %}

8
templates/default/module/rooms.html.twig

@ -1,4 +1,4 @@
<form name="rooms" action="{{ path('room_index', { mode : request.get('mode') }) }}" method="get"> <form name="rooms" action="{{ path('room_index') }}" method="get">
<input type="text" name="namespace" value="{{ request.get('namespace') }}" placeholder="{{ 'join room by kevacoin namespace...' | trans }}" /> <input type="text" name="namespace" value="{{ request.get('namespace') }}" placeholder="{{ 'join room by kevacoin namespace...' | trans }}" />
</form> </form>
{% if list %} {% if list %}
@ -8,7 +8,7 @@
{% if namespace == request.get('namespace') %} {% if namespace == request.get('namespace') %}
{{ namespace | keva_namespace_value }} {{ namespace | keva_namespace_value }}
{% else %} {% else %}
<a href="{{ path('room_namespace', { mode : request.get('mode'), namespace : namespace, _fragment : 'latest' }) }}">{{ namespace | keva_namespace_value }}</a> <a href="{{ path('room_namespace', { namespace : namespace, _fragment : 'latest' }) }}">{{ namespace | keva_namespace_value }}</a>
{% endif %} {% endif %}
</h2> </h2>
<sup> <sup>
@ -26,7 +26,7 @@
{% if 'room_list' == request.get('_route') %} {% if 'room_list' == request.get('_route') %}
{{ 'rooms' | trans }} {{ 'rooms' | trans }}
{% else %} {% else %}
<a href="{{ path('room_list', { mode : request.get('mode') }) }}">{{ 'rooms' | trans }}</a> <a href="{{ path('room_list') }}">{{ 'rooms' | trans }}</a>
{% endif %} {% endif %}
</i> </i>
</h2> </h2>
@ -41,7 +41,7 @@
{% if 'user_list' == request.get('_route') %} {% if 'user_list' == request.get('_route') %}
{{ 'users' | trans }} {{ 'users' | trans }}
{% else %} {% else %}
<a href="{{ path('user_list', { mode : request.get('mode') }) }}">{{ 'users' | trans }}</a> <a href="{{ path('user_list') }}">{{ 'users' | trans }}</a>
{% endif %} {% endif %}
</i> </i>
</h2> </h2>

10
templates/default/room/index.html.twig

@ -1,4 +1,4 @@
{% macro recursive_post_tree(mode, namespace, writable, tree) %} {% macro recursive_post_tree(namespace, writable, tree) %}
{% import _self as self %} {% import _self as self %}
{% if tree | length %} {% if tree | length %}
<ul> <ul>
@ -22,10 +22,10 @@
</svg> </svg>
</span> </span>
{% else %} {% else %}
<a rel="nofollow" href="{{ path('room_namespace', { mode : mode, namespace : namespace, _fragment : post.txid }) }}" title="{{ post.time | date('c') }}">{{ post.time | format_ago }}</a> <a rel="nofollow" href="{{ path('room_namespace', { namespace : namespace, _fragment : post.txid }) }}" title="{{ post.time | date('c') }}">{{ post.time | format_ago }}</a>
{% if writable %} {% if writable %}
&bull; &bull;
<a rel="nofollow" href="{{ path('room_namespace', { mode : mode, namespace : namespace, txid : post.txid, _fragment : post.txid }) }}">{{ 'reply' | trans }}</a> <a rel="nofollow" href="{{ path('room_namespace', { namespace : namespace, txid : post.txid, _fragment : post.txid }) }}">{{ 'reply' | trans }}</a>
{% endif %} {% endif %}
{% endif %} {% endif %}
<small> <small>
@ -43,7 +43,7 @@
}} }}
</div> </div>
{% if post.tree is defined and post.tree | length %} {% if post.tree is defined and post.tree | length %}
{{ self.recursive_post_tree(mode, namespace, writable, post.tree) }} {{ self.recursive_post_tree(namespace, writable, post.tree) }}
{% endif %} {% endif %}
</li> </li>
{% endfor %} {% endfor %}
@ -55,7 +55,7 @@
{% block head_title_content %}{{ request.get('namespace') | keva_namespace_value }} - {{ app.name }}{% endblock %} {% block head_title_content %}{{ request.get('namespace') | keva_namespace_value }} - {{ app.name }}{% endblock %}
{% block main_content %} {% block main_content %}
{% if tree %} {% if tree %}
{{ recursive_post_tree(request.get('mode'), request.get('namespace'), writable, tree) }} {{ recursive_post_tree(request.get('namespace'), writable, tree) }}
<a name="latest"></a> <a name="latest"></a>
{% else %} {% else %}
<ul> <ul>

2
templates/default/room/list.html.twig

@ -7,7 +7,7 @@
<li> <li>
<div> <div>
<strong> <strong>
<a href="{{ path('room_namespace', { mode : request.get('mode'), namespace : room.namespace, _fragment : 'latest' }) }}">{{ room.namespace | keva_namespace_value }}</a> <a href="{{ path('room_namespace', { namespace : room.namespace, _fragment : 'latest' }) }}">{{ room.namespace | keva_namespace_value }}</a>
</strong> </strong>
{{ room.total }} {{ room.total }}
<a href="{{ path('room_namespace', { namespace : room.namespace, feed : 'rss' }) }}" title="{{ 'RSS' | trans }}" target="_blank"><svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" fill="currentColor" viewBox="0 0 16 16"> <a href="{{ path('room_namespace', { namespace : room.namespace, feed : 'rss' }) }}" title="{{ 'RSS' | trans }}" target="_blank"><svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" fill="currentColor" viewBox="0 0 16 16">

6
templates/default/user/list.html.twig

@ -20,11 +20,7 @@
{{ 'rooms' | trans }}: {{ 'rooms' | trans }}:
{% for namespace, total in user.rooms %} {% for namespace, total in user.rooms %}
<a href="{{ <a href="{{
path('room_namespace', path('room_namespace', { namespace : namespace, _fragment : 'latest' }) }}">{{ namespace | keva_namespace_value }}</a>
{
mode : request.get('mode'),
namespace : namespace, _fragment : 'latest'
}) }}">{{ namespace | keva_namespace_value }}</a>
{{ total }} {{ total }}
{% endfor %} {% endfor %}
</p> </p>

Loading…
Cancel
Save