Compare commits
14
Commits
fe4da41268
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a00dcc4e70 | ||
|
|
756d2a98b2 | ||
|
|
e28a164a5c | ||
|
|
4c91cd062f | ||
|
|
9b198acaab | ||
|
|
ea96ffa45a | ||
|
|
430bab4159 | ||
|
|
f11f5d92e1 | ||
|
|
11c3036cbe | ||
|
|
81edc44b8a | ||
|
|
afb1caae3d | ||
|
|
71c0583a5a | ||
|
|
1e351b4727 | ||
|
|
3bc0ee20e8 |
No files matched your search
@@ -3,3 +3,4 @@ _site
|
|||||||
.jekyll-cache
|
.jekyll-cache
|
||||||
.jekyll-metadata
|
.jekyll-metadata
|
||||||
vendor
|
vendor
|
||||||
|
Gemfile.lock
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
GEM
|
|
||||||
remote: https://rubygems.org/
|
|
||||||
specs:
|
|
||||||
addressable (2.8.7)
|
|
||||||
public_suffix (>= 2.0.2, < 7.0)
|
|
||||||
colorator (1.1.0)
|
|
||||||
concurrent-ruby (1.3.4)
|
|
||||||
em-websocket (0.5.3)
|
|
||||||
eventmachine (>= 0.12.9)
|
|
||||||
http_parser.rb (~> 0)
|
|
||||||
eventmachine (1.2.7)
|
|
||||||
ffi (1.17.0)
|
|
||||||
ffi (1.17.0-arm64-darwin)
|
|
||||||
ffi (1.17.0-x86_64-darwin)
|
|
||||||
forwardable-extended (2.6.0)
|
|
||||||
google-protobuf (3.25.4)
|
|
||||||
google-protobuf (3.25.4-arm64-darwin)
|
|
||||||
google-protobuf (3.25.4-x86_64-darwin)
|
|
||||||
google-protobuf (3.25.4-x86_64-linux)
|
|
||||||
http_parser.rb (0.8.0)
|
|
||||||
i18n (1.14.5)
|
|
||||||
concurrent-ruby (~> 1.0)
|
|
||||||
jekyll (4.3.3)
|
|
||||||
addressable (~> 2.4)
|
|
||||||
colorator (~> 1.0)
|
|
||||||
em-websocket (~> 0.5)
|
|
||||||
i18n (~> 1.0)
|
|
||||||
jekyll-sass-converter (>= 2.0, < 4.0)
|
|
||||||
jekyll-watch (~> 2.0)
|
|
||||||
kramdown (~> 2.3, >= 2.3.1)
|
|
||||||
kramdown-parser-gfm (~> 1.0)
|
|
||||||
liquid (~> 4.0)
|
|
||||||
mercenary (>= 0.3.6, < 0.5)
|
|
||||||
pathutil (~> 0.9)
|
|
||||||
rouge (>= 3.0, < 5.0)
|
|
||||||
safe_yaml (~> 1.0)
|
|
||||||
terminal-table (>= 1.8, < 4.0)
|
|
||||||
webrick (~> 1.7)
|
|
||||||
jekyll-archives (2.2.1)
|
|
||||||
jekyll (>= 3.6, < 5.0)
|
|
||||||
jekyll-datapage-generator (1.4.0)
|
|
||||||
jekyll-feed (0.17.0)
|
|
||||||
jekyll (>= 3.7, < 5.0)
|
|
||||||
jekyll-sass-converter (3.0.0)
|
|
||||||
sass-embedded (~> 1.54)
|
|
||||||
jekyll-watch (2.2.1)
|
|
||||||
listen (~> 3.0)
|
|
||||||
kramdown (2.4.0)
|
|
||||||
rexml
|
|
||||||
kramdown-parser-gfm (1.1.0)
|
|
||||||
kramdown (~> 2.0)
|
|
||||||
liquid (4.0.4)
|
|
||||||
listen (3.9.0)
|
|
||||||
rb-fsevent (~> 0.10, >= 0.10.3)
|
|
||||||
rb-inotify (~> 0.9, >= 0.9.10)
|
|
||||||
mercenary (0.4.0)
|
|
||||||
pathutil (0.16.2)
|
|
||||||
forwardable-extended (~> 2.6)
|
|
||||||
public_suffix (6.0.1)
|
|
||||||
rake (13.2.1)
|
|
||||||
rb-fsevent (0.11.2)
|
|
||||||
rb-inotify (0.11.1)
|
|
||||||
ffi (~> 1.0)
|
|
||||||
rexml (3.3.6)
|
|
||||||
strscan
|
|
||||||
rouge (4.3.0)
|
|
||||||
safe_yaml (1.0.5)
|
|
||||||
sass-embedded (1.69.5)
|
|
||||||
google-protobuf (~> 3.23)
|
|
||||||
rake (>= 13.0.0)
|
|
||||||
sass-embedded (1.69.5-arm64-darwin)
|
|
||||||
google-protobuf (~> 3.23)
|
|
||||||
sass-embedded (1.69.5-x86_64-darwin)
|
|
||||||
google-protobuf (~> 3.23)
|
|
||||||
strscan (3.1.0)
|
|
||||||
terminal-table (3.0.2)
|
|
||||||
unicode-display_width (>= 1.1.1, < 3)
|
|
||||||
unicode-display_width (2.5.0)
|
|
||||||
webrick (1.8.1)
|
|
||||||
|
|
||||||
PLATFORMS
|
|
||||||
arm64-darwin
|
|
||||||
ruby
|
|
||||||
x86_64-darwin
|
|
||||||
x86_64-linux
|
|
||||||
|
|
||||||
DEPENDENCIES
|
|
||||||
jekyll
|
|
||||||
jekyll-archives
|
|
||||||
jekyll-datapage-generator
|
|
||||||
jekyll-feed
|
|
||||||
|
|
||||||
BUNDLED WITH
|
|
||||||
2.5.16
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"title": "Introdução ao LMMS",
|
||||||
|
"user": "",
|
||||||
|
"author": "Matheus De Bomfim Rodrigues Jordão",
|
||||||
|
"description": " Introdução ao Hydrogen",
|
||||||
|
"date": "9\/07\/2024",
|
||||||
|
"aulas": [
|
||||||
|
"lmms"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
<a class="item-menu" href="{{ site.baseurl }}/">
|
<a class="item-menu" href="{{ site.baseurl }}/">
|
||||||
<li>
|
<li>
|
||||||
|
|
||||||
<span class="menu-txt">Inicio</span>
|
<span class="menu-txt" id="inicio">Inicio</span>
|
||||||
<i class="fa-solid fa-house mx-4"></i>
|
<i class="fa-solid fa-house mx-4"></i>
|
||||||
</li>
|
</li>
|
||||||
</a>
|
</a>
|
||||||
@@ -20,14 +20,14 @@
|
|||||||
<a class="item-menu" href="{{ site.baseurl }}/aulas">
|
<a class="item-menu" href="{{ site.baseurl }}/aulas">
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<span class="menu-txt">Aulas</span>
|
<span class="menu-txt"id="aulas">Aulas</span>
|
||||||
<i class="fa-solid fa-house mx-4"></i>
|
<i class="fa-solid fa-house mx-4"></i>
|
||||||
</li>
|
</li>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a class="item-menu" href="{{ site.baseurl }}/cursos">
|
<a class="item-menu" href="{{ site.baseurl }}/cursos">
|
||||||
<li>
|
<li>
|
||||||
<span class="menu-txt">Cursos</span>
|
<span class="menu-txt" id="cursos">Cursos</span>
|
||||||
<i class="fa-solid fa-house mx-4"></i>
|
<i class="fa-solid fa-house mx-4"></i>
|
||||||
</li>
|
</li>
|
||||||
</a>
|
</a>
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
|
|
||||||
<a class="item-menu" href="{{ site.baseurl }}/software">
|
<a class="item-menu" href="{{ site.baseurl }}/software">
|
||||||
<li>
|
<li>
|
||||||
<span class="menu-txt">Software</span>
|
<span class="menu-txt" id="software">Software</span>
|
||||||
<i class="fa-solid fa-house mx-4"></i>
|
<i class="fa-solid fa-house mx-4"></i>
|
||||||
</li>
|
</li>
|
||||||
</a>
|
</a>
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<a class="" href="{{ site.baseurl }}/dashboard">
|
<a class="" href="{{ site.baseurl }}/dashboard">
|
||||||
<span class="menu-txt">Dashboard</span>
|
<span class="menu-txt" id="Dashboard">Dashboard</span>
|
||||||
<i class="fa-solid fa-house mx-4"></i>
|
<i class="fa-solid fa-house mx-4"></i>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
+126
-134
@@ -1,24 +1,18 @@
|
|||||||
<table id="temporary-table" style="display: none;">
|
|
||||||
<tr>
|
|
||||||
<td>{{ include.user }}</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<div class="live-container">
|
<div class="live-container">
|
||||||
<div class="player-container">
|
<div class="player-container">
|
||||||
<video
|
<video
|
||||||
class="player"
|
class="player"
|
||||||
data-dashjs-player
|
data-dashjs-player
|
||||||
{% if page.user %}
|
{% if page.user %}
|
||||||
url="https://cast.alice.ufsj.edu.br/dash/{{page.user}}.mpd"
|
url="https://class.alice.ufsj.edu.br/dash/{{page.user}}.mpd"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
autoplay
|
autoplay
|
||||||
controls
|
controls
|
||||||
muted
|
muted
|
||||||
></video>
|
></video>
|
||||||
|
|
||||||
<div class="player-off">
|
<div class="player-off">
|
||||||
<h1>Offlinee</h1>
|
<h1>Offline</h1>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -30,158 +24,156 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="chat-views">
|
<div class="chat-views">
|
||||||
<i class="fa-solid fa-users"></i>
|
<i class="fa-solid fa-users"></i>
|
||||||
<!-- <h4>679 pessoas online</h4> -->
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Campo de nome do usuário -->
|
||||||
|
<div class="chat-username" style="margin-bottom: 10px;">
|
||||||
|
<label for="username-input">Seu nome:</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
id="username-input"
|
||||||
|
placeholder="Escolha um nome (ou deixe em branco)"
|
||||||
|
style="width: 100%; padding: 5px; margin-top: 5px;"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="chat-lines">
|
<div class="chat-lines">
|
||||||
<div class="chat-line">
|
<!-- Mensagens serão adicionadas aqui via JavaScript -->
|
||||||
<!-- <p><span class="username">{msg.nome}:</span> {msg.mensagem}</p> -->
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="chat-input">
|
<div class="chat-input">
|
||||||
<form on:submit|preventDefault={sendMessage} class="chat-input-form">
|
<form class="chat-input-form">
|
||||||
<input class="input chat-enter" placeholder="Converse com o chat aqui" bind:value={message} />
|
<input class="input chat-enter" placeholder="Converse com o chat aqui" />
|
||||||
<input type="submit" hidden />
|
<input type="submit" hidden />
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/assets/js/dash.all.min.js"></script>
|
<script src="/assets/js/dash.all.min.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// Obter a string de query da URL
|
|
||||||
const queryString = window.location.search;
|
const queryString = window.location.search;
|
||||||
// Criar um objeto URLSearchParams com a string de query
|
|
||||||
const urlParams = new URLSearchParams(queryString);
|
const urlParams = new URLSearchParams(queryString);
|
||||||
|
|
||||||
|
// =====================
|
||||||
|
// Player da live
|
||||||
|
// =====================
|
||||||
|
|
||||||
|
let streamUser;
|
||||||
{% if page.user %}
|
{% if page.user %}
|
||||||
const user = "{{page.user}}";
|
streamUser = "{{page.user}}";
|
||||||
{% else %}
|
{% else %}
|
||||||
const user = urlParams.get('user');
|
streamUser = urlParams.get('user');
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
// Exemplo de como usar o valor
|
if (!streamUser) {
|
||||||
console.log(user); // Isso vai exibir o valor do parâmetro 'user'
|
streamUser = "default"; // fallback para evitar erro
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("Usuário da live:", streamUser);
|
||||||
const videoElement = document.querySelector('video');
|
const videoElement = document.querySelector('video');
|
||||||
const playerOffElement = document.querySelector('.player-off');
|
const playerOffElement = document.querySelector('.player-off');
|
||||||
const url = `https://cast.alice.ufsj.edu.br/dash/${user}.mpd`;
|
const chatContainer = document.querySelector('.chat-container');
|
||||||
|
const chatForm = document.querySelector('.chat-input-form');
|
||||||
|
const usernameInput = document.querySelector('#username-input');
|
||||||
|
const chatInputField = document.querySelector('.chat-enter');
|
||||||
|
|
||||||
|
const url = `https://class.alice.ufsj.edu.br/dash/${streamUser}.mpd`;
|
||||||
videoElement.src = url;
|
videoElement.src = url;
|
||||||
|
|
||||||
|
let chatAtivo = false;
|
||||||
|
|
||||||
fetch(url)
|
fetch(url)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
console.log("Arquivo existe.");
|
console.log("Arquivo existe.");
|
||||||
playerOffElement.style.display = "none";
|
playerOffElement.style.display = "none";
|
||||||
|
iniciarChat();
|
||||||
|
} else {
|
||||||
} else {
|
console.log("Arquivo não encontrado.");
|
||||||
console.log("Arquivo não encontrado.");
|
videoElement.style.opacity = "0";
|
||||||
// Coloque o código para ocultar o vídeo aqui
|
|
||||||
videoElement.style.opacity = "0";
|
|
||||||
|
|
||||||
}
|
|
||||||
})
|
|
||||||
// URL do servidor WebSocket
|
|
||||||
const socket = new WebSocket('wss://cast.alice.ufsj.edu.br/chat/chat');
|
|
||||||
|
|
||||||
socket.addEventListener('open', () => {
|
if (chatContainer) {
|
||||||
console.log('Conexão WebSocket aberta com sucesso!');
|
chatContainer.style.opacity = "0.3";
|
||||||
});
|
chatContainer.style.pointerEvents = "none";
|
||||||
|
}
|
||||||
|
|
||||||
// Adiciona um manipulador de eventos para lidar com a recepção de mensagens
|
if (usernameInput) usernameInput.disabled = true;
|
||||||
socket.addEventListener('message', (event) => {
|
if (chatInputField) chatInputField.disabled = true;
|
||||||
console.log('Mensagem recebida do servidor:', event.data);
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Adiciona um manipulador de eventos para lidar com o fechamento da conexão
|
// =====================
|
||||||
socket.addEventListener('close', (event) => {
|
// Chat ao vivo
|
||||||
console.log('Conexão WebSocket fechada:', event.reason || 'Sem motivo específico');
|
// =====================
|
||||||
});
|
|
||||||
|
|
||||||
// Adiciona um manipulador de eventos para lidar com erros
|
function iniciarChat() {
|
||||||
socket.addEventListener('error', (event) => {
|
chatAtivo = true;
|
||||||
console.error('Erro no WebSocket:', event);
|
|
||||||
});
|
|
||||||
const nomesAlice = [
|
|
||||||
'Alice', 'Chapeleiro Maluco', 'Coelho Branco', 'Rainha de Copas',
|
|
||||||
'Gato de Cheshire', 'Lebre de Março', 'Lagarta', 'Dodo',
|
|
||||||
'Tweedledee', 'Tweedledum', 'Rainha Vermelha', 'Rei de Copas',
|
|
||||||
'JotaChina', 'JotaJapão', 'JotaÍndia', 'JotaCoreia', 'JotaTailândia',
|
|
||||||
'JotaVietnã', 'JotaMalásia', 'JotaIndonésia', 'JotaFilipinas',
|
|
||||||
'JotaSingapura', 'JotaNepal', 'JotaCamboja', 'JotaMianmar',
|
|
||||||
'JotaLaos', 'JotaBangladesh', 'JotaSriLanka'
|
|
||||||
];
|
|
||||||
|
|
||||||
function nomeAleatorio() {
|
const nomesAlice = [
|
||||||
return nomesAlice[Math.floor(Math.random() * nomesAlice.length)];
|
'Alice', 'Chapeleiro Maluco', 'Coelho Branco', 'Rainha de Copas',
|
||||||
|
'Gato de Cheshire', 'Lebre de Março', 'Lagarta', 'Dodo',
|
||||||
|
'Tweedledee', 'Tweedledum', 'Rainha Vermelha', 'Rei de Copas'
|
||||||
|
];
|
||||||
|
|
||||||
|
function nomeAleatorio() {
|
||||||
|
return nomesAlice[Math.floor(Math.random() * nomesAlice.length)];
|
||||||
|
}
|
||||||
|
|
||||||
|
let username = nomeAleatorio();
|
||||||
|
|
||||||
|
function setCustomUsername() {
|
||||||
|
const customUsername = usernameInput.value.trim();
|
||||||
|
username = customUsername || nomeAleatorio();
|
||||||
|
}
|
||||||
|
|
||||||
|
const source = new EventSource(`php/chat/relay.php?user=${encodeURIComponent(streamUser)}`);
|
||||||
|
|
||||||
|
let ultimaMensagem = "";
|
||||||
|
|
||||||
|
source.onmessage = function (event) {
|
||||||
|
if (event.data !== ultimaMensagem) {
|
||||||
|
ultimaMensagem = event.data;
|
||||||
|
const msg = JSON.parse(event.data);
|
||||||
|
addMessage(msg);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function sendMessage(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
const message = document.querySelector('.chat-enter').value;
|
||||||
|
if (!message.trim()) return;
|
||||||
|
|
||||||
|
const msgData = {
|
||||||
|
nome: username,
|
||||||
|
mensagem: message.trim()
|
||||||
|
};
|
||||||
|
|
||||||
|
fetch(`php/chat/send.php?user=${encodeURIComponent(streamUser)}`, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||||
|
body: 'mensagem=' + encodeURIComponent(JSON.stringify(msgData))
|
||||||
|
})
|
||||||
|
.catch(err => console.error("Erro ao enviar mensagem:", err));
|
||||||
|
|
||||||
|
document.querySelector('.chat-enter').value = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
function addMessage(msg) {
|
||||||
|
const chatLines = document.querySelector('.chat-lines');
|
||||||
|
const newMessage = document.createElement('div');
|
||||||
|
newMessage.classList.add('chat-line');
|
||||||
|
newMessage.innerHTML = `<p><span class=\"username\">${msg.nome}:</span> ${msg.mensagem}</p>`;
|
||||||
|
|
||||||
|
chatLines.appendChild(newMessage);
|
||||||
|
chatLines.scrollTop = chatLines.scrollHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
chatForm.addEventListener('submit', sendMessage);
|
||||||
|
usernameInput.addEventListener('change', setCustomUsername);
|
||||||
}
|
}
|
||||||
// Variáveis para armazenar o nome do usuário e a mensagem
|
</script>
|
||||||
let username = nomeAleatorio();
|
|
||||||
let message = '';
|
|
||||||
|
|
||||||
// Função que envia a mensagem
|
|
||||||
function sendMessage(event) {
|
|
||||||
event.preventDefault(); // Previne o comportamento padrão do formulário
|
|
||||||
|
|
||||||
// Cria um objeto com os dados da mensagem
|
|
||||||
const msgData = {
|
|
||||||
nome: username,
|
|
||||||
mensagem: message
|
|
||||||
};
|
|
||||||
|
|
||||||
// Envia a mensagem como uma string JSON
|
|
||||||
socket.send(JSON.stringify(msgData));
|
|
||||||
|
|
||||||
// Limpa o campo de entrada de mensagem
|
|
||||||
document.querySelector('.chat-enter').value = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Função que adiciona uma nova linha de mensagem ao chat
|
|
||||||
function addMessage(msg) {
|
|
||||||
console.log(msg);
|
|
||||||
|
|
||||||
const chatLines = document.querySelector('.chat-lines');
|
|
||||||
|
|
||||||
// Cria o elemento da mensagem
|
|
||||||
const newMessage = document.createElement('div');
|
|
||||||
newMessage.classList.add('chat-line');
|
|
||||||
newMessage.innerHTML = `<p><span class="username">${msg.nome}:</span> ${msg.mensagem}</p>`;
|
|
||||||
|
|
||||||
// Adiciona a nova mensagem no final da lista de mensagens
|
|
||||||
chatLines.appendChild(newMessage);
|
|
||||||
|
|
||||||
// Rola o chat para baixo para mostrar a nova mensagem
|
|
||||||
chatLines.scrollTop = chatLines.scrollHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Event listener para quando o WebSocket abrir a conexão
|
|
||||||
socket.addEventListener('open', () => {
|
|
||||||
console.log('Conectado ao servidor WebSocket');
|
|
||||||
});
|
|
||||||
|
|
||||||
// Event listener para quando uma mensagem é recebida do servidor
|
|
||||||
socket.addEventListener('message', event => {
|
|
||||||
// Parseia a mensagem recebida como JSON
|
|
||||||
const msg = JSON.parse(event.data);
|
|
||||||
|
|
||||||
// Adiciona a mensagem ao chat
|
|
||||||
addMessage(msg);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Event listener para o envio de mensagem no formulário
|
|
||||||
document.querySelector('.chat-input-form').addEventListener('submit', event => {
|
|
||||||
// Captura o valor do input
|
|
||||||
message = document.querySelector('.chat-enter').value;
|
|
||||||
|
|
||||||
// Chama a função que envia a mensagem
|
|
||||||
sendMessage(event);
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<!-- _includes/tutorial.html -->
|
||||||
|
<div id="tutorial-overlay" class="hidden">
|
||||||
|
<div id="tutorial-box">
|
||||||
|
<p id="tutorial-text">Texto do passo</p>
|
||||||
|
<button id="next-step">Próximo</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -5,7 +5,8 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css"> -->
|
<!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css"> -->
|
||||||
<!-- <link rel="stylesheet" href="{{ site.baseurl }}/assets/css/stylesheet.css"> -->
|
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/stylesheet.css">
|
||||||
|
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/tutorial.css">
|
||||||
<!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.3/css/bulma.min.css"> -->
|
<!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.3/css/bulma.min.css"> -->
|
||||||
|
|
||||||
{% if page.styles %}{{ page.styles }}{% endif %}
|
{% if page.styles %}{{ page.styles }}{% endif %}
|
||||||
@@ -24,5 +25,6 @@
|
|||||||
{{content}}
|
{{content}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<script src="{{ '/assets/js/tutorial.js' | relative_url }}"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
+69
-25
@@ -172,13 +172,14 @@ h1, h2, h3, h4, h5, h6 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.home-content .banner{
|
.home-content .banner{
|
||||||
height: 500px;
|
max-height: 100vh;
|
||||||
|
min-height: 75vh;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background: var(--deep-ruby) ;
|
background: var(--deep-ruby) ;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-position: center;
|
background-position: center;
|
||||||
border-radius: 30px;
|
border-radius: 30px;
|
||||||
|
background-color: var(--primary-color);
|
||||||
padding: 0 25px;
|
padding: 0 25px;
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -265,18 +266,21 @@ h1, h2, h3, h4, h5, h6 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ================================================================================================================================== */
|
/* ================================================================================================================================== */
|
||||||
/* CSS da pagina Aulas localizada em _content/Pages/index.html */
|
/* CSS da pagina Aulas localizada em _content/Pages/aulas.html */
|
||||||
|
|
||||||
.aulas-content{
|
.aulas-content{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.aulas-content .title-content{
|
.aulas-content .title-content{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
|
/* background-color: #007bff; */
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.aulas-content .title-content > :nth-child(1){
|
.aulas-content .title-content > :nth-child(1){
|
||||||
@@ -327,7 +331,7 @@ h1, h2, h3, h4, h5, h6 {
|
|||||||
background-color: var(--background-color);
|
background-color: var(--background-color);
|
||||||
box-shadow: -5px 5px 15px var(--primary-color);
|
box-shadow: -5px 5px 15px var(--primary-color);
|
||||||
|
|
||||||
margin: 25px 25px;
|
margin: 10px 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ================================================================================================================================== */
|
/* ================================================================================================================================== */
|
||||||
@@ -511,13 +515,14 @@ h1, h2, h3, h4, h5, h6 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.dashboard-content .banner{
|
.dashboard-content .banner{
|
||||||
height: 300px;
|
max-height: 100vh;
|
||||||
|
min-height: 75vh;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background: url('/assets/images/background.svg') ;
|
background: var(--deep-ruby) ;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-position: center;
|
background-position: center;
|
||||||
border-radius: 30px;
|
border-radius: 30px;
|
||||||
|
background-color: var(--primary-color);
|
||||||
padding: 0 25px;
|
padding: 0 25px;
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -573,7 +578,6 @@ h1, h2, h3, h4, h5, h6 {
|
|||||||
|
|
||||||
.player-off{
|
.player-off{
|
||||||
height: 80vh;
|
height: 80vh;
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
@@ -585,10 +589,9 @@ h1, h2, h3, h4, h5, h6 {
|
|||||||
|
|
||||||
.player-container {
|
.player-container {
|
||||||
position: relative;
|
position: relative;
|
||||||
/* width: 100%;
|
|
||||||
height: 100%; */
|
|
||||||
|
|
||||||
flex-grow: 10;
|
flex-grow: 10;
|
||||||
|
/* Em telas grandes, pode ser interessante adicionar margem para separar do chat */
|
||||||
|
/* margin: 15px; */
|
||||||
}
|
}
|
||||||
|
|
||||||
.player {
|
.player {
|
||||||
@@ -603,14 +606,13 @@ h1, h2, h3, h4, h5, h6 {
|
|||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background-color: rgba(0, 0, 0, 0.6); /* Cor de fundo semitransparente */
|
background-color: rgba(0, 0, 0, 0.6); /* Fundo semitransparente */
|
||||||
color: #fff;
|
color: #fff;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
border-radius: 15px;
|
border-radius: 15px;
|
||||||
z-index: 10; /* Garante que a mensagem "Offline" apareça em cima do vídeo */
|
z-index: 10; /* Garante que a mensagem "Offline" fique acima do player */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.player-info {
|
.player-info {
|
||||||
@@ -618,7 +620,7 @@ h1, h2, h3, h4, h5, h6 {
|
|||||||
background-color: #0b1a33;
|
background-color: #0b1a33;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Estilos específicos para o player, se necessário */
|
/* Estilos específicos para o player */
|
||||||
video::-webkit-media-controls {
|
video::-webkit-media-controls {
|
||||||
background-color: hsl(0, 0%, 14%);
|
background-color: hsl(0, 0%, 14%);
|
||||||
}
|
}
|
||||||
@@ -627,22 +629,24 @@ video::-webkit-media-controls-play-button {
|
|||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Container que engloba o player e o chat */
|
||||||
.live-container{
|
.live-container{
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: column; /* Padrão: empilha o player e o chat (telas pequenas) */
|
||||||
|
|
||||||
height: 70vh;
|
height: 70vh;
|
||||||
|
padding: 15px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Estilos do chat */
|
||||||
.chat {
|
.chat {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
margin: 15px;
|
margin: 15px;
|
||||||
background-color: var(--background-color);
|
background-color: var(--background-color);
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-container {
|
.chat-container {
|
||||||
@@ -677,6 +681,7 @@ color: #fff;
|
|||||||
.chat-line p {
|
.chat-line p {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
|
overflow-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
.username {
|
.username {
|
||||||
@@ -709,6 +714,45 @@ color: #fff;
|
|||||||
background-color: #243b65;
|
background-color: #243b65;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ===== Regras responsivas ===== */
|
||||||
|
|
||||||
|
/* Para telas grandes: layout em linha com chat à direita */
|
||||||
|
@media (min-width: 768px) {
|
||||||
|
.live-container {
|
||||||
|
flex-direction: row; /* Player e chat lado a lado */
|
||||||
|
align-items: stretch; /* Garante que ambos tenham a mesma altura */
|
||||||
|
}
|
||||||
|
|
||||||
|
.player-container {
|
||||||
|
flex-grow: 1;
|
||||||
|
margin: 15px; /* Opcional: ajuste de espaçamento */
|
||||||
|
}
|
||||||
|
|
||||||
|
.chat {
|
||||||
|
width: 400px; /* Largura fixa, semelhante à do chat da Twitch */
|
||||||
|
height: 95%; /* Alinha a altura do chat à do contêiner (e do player) */
|
||||||
|
margin: 15px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Para telas pequenas: layout em coluna com chat abaixo do player */
|
||||||
|
@media (max-width: 767px) {
|
||||||
|
.live-container {
|
||||||
|
flex-direction: column;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.player-container, .chat {
|
||||||
|
width: 100%;
|
||||||
|
margin: 15px 0; /* Espaçamento vertical */
|
||||||
|
}
|
||||||
|
|
||||||
|
.chat {
|
||||||
|
height: 500px; /* Altura ajustada para um tamanho adequado */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.page-aula{
|
.page-aula{
|
||||||
font-family: var(--font-family);
|
font-family: var(--font-family);
|
||||||
}
|
}
|
||||||
@@ -775,4 +819,4 @@ color: #fff;
|
|||||||
}
|
}
|
||||||
.content-aula a:hover {
|
.content-aula a:hover {
|
||||||
border-bottom-color: #007bff; /* Mostra a borda inferior ao passar o mouse */
|
border-bottom-color: #007bff; /* Mostra a borda inferior ao passar o mouse */
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
/* ================================================================================================================================== */
|
||||||
|
/* Variables */
|
||||||
|
:root {
|
||||||
|
/* Paleta de cors */
|
||||||
|
--midnight-blue: #0B1A33;
|
||||||
|
--cornflower-blue: #4B90F8;
|
||||||
|
--goldenrod: #D6A419;
|
||||||
|
--caribbean-green: #00C6BE;
|
||||||
|
--deep-ruby: #623A40;
|
||||||
|
--ivory: #F1F1E6;
|
||||||
|
--alice-blue: #F4F9FF;
|
||||||
|
--charcoal-blue: #35405D;
|
||||||
|
--slate-gray: #616B8B;
|
||||||
|
--light-slate-gray: #909ABB;
|
||||||
|
--periwinkle: #2d2e31;
|
||||||
|
|
||||||
|
/* Informaçoes da paleta de cores */
|
||||||
|
--primary-color: var(--midnight-blue);
|
||||||
|
--secondary-color: var(--cornflower-blue);
|
||||||
|
--tertiary-color: var(--periwinkle);
|
||||||
|
--gradient-backfround: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(75,144,248,1) 19%, rgba(97,157,246,1) 85%, rgba(241,241,230,0) 100%);
|
||||||
|
--accent-color: var(--goldenrod);
|
||||||
|
--background-color: var(--charcoal-blue);
|
||||||
|
--text-color: var( --alice-blue);
|
||||||
|
--secondary-text-color: var(--slate-gray);
|
||||||
|
--border-color: var(--deep-ruby);
|
||||||
|
--highlight-color: var(--caribbean-green);
|
||||||
|
--error-color: var(--slate-gray);
|
||||||
|
--success-color: var(--light-slate-gray);
|
||||||
|
--warning-color: var(--periwinkle);
|
||||||
|
--info-color: var(--ivory);
|
||||||
|
|
||||||
|
--font-family: 'Roboto', sans-serif;
|
||||||
|
--heading-color: var(--alice-blue);
|
||||||
|
--heading-margin: 0 0 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* assets/css/tutorial.css */
|
||||||
|
#tutorial-overlay {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
background: rgba(0, 0, 0, 0.8); /* Escurece a tela */
|
||||||
|
/* display: flex; */
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
z-index: 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
#tutorial-box {
|
||||||
|
background: var(--deep-ruby);
|
||||||
|
padding: 20px;
|
||||||
|
border-radius: 8px;
|
||||||
|
max-width: 500px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
// assets/script/tutorial.js
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
// Array de passos com seletor e mensagem para cada etapa do tutorial
|
||||||
|
const steps = [
|
||||||
|
{ selector: '#inicio', message: 'Esta é a barra de navegação, onde você encontra as principais seções.' },
|
||||||
|
{ selector: '#aulas', message: 'Em aulas, temos uma lista de aulas mostrando pelo mais recente ate o mais antigo.' },
|
||||||
|
{ selector: '#cursos', message: 'Em cursos temos os cursos, que não é nada mais que uma junção de aulas sobre um determinado assunto.' },
|
||||||
|
{ selector: '#software', message: 'Caso queira procurar cursos de um determinado programa, você pode procurar ele por aqui.' },
|
||||||
|
{ selector: '#Dashboard', message: 'Aqui é onde você manda as aulas, precisa ter um cadastro como um Autor.' },
|
||||||
|
{ selector: '#lasted', message: 'Aqui mostraremos as 6 ultimas aulas enviadas.' },
|
||||||
|
|
||||||
|
// Adicione os demais passos (total de 10, ou quantos precisar)
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
// Função para remover qualquer destaque anterior e destacar o elemento atual
|
||||||
|
function highlightElement(element) {
|
||||||
|
document.querySelectorAll('.tutorial-highlight').forEach(function(el) {
|
||||||
|
el.classList.remove('tutorial-highlight');
|
||||||
|
});
|
||||||
|
if (element) {
|
||||||
|
element.classList.add('tutorial-highlight');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Função que exibe e posiciona o passo do tutorial
|
||||||
|
function showStep(stepIndex) {
|
||||||
|
const step = steps[stepIndex]; // pega o objeto do passo atual
|
||||||
|
const element = document.querySelector(step.selector);
|
||||||
|
const tutorialBox = document.getElementById('tutorial-box');
|
||||||
|
const tutorialText = document.getElementById('tutorial-text');
|
||||||
|
|
||||||
|
// Atualiza o texto do tutorial com a mensagem correta
|
||||||
|
tutorialText.textContent = step.message;
|
||||||
|
|
||||||
|
// Destaque o elemento alvo, se existir
|
||||||
|
highlightElement(element);
|
||||||
|
|
||||||
|
if (element) {
|
||||||
|
// Obtém a posição do elemento alvo
|
||||||
|
const rect = element.getBoundingClientRect();
|
||||||
|
|
||||||
|
// Posiciona o tutorialBox logo abaixo do elemento (ajuste os valores conforme sua necessidade)
|
||||||
|
tutorialBox.style.position = 'absolute';
|
||||||
|
tutorialBox.style.top = (rect.bottom + 10 + window.scrollY) + 'px'; // 10px abaixo do elemento
|
||||||
|
tutorialBox.style.left = (rect.left + window.scrollX) + 'px';
|
||||||
|
tutorialBox.style.transform = 'none';
|
||||||
|
} else {
|
||||||
|
// Fallback: se o elemento não for encontrado, centraliza a caixa do tutorial
|
||||||
|
tutorialBox.style.position = 'fixed';
|
||||||
|
tutorialBox.style.top = '50%';
|
||||||
|
tutorialBox.style.left = '50%';
|
||||||
|
tutorialBox.style.transform = 'translate(-50%, -50%)';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Captura os elementos do DOM que vamos usar
|
||||||
|
const overlay = document.getElementById('tutorial-overlay');
|
||||||
|
const nextStepButton = document.getElementById('next-step');
|
||||||
|
const startTutorialButton = document.getElementById('start-tutorial');
|
||||||
|
|
||||||
|
let currentStep = 0;
|
||||||
|
|
||||||
|
// Inicia o tutorial somente quando o botão de início for clicado
|
||||||
|
if (startTutorialButton) {
|
||||||
|
startTutorialButton.addEventListener('click', function() {
|
||||||
|
overlay.classList.remove('hidden'); // Mostra o overlay
|
||||||
|
currentStep = 0;
|
||||||
|
showStep(currentStep);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Avança os passos ao clicar no botão "Próximo"
|
||||||
|
if (nextStepButton) {
|
||||||
|
nextStepButton.addEventListener('click', function() {
|
||||||
|
currentStep++;
|
||||||
|
if (currentStep < steps.length) {
|
||||||
|
showStep(currentStep);
|
||||||
|
} else {
|
||||||
|
// Quando terminar todos os passos, oculta o tutorial
|
||||||
|
overlay.classList.add('hidden');
|
||||||
|
currentStep = 0;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
+25
-22
@@ -10,31 +10,34 @@ lang: pt
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mx-6 mt-6">
|
<div class="mx-6 mt-6">
|
||||||
{% assign cursos = site.cursos | sort: 'date' | reverse %}
|
{% assign cursos = site.data.cursos | sort: 'date' | reverse %}
|
||||||
<div class="columns is-multiline">
|
|
||||||
|
<div class="content-box">
|
||||||
{% for curso in cursos %}
|
{% for curso in cursos %}
|
||||||
{% assign nome = curso.name | replace: ".md","" %}
|
<div class="box">
|
||||||
<div class="column is-one-third">
|
<div class="box-top">
|
||||||
<a href='{{ site.baseurl }}{{ curso.url }}.html' class="card-link">
|
<figure>
|
||||||
<div class="card">
|
<img src="{{ site.baseurl }}/thumbs/{{ curso.name | replace: '.md', '' }}.jpg">
|
||||||
<div class="card-image">
|
</figure>
|
||||||
<figure class="image is-4by3">
|
</div>
|
||||||
<img src="{{ site.baseurl }}/thumbs/{{ nome }}.jpg">
|
|
||||||
</figure>
|
<div class="box-info">
|
||||||
</div>
|
<h1>
|
||||||
<div class="card-content">
|
<a href="{{ site.baseurl }}/cursos/{{ curso.name | slugify: 'latin' }}.html">
|
||||||
<div class="content my-2">
|
{{ curso.title }}
|
||||||
<h1 class="title is-size-4">{{ curso.title }}</h1>
|
</a>
|
||||||
{% for aula in curso.aulas %}
|
</h1>
|
||||||
<span class="tag is-link">{{ aula }}</span>
|
<p>{{ curso.description }}</p>
|
||||||
{% endfor %}
|
<p><strong>Autor:</strong> {{ curso.author }}</p>
|
||||||
<h3 class="subtitle is-size-6">{{ curso.description }}</h3>
|
|
||||||
<h3 class="subtitle is-size-6">{{ curso.author }}</h3>
|
<div class="tags">
|
||||||
</div>
|
{% for aula in curso.aulas %}
|
||||||
</div>
|
<span class="tag is-link">{{ aula }}</span>
|
||||||
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
+8
-1
@@ -1,17 +1,24 @@
|
|||||||
---
|
---
|
||||||
layout: default
|
layout: default
|
||||||
|
title: AliceClass
|
||||||
permalink: /
|
permalink: /
|
||||||
---
|
---
|
||||||
|
|
||||||
|
{% include tutorial/tutorial.html %}
|
||||||
|
|
||||||
<div class="home-content">
|
<div class="home-content">
|
||||||
<div class="banner">
|
<div class="banner">
|
||||||
<h1>Bem vindo ao Alice Class</h1>
|
<h1>Bem vindo ao Alice Class</h1>
|
||||||
<h3>Participe de uma comunidade colaborativa para criar e compartilhar cursos e materiais educativos.</h3>
|
<h3>Participe de uma comunidade colaborativa para criar e compartilhar cursos e materiais educativos.</h3>
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
<h4 style="margin-top: 100px;">E novo aqui? <span style="color: black;" id="start-tutorial">Click aqui</span> e conheça nosso site.</h4>
|
||||||
|
<!-- <button id="start-tutorial">Iniciar Tutorial</button> -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="lasted">
|
<div class="lasted">
|
||||||
<div class="title-section">
|
<div class="title-section">
|
||||||
<h1 class="title">Ultimas aulas</h1>
|
<h1 class="title" id="lasted">Ultimas aulas</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="content-box">
|
<div class="content-box">
|
||||||
|
|||||||
Executable
+42
@@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
if (!isset($_GET['user'])) {
|
||||||
|
http_response_code(400);
|
||||||
|
exit("Missing user");
|
||||||
|
}
|
||||||
|
|
||||||
|
$user = preg_replace('/[^a-zA-Z0-9_-]/', '', $_GET['user']);
|
||||||
|
|
||||||
|
// Verifica se a live está online (arquivo .mpd existe)
|
||||||
|
$mpdPath = "/var/www/html/stream/{$user}.mpd";
|
||||||
|
if (!file_exists($mpdPath)) {
|
||||||
|
http_response_code(404);
|
||||||
|
exit("Live offline");
|
||||||
|
}
|
||||||
|
|
||||||
|
header("Content-Type: text/event-stream");
|
||||||
|
header("Cache-Control: no-cache");
|
||||||
|
header("Connection: keep-alive");
|
||||||
|
|
||||||
|
$tmp_file = sys_get_temp_dir() . "/relay_chat_{$user}.txt";
|
||||||
|
|
||||||
|
// Cria o arquivo se ainda não existir
|
||||||
|
if (!file_exists($tmp_file)) {
|
||||||
|
file_put_contents($tmp_file, '');
|
||||||
|
}
|
||||||
|
|
||||||
|
$lastMessage = '';
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
clearstatcache();
|
||||||
|
$currentMessage = trim(file_get_contents($tmp_file));
|
||||||
|
|
||||||
|
if ($currentMessage !== '' && $currentMessage !== $lastMessage) {
|
||||||
|
echo "data: " . $currentMessage . "\n\n";
|
||||||
|
ob_flush();
|
||||||
|
flush();
|
||||||
|
$lastMessage = $currentMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
sleep(1);
|
||||||
|
}
|
||||||
|
?>
|
||||||
Executable
+11
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
if (isset($_POST['mensagem']) && isset($_GET['user'])) {
|
||||||
|
$mensagem = trim($_POST['mensagem']);
|
||||||
|
$user = preg_replace('/[^a-zA-Z0-9_-]/', '', $_GET['user']);
|
||||||
|
|
||||||
|
if ($mensagem !== '') {
|
||||||
|
$tmp_file = sys_get_temp_dir() . "/relay_chat_{$user}.txt";
|
||||||
|
file_put_contents($tmp_file, $mensagem); // sobrescreve, não acumula
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
Reference in new issue
Block a user