ui and protocol refactor
This commit is contained in:
1 parent
745bbb5cc8
commit
ee599aa35e
33 files changed
+1937
-808
No files matched your search
+2
-1
@@ -4,5 +4,6 @@
|
||||
"trailingComma": "es5",
|
||||
"printWidth": 110,
|
||||
"tabWidth": 2,
|
||||
"arrowParens": "avoid"
|
||||
"arrowParens": "avoid",
|
||||
"useTabs": true
|
||||
}
|
||||
+39
-28
@@ -1,41 +1,52 @@
|
||||
import logger from '../logger.js'
|
||||
import Client from './Client.js'
|
||||
|
||||
class Board {
|
||||
static scores = {}
|
||||
static scores = {
|
||||
'::1': 10,
|
||||
'::2': 20,
|
||||
'::3': 30,
|
||||
}
|
||||
|
||||
static addPlayer(client) {
|
||||
if (this.scores[client.ip]) return
|
||||
static addPlayer(client) {
|
||||
if (this.scores[client.ip]) return
|
||||
|
||||
this.scores[client.ip] = 0
|
||||
}
|
||||
this.scores[client.ip] = 0
|
||||
|
||||
// static removePlayer(client) {
|
||||
// delete this.scores[client.ip]
|
||||
// }
|
||||
logger.debug('Board', `new player added`, client.ip)
|
||||
}
|
||||
|
||||
static get score() {
|
||||
return {
|
||||
bump: (client, score) => (Board.scores[client.ip] += score),
|
||||
get: client => Board.scores[client.ip],
|
||||
}
|
||||
}
|
||||
// static removePlayer(client) {
|
||||
// delete this.scores[client.ip]
|
||||
// }
|
||||
|
||||
static bumpScore(client, score) {
|
||||
this.scores[client.ip] += score
|
||||
}
|
||||
static get score() {
|
||||
return {
|
||||
bump: (client, score) => (Board.scores[client.ip] += score),
|
||||
get: client => Board.scores[client.ip],
|
||||
}
|
||||
}
|
||||
|
||||
static getScore(client) {
|
||||
return this.scores[client.ip]
|
||||
}
|
||||
static bumpScore(client, score) {
|
||||
this.scores[client.ip] += score
|
||||
logger.debug('Board', `score changed by ${score}`, client.ip)
|
||||
}
|
||||
|
||||
static get rendered() {
|
||||
return Object.entries(this.scores).map(([ip, score]) => {
|
||||
return {
|
||||
nick: Client.getBy.ip(ip).nick,
|
||||
score,
|
||||
}
|
||||
})
|
||||
}
|
||||
static getScore(client) {
|
||||
return this.scores[client.ip]
|
||||
}
|
||||
|
||||
static get rendered() {
|
||||
return Object.entries(this.scores)
|
||||
.filter(([ip, score]) => score > 0)
|
||||
.map(([ip, score]) => {
|
||||
const client = Client.getBy.ip(ip)
|
||||
return {
|
||||
nick: client?.nick || '---',
|
||||
score,
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export default Board
|
||||
+89
-149
@@ -1,178 +1,118 @@
|
||||
import Music from './Music.js'
|
||||
import Queue from './Queue.js'
|
||||
import logger from '../logger.js'
|
||||
import Board from './Board.js'
|
||||
import Music from './Music.js'
|
||||
|
||||
class Client {
|
||||
static list = []
|
||||
static listeners = []
|
||||
static list = []
|
||||
static listeners = new Map()
|
||||
|
||||
type = null
|
||||
type = null
|
||||
|
||||
constructor(ws, req) {
|
||||
this.ws = ws
|
||||
ws.client = this
|
||||
this.ip = req.socket.remoteAddress
|
||||
constructor(ws, req) {
|
||||
this.ws = ws
|
||||
ws.client = this
|
||||
|
||||
console.info(`ws : up ${this.ip}`)
|
||||
this.ip = req.socket.remoteAddress
|
||||
|
||||
Client.list.push(this)
|
||||
logger.debug('Client', 'up', this.ip)
|
||||
|
||||
ws.on('close', () => {
|
||||
console.info(`ws : down ${this.ip}`)
|
||||
Client.list = Client.list.filter(client => client != this)
|
||||
Client.listeners = Client.listeners.filter(listener => listener.who != this)
|
||||
// Board.removePlayer(this)
|
||||
})
|
||||
Client.list.push(this)
|
||||
|
||||
ws.on('message', data => {
|
||||
let payload = JSON.parse(data.toString())
|
||||
this.receive(payload)
|
||||
})
|
||||
}
|
||||
ws.on('close', () => {
|
||||
logger.debug('Client', 'down', this.ip)
|
||||
Client.list = Client.list.filter(client => client != this)
|
||||
|
||||
receive(payload) {
|
||||
// Handle client registration
|
||||
if (payload.whoami) {
|
||||
this.handleRegistration(payload.whoami)
|
||||
return
|
||||
}
|
||||
// Clean up event listeners for this client
|
||||
Client.listeners.forEach((listeners, eventName) => {
|
||||
Client.listeners.set(
|
||||
eventName,
|
||||
listeners.filter(listener => listener.who !== this)
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
// Require client to be registered before handling other commands
|
||||
if (this.type == null) return
|
||||
ws.on('message', data => {
|
||||
let message = JSON.parse(data.toString())
|
||||
this.receive(message)
|
||||
})
|
||||
}
|
||||
|
||||
// Handle type-specific commands
|
||||
switch (this.type) {
|
||||
case 'player':
|
||||
this.handlePlayerCommands(payload)
|
||||
break
|
||||
case 'host':
|
||||
this.handleHostCommands(payload)
|
||||
break
|
||||
case 'tv':
|
||||
// TV clients only receive broadcasts, no commands
|
||||
break
|
||||
}
|
||||
receive(message) {
|
||||
const { type, action, data } = message
|
||||
|
||||
Client.trigger('update')
|
||||
logger.trace('Client', 'recv', { type, action, from: this.ip })
|
||||
|
||||
// Client.broadcast('update')
|
||||
}
|
||||
// Handle client registration
|
||||
if (type === 'register') {
|
||||
return this.handleRegistration(data.clientType)
|
||||
}
|
||||
|
||||
handleRegistration(clientType) {
|
||||
const validTypes = ['tv', 'host', 'player']
|
||||
if (!validTypes.includes(clientType)) return
|
||||
// Require client to be registered before handling other commands
|
||||
if (this.type == null) return
|
||||
|
||||
this.type = clientType
|
||||
console.info(`ws : '${this.type}' registered`)
|
||||
if (type == 'player') Client.emit('playerAction-' + action, { client: this, data })
|
||||
if (type == 'host') Client.emit('hostAction-' + action, data)
|
||||
|
||||
if (this.type == 'tv') {
|
||||
// Client.broadcast('update')
|
||||
Client.on(
|
||||
'update',
|
||||
() => {
|
||||
this.send({
|
||||
queue: Queue.rendered,
|
||||
active: Queue.active,
|
||||
status: Music.status,
|
||||
})
|
||||
},
|
||||
this
|
||||
)
|
||||
}
|
||||
Client.emit('update')
|
||||
}
|
||||
|
||||
if (this.type == 'player') {
|
||||
Board.addPlayer(this)
|
||||
// Client.broadcast('score', this)
|
||||
Client.on(
|
||||
'score',
|
||||
client => {
|
||||
if (client !== this) return
|
||||
this.send({
|
||||
points: Board.score.get(this),
|
||||
})
|
||||
},
|
||||
this
|
||||
)
|
||||
}
|
||||
handleRegistration(clientType) {
|
||||
const validTypes = ['tv', 'host', 'player']
|
||||
if (!validTypes.includes(clientType)) return
|
||||
|
||||
if (this.type == 'host') {
|
||||
Client.on(
|
||||
'musicMetadata',
|
||||
({ metadata }) => {
|
||||
this.send({ metadata })
|
||||
},
|
||||
this
|
||||
)
|
||||
}
|
||||
}
|
||||
this.type = clientType
|
||||
logger.info('Client', `'${this.ip}' registered as`, this.type)
|
||||
|
||||
handlePlayerCommands(payload) {
|
||||
if (payload.nick) {
|
||||
const nick = payload.nick
|
||||
if (typeof nick != 'string') return
|
||||
if (nick.trim() == '') return
|
||||
if (this.type == 'player') {
|
||||
Board.addPlayer(this)
|
||||
} else if (this.type == 'tv') {
|
||||
Client.emit('update')
|
||||
} else if (this.type == 'host') {
|
||||
this.send({
|
||||
type: 'state',
|
||||
action: 'metadata',
|
||||
data: Music.metadata,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
this.nick = nick
|
||||
console.info(`ws : '${this.ip}' renamed to '${this.nick}'`)
|
||||
}
|
||||
send(message) {
|
||||
this.ws.send(JSON.stringify(message))
|
||||
logger.trace('Client', 'send', message)
|
||||
}
|
||||
|
||||
if (payload.entry) {
|
||||
console.info(`ws : '${this.nick}' entered`)
|
||||
Queue.add(this)
|
||||
Music.control('Pause')
|
||||
}
|
||||
}
|
||||
// Emit an event to all registered listeners
|
||||
static emit(event, payload) {
|
||||
const listeners = this.listeners.get(event) || []
|
||||
listeners.forEach(listener => {
|
||||
listener.callback(payload)
|
||||
})
|
||||
}
|
||||
|
||||
handleHostCommands(payload) {
|
||||
const { action, points } = payload
|
||||
// Register an event listener
|
||||
static on(event, callback, who) {
|
||||
if (!this.listeners.has(event)) {
|
||||
this.listeners.set(event, [])
|
||||
}
|
||||
this.listeners.get(event).push({ callback, who })
|
||||
}
|
||||
|
||||
const actions = {
|
||||
clear: () => {
|
||||
Queue.clear()
|
||||
Music.setStatus('waiting')
|
||||
},
|
||||
play: () => {
|
||||
Music.control('Play')
|
||||
},
|
||||
pause: () => {
|
||||
Music.control('Pause')
|
||||
},
|
||||
next: () => {
|
||||
Music.control('Next')
|
||||
Queue.clear()
|
||||
},
|
||||
nextPlayer: () => {
|
||||
Queue.nextPlayer()
|
||||
},
|
||||
points: () => {
|
||||
Board.score.bump(Queue.activeClient, points)
|
||||
Client.trigger('score', Queue.activeClient)
|
||||
},
|
||||
}
|
||||
// static off(event, who) {
|
||||
// if (!this.listeners.has(event)) return
|
||||
|
||||
if (actions[action]) actions[action]()
|
||||
}
|
||||
// const listeners = this.listeners.get(event)
|
||||
// this.listeners.set(
|
||||
// event,
|
||||
// listeners.filter(listener => listener.who !== who)
|
||||
// )
|
||||
// }
|
||||
|
||||
send(payload) {
|
||||
this.ws.send(JSON.stringify(payload))
|
||||
}
|
||||
|
||||
static trigger(event, payload) {
|
||||
Client.listeners.forEach(listener => {
|
||||
if (listener.event == event) listener.callback(payload)
|
||||
})
|
||||
}
|
||||
|
||||
static on(event, callback, who) {
|
||||
this.listeners.push({ event, callback, who })
|
||||
}
|
||||
|
||||
static get getBy() {
|
||||
return {
|
||||
ip: ip => Client.list.find(client => client.ip == ip),
|
||||
type: type => Client.list.filter(client => client.type == type),
|
||||
}
|
||||
}
|
||||
static get getBy() {
|
||||
return {
|
||||
ip: ip => Client.list.find(client => client.ip == ip),
|
||||
type: type => Client.list.filter(client => client.type == type),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default Client
|
||||
+223
-354
@@ -1,377 +1,246 @@
|
||||
import { exec } from 'child_process'
|
||||
import os from 'os'
|
||||
import { promisify } from 'util'
|
||||
|
||||
import logger from '../logger.js'
|
||||
|
||||
const execAsync = promisify(exec)
|
||||
|
||||
async function controlLinux(action) {
|
||||
const lookup = {
|
||||
Play: 'Play',
|
||||
Pause: 'Pause',
|
||||
Stop: 'Stop',
|
||||
Next: 'Next',
|
||||
Previous: 'Previous',
|
||||
PlayPause: 'PlayPause',
|
||||
Meta: 'Meta',
|
||||
}
|
||||
|
||||
const command = lookup[action]
|
||||
|
||||
try {
|
||||
// Find active media player
|
||||
// const { stdout: playerList } = await execAsync(
|
||||
// "dbus-send --session --dest=org.freedesktop.DBus --type=method_call --print-reply /org/freedesktop/DBus org.freedesktop.DBus.ListNames | grep 'org.mpris.MediaPlayer2' | grep -v 'kdeconnect' | head -n 1 | awk '{print $2}' | tr -d '\"'"
|
||||
// )
|
||||
|
||||
const playerList = 'org.mpris.MediaPlayer2.spotify' // TODO: fix detection of active player
|
||||
|
||||
const player = playerList.trim()
|
||||
|
||||
if (!player) {
|
||||
return new Error('No media player found')
|
||||
}
|
||||
|
||||
if (command === 'Meta') {
|
||||
// Get metadata
|
||||
const { stdout: metadata } = await execAsync(
|
||||
`dbus-send --print-reply --dest=${player} /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:org.mpris.MediaPlayer2.Player string:Metadata`
|
||||
)
|
||||
|
||||
// Parse artist
|
||||
const artistMatch = metadata.match(/xesam:artist[\s\S]*?string "(.*?)"/)
|
||||
const author = artistMatch ? artistMatch[1] : 'Unknown Artist'
|
||||
|
||||
// Parse title
|
||||
const titleMatch = metadata.match(/xesam:title[\s\S]*?string "(.*?)"/)
|
||||
const track = titleMatch ? titleMatch[1] : 'Unknown Title'
|
||||
|
||||
logger.debug('Music', `fetched metadata:`, { author, track })
|
||||
|
||||
return {
|
||||
author,
|
||||
track,
|
||||
}
|
||||
} else {
|
||||
// Execute control command
|
||||
await execAsync(
|
||||
`dbus-send --print-reply --dest=${player} /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.${command}`
|
||||
)
|
||||
|
||||
logger.debug('Music', `executed command:`, command)
|
||||
|
||||
return newStateLookup[action]
|
||||
}
|
||||
} catch (error) {
|
||||
return new Error(`Linux music control error: ${error.message}`)
|
||||
}
|
||||
}
|
||||
|
||||
function controlWindows(action) {
|
||||
const lookup = {
|
||||
Play: 'Play',
|
||||
Pause: 'Pause',
|
||||
Stop: 'Pause',
|
||||
Next: 'Next',
|
||||
Previous: 'Previous',
|
||||
PlayPause: 'Toggle',
|
||||
Meta: 'Info',
|
||||
}
|
||||
|
||||
const script = [
|
||||
'param(',
|
||||
// Info, Toggle, Next, Previous, Play, Pause
|
||||
` [string]$Command = "${lookup[action]}"`,
|
||||
')',
|
||||
'# 1. Load Windows Media Assemblies',
|
||||
'[Windows.Media.Control.GlobalSystemMediaTransportControlsSessionManager,Windows.Media.Control,ContentType=WindowsRuntime] | Out-Null',
|
||||
'Add-Type -AssemblyName System.Runtime.WindowsRuntime',
|
||||
'# 2. Async Helper (Required for WinRT)',
|
||||
'Function Await($WinRtTask, $ResultType) {',
|
||||
" $asTaskGeneric = ([System.WindowsRuntimeSystemExtensions].GetMethods() | ? { $_.Name -eq 'AsTask' -and $_.GetParameters().Count -eq 1 -and $_.GetParameters()[0].ParameterType.Name -eq 'IAsyncOperation`1' })[0]",
|
||||
' $asTask = $asTaskGeneric.MakeGenericMethod($ResultType)',
|
||||
' $netTask = $asTask.Invoke($null, @($WinRtTask))',
|
||||
' $netTask.Wait(-1) | Out-Null',
|
||||
' return $netTask.Result',
|
||||
'}',
|
||||
'try {',
|
||||
' # 3. Connect to Media Manager',
|
||||
' $managerTask = [Windows.Media.Control.GlobalSystemMediaTransportControlsSessionManager]::RequestAsync()',
|
||||
' $manager = Await $managerTask ([Windows.Media.Control.GlobalSystemMediaTransportControlsSessionManager])',
|
||||
' $session = $manager.GetCurrentSession()',
|
||||
' if ($session) {',
|
||||
' # --- CONTROL COMMANDS ---',
|
||||
' if ($Command -eq "Next") {',
|
||||
' $task = $session.TrySkipNextAsync()',
|
||||
' $null = Await $task ([bool])',
|
||||
' }',
|
||||
' elseif ($Command -eq "Previous") {',
|
||||
' $task = $session.TrySkipPreviousAsync()',
|
||||
' $null = Await $task ([bool])',
|
||||
' }',
|
||||
' elseif ($Command -eq "Play") {',
|
||||
' $task = $session.TryPlayAsync()',
|
||||
' $null = Await $task ([bool])',
|
||||
' }',
|
||||
' elseif ($Command -eq "Pause") {',
|
||||
' $task = $session.TryPauseAsync()',
|
||||
' $null = Await $task ([bool])',
|
||||
' }',
|
||||
' elseif ($Command -eq "Toggle") {',
|
||||
' $status = $session.GetPlaybackInfo().PlaybackStatus',
|
||||
' if ($status -eq "Playing") {',
|
||||
' $task = $session.TryPauseAsync()',
|
||||
' $null = Await $task ([bool])',
|
||||
' } else {',
|
||||
' $task = $session.TryPlayAsync()',
|
||||
' $null = Await $task ([bool])',
|
||||
' }',
|
||||
' }',
|
||||
' # --- RETURN INFO (Always return status so UI updates immediately) ---',
|
||||
' # Small delay to allow app to update status before reading',
|
||||
' if ($Command -ne "Info") { Start-Sleep -Milliseconds 200 }',
|
||||
' $infoTask = $session.TryGetMediaPropertiesAsync()',
|
||||
' $info = Await $infoTask ([Windows.Media.Control.GlobalSystemMediaTransportControlsSessionMediaProperties])',
|
||||
' $playbackInfo = $session.GetPlaybackInfo()',
|
||||
' $result = @{',
|
||||
' Title = $info.Title',
|
||||
' Artist = $info.Artist',
|
||||
' Album = $info.AlbumTitle',
|
||||
' IsPlaying = ($playbackInfo.PlaybackStatus -eq "Playing")',
|
||||
' Success = $true',
|
||||
' }',
|
||||
' $result | ConvertTo-Json -Compress',
|
||||
' } else {',
|
||||
' $result = @{ IsPlaying = $false; Title = "Nothing Playing"; Success = $false }',
|
||||
' $result | ConvertTo-Json -Compress',
|
||||
' }',
|
||||
'} catch {',
|
||||
' $result = @{ IsPlaying = $false; Title = "Error"; Error = $_.Exception.Message }',
|
||||
' $result | ConvertTo-Json -Compress',
|
||||
'}',
|
||||
].join('\n')
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
exec(script, (error, stdout, stderr) => {
|
||||
if (error) return reject(error)
|
||||
if (stderr) return reject(new Error(stderr))
|
||||
if (action === 'Meta') {
|
||||
try {
|
||||
const { Artist, Title } = JSON.parse(stdout)
|
||||
resolve({
|
||||
author: Artist,
|
||||
track: Title,
|
||||
})
|
||||
} catch (parseError) {
|
||||
reject(parseError)
|
||||
}
|
||||
} else {
|
||||
resolve(newStateLookup[action])
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const newStateLookup = {
|
||||
Play: 'playing',
|
||||
Pause: 'paused',
|
||||
Next: 'playing',
|
||||
}
|
||||
|
||||
class Music {
|
||||
static status = 'waiting'
|
||||
static metadata = null
|
||||
static listeners = new Set()
|
||||
static status = 'waiting'
|
||||
static metadata = null
|
||||
static listeners = new Set()
|
||||
static #platform = null
|
||||
|
||||
/** Control music playback
|
||||
* @param {string} action - One of 'Play', 'Pause', 'Stop', 'Next', 'Previous', 'PlayPause'
|
||||
* */
|
||||
static control(action) {
|
||||
const allowed = ['Play', 'Pause', 'Stop', 'Next', 'Previous', 'PlayPause']
|
||||
static init(platform) {
|
||||
this.#platform = platform
|
||||
|
||||
if (!allowed.includes(action)) return
|
||||
logger.debug('Music', `initialized for platform`, platform)
|
||||
}
|
||||
|
||||
const platform = os.platform()
|
||||
static control(action) {
|
||||
const allowed = ['Play', 'Pause', 'Stop', 'Next', 'Previous', 'PlayPause']
|
||||
|
||||
function controlLinux(action) {
|
||||
exec(
|
||||
`dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.${action}`,
|
||||
(error, stdout, stderr) => {
|
||||
if (error) {
|
||||
console.log(`error: ${error.message}`)
|
||||
return
|
||||
}
|
||||
if (stderr) {
|
||||
console.log(`stderr: ${stderr}`)
|
||||
return
|
||||
}
|
||||
// console.log(`stdout: ${stdout}`)
|
||||
}
|
||||
)
|
||||
}
|
||||
if (!allowed.includes(action)) return
|
||||
// if (this.status == newStateLookup[action]) return
|
||||
|
||||
function controlMac(action) {
|
||||
const actionMap = {
|
||||
Play: 'play',
|
||||
Pause: 'pause',
|
||||
Stop: 'stop',
|
||||
Next: 'next track',
|
||||
Previous: 'previous track',
|
||||
PlayPause: 'playpause',
|
||||
}
|
||||
let controller = {
|
||||
linux: controlLinux,
|
||||
win32: controlWindows,
|
||||
}[this.#platform]
|
||||
|
||||
const spotifyAction = actionMap[action]
|
||||
if (!spotifyAction) return
|
||||
controller(action)
|
||||
this.newStatus = newStateLookup[action]
|
||||
|
||||
exec(
|
||||
`osascript -e 'tell application "Spotify" to ${spotifyAction}'`,
|
||||
(error, stdout, stderr) => {
|
||||
if (error) {
|
||||
console.log(`error: ${error.message}`)
|
||||
return
|
||||
}
|
||||
if (stderr) {
|
||||
console.log(`stderr: ${stderr}`)
|
||||
return
|
||||
}
|
||||
// console.log(`stdout: ${stdout}`)
|
||||
}
|
||||
)
|
||||
}
|
||||
// Fetch and broadcast metadata (non-blocking)
|
||||
setTimeout(() => this.getMeta(), 1000)
|
||||
}
|
||||
|
||||
function controlWindows(action) {
|
||||
const actionMap = {
|
||||
Play: 'Play',
|
||||
Pause: 'Pause',
|
||||
Stop: 'Stop',
|
||||
Next: 'Next',
|
||||
Previous: 'Previous',
|
||||
PlayPause: 'PlayPause',
|
||||
}
|
||||
static set newStatus(status) {
|
||||
const allowed = ['playing', 'paused', 'waiting']
|
||||
|
||||
const spotifyAction = actionMap[action]
|
||||
if (!spotifyAction) return
|
||||
if (!allowed.includes(status)) return
|
||||
|
||||
// Using nircmd or PowerShell to control Spotify on Windows
|
||||
exec(
|
||||
`powershell -Command "$wshell = New-Object -ComObject wscript.shell; $wshell.AppActivate('Spotify'); Start-Sleep -Milliseconds 100"`,
|
||||
(error, stdout, stderr) => {
|
||||
if (error) {
|
||||
console.log(`error: ${error.message}`)
|
||||
return
|
||||
}
|
||||
this.status = status
|
||||
|
||||
// Send media keys
|
||||
const keyMap = {
|
||||
Play: 'play',
|
||||
Pause: 'pause',
|
||||
Stop: 'stop',
|
||||
Next: 'next',
|
||||
Previous: 'previous',
|
||||
PlayPause: 'playpause',
|
||||
}
|
||||
logger.debug('Music', `status changed to`, status)
|
||||
}
|
||||
|
||||
const key = keyMap[action]
|
||||
exec(
|
||||
`powershell -Command "(New-Object -ComObject WScript.Shell).SendKeys([char]0xB3)"`,
|
||||
(error, stdout, stderr) => {
|
||||
if (error) {
|
||||
console.log(`error: ${error.message}`)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
static async getMeta() {
|
||||
this.metadata = await {
|
||||
linux: controlLinux,
|
||||
win32: controlWindows,
|
||||
}[this.#platform]('Meta')
|
||||
|
||||
switch (platform) {
|
||||
case 'linux':
|
||||
controlLinux(action)
|
||||
break
|
||||
case 'darwin':
|
||||
controlMac(action)
|
||||
break
|
||||
case 'win32':
|
||||
controlWindows(action)
|
||||
break
|
||||
default:
|
||||
throw new Error(`Platform ${platform} not supported`)
|
||||
}
|
||||
this.emit({ metadata: this.metadata, status: this.status })
|
||||
|
||||
let status = {
|
||||
Play: 'playing',
|
||||
Pause: 'paused',
|
||||
Stop: 'stopped',
|
||||
Next: 'playing',
|
||||
}[action]
|
||||
return this.metadata
|
||||
}
|
||||
|
||||
this.setStatus(status)
|
||||
static on(callback) {
|
||||
this.listeners.add(callback)
|
||||
}
|
||||
|
||||
// Fetch and broadcast metadata (non-blocking)
|
||||
setTimeout(() => {
|
||||
this.getMeta()
|
||||
.then(() =>
|
||||
this.trigger({ metadata: this.metadata, status: this.status })
|
||||
)
|
||||
.catch(error =>
|
||||
console.log(`Could not fetch metadata: ${error.message}`)
|
||||
)
|
||||
}, 1000)
|
||||
}
|
||||
static off(callback) {
|
||||
this.listeners.delete(callback)
|
||||
}
|
||||
|
||||
static setStatus(status) {
|
||||
const allowed = ['playing', 'paused', 'waiting']
|
||||
|
||||
if (!allowed.includes(status)) return
|
||||
|
||||
this.status = status
|
||||
}
|
||||
|
||||
static getMeta() {
|
||||
return new Promise((resolve, reject) => {
|
||||
const platform = os.platform()
|
||||
|
||||
const getMetaLinux = () => {
|
||||
// Try Spotify first, then other MPRIS2 players
|
||||
const players = [
|
||||
'org.mpris.MediaPlayer2.spotify',
|
||||
'org.mpris.MediaPlayer2.vlc',
|
||||
'org.mpris.MediaPlayer2.rhythmbox',
|
||||
'org.mpris.MediaPlayer2.audacious',
|
||||
]
|
||||
|
||||
const tryPlayer = index => {
|
||||
if (index >= players.length) {
|
||||
reject(new Error('No active media player found'))
|
||||
return
|
||||
}
|
||||
|
||||
const player = players[index]
|
||||
exec(
|
||||
`dbus-send --print-reply --dest=${player} /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata'`,
|
||||
(error, stdout, stderr) => {
|
||||
if (error) {
|
||||
// Try next player
|
||||
tryPlayer(index + 1)
|
||||
return
|
||||
}
|
||||
|
||||
// Parse the dbus output
|
||||
const metadata = {}
|
||||
|
||||
// Extract title
|
||||
const titleMatch = stdout.match(
|
||||
/xesam:title["\s]+variant\s+string\s+"([^"]+)"/
|
||||
)
|
||||
if (titleMatch) metadata.title = titleMatch[1]
|
||||
|
||||
// Extract artists
|
||||
const artistMatch = stdout.match(
|
||||
/xesam:artist["\s]+variant\s+array\s+\[\s+string\s+"([^"]+)"/
|
||||
)
|
||||
if (artistMatch) metadata.artist = artistMatch[1]
|
||||
|
||||
// Extract album
|
||||
const albumMatch = stdout.match(
|
||||
/xesam:album["\s]+variant\s+string\s+"([^"]+)"/
|
||||
)
|
||||
if (albumMatch) metadata.album = albumMatch[1]
|
||||
|
||||
// Extract artwork URL
|
||||
const artMatch = stdout.match(
|
||||
/mpris:artUrl["\s]+variant\s+string\s+"([^"]+)"/
|
||||
)
|
||||
if (artMatch) metadata.artworkUrl = artMatch[1]
|
||||
|
||||
// Extract duration (in microseconds)
|
||||
const lengthMatch = stdout.match(
|
||||
/mpris:length["\s]+variant\s+(?:uint64|int64)\s+(\d+)/
|
||||
)
|
||||
if (lengthMatch)
|
||||
metadata.duration = parseInt(lengthMatch[1]) / 1000000 // Convert to seconds
|
||||
|
||||
// Extract track URL
|
||||
const urlMatch = stdout.match(
|
||||
/xesam:url["\s]+variant\s+string\s+"([^"]+)"/
|
||||
)
|
||||
if (urlMatch) metadata.url = urlMatch[1]
|
||||
|
||||
metadata.player = player.replace('org.mpris.MediaPlayer2.', '')
|
||||
|
||||
Music.metadata = metadata
|
||||
resolve(metadata)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
tryPlayer(0)
|
||||
},
|
||||
getMetaMac = () => {
|
||||
// Try Spotify, Music (iTunes), and other common players
|
||||
const script = `
|
||||
set output to ""
|
||||
tell application "System Events"
|
||||
set spotifyRunning to (name of processes) contains "Spotify"
|
||||
set musicRunning to (name of processes) contains "Music"
|
||||
end tell
|
||||
|
||||
if spotifyRunning then
|
||||
tell application "Spotify"
|
||||
if player state is not stopped then
|
||||
set trackName to name of current track
|
||||
set trackArtist to artist of current track
|
||||
set trackAlbum to album of current track
|
||||
set trackDuration to duration of current track
|
||||
set trackUrl to spotify url of current track
|
||||
set output to "Spotify|||" & trackName & "|||" & trackArtist & "|||" & trackAlbum & "|||" & trackDuration & "|||" & trackUrl
|
||||
end if
|
||||
end tell
|
||||
else if musicRunning then
|
||||
tell application "Music"
|
||||
if player state is not stopped then
|
||||
set trackName to name of current track
|
||||
set trackArtist to artist of current track
|
||||
set trackAlbum to album of current track
|
||||
set trackDuration to duration of current track
|
||||
set output to "Music|||" & trackName & "|||" & trackArtist & "|||" & trackAlbum & "|||" & trackDuration & "|||"
|
||||
end if
|
||||
end tell
|
||||
end if
|
||||
|
||||
return output
|
||||
`
|
||||
|
||||
exec(
|
||||
`osascript -e '${script.replace(/'/g, "'\\''")}'`,
|
||||
(error, stdout, stderr) => {
|
||||
if (error) {
|
||||
reject(new Error('No active media player found'))
|
||||
return
|
||||
}
|
||||
|
||||
const output = stdout.trim()
|
||||
if (!output) {
|
||||
reject(new Error('No track currently playing'))
|
||||
return
|
||||
}
|
||||
|
||||
const parts = output.split('|||')
|
||||
const metadata = {
|
||||
player: parts[0],
|
||||
title: parts[1],
|
||||
artist: parts[2],
|
||||
album: parts[3],
|
||||
duration: parseFloat(parts[4]) / 1000, // Convert milliseconds to seconds
|
||||
}
|
||||
|
||||
if (parts[5]) metadata.url = parts[5]
|
||||
|
||||
Music.metadata = metadata
|
||||
resolve(metadata)
|
||||
}
|
||||
)
|
||||
},
|
||||
getMetaWindows = () => {
|
||||
// Use Windows 10+ GlobalSystemMediaTransportControlsSessionManager
|
||||
const script = `
|
||||
Add-Type -AssemblyName System.Runtime.WindowsRuntime
|
||||
$asTaskGeneric = ([System.WindowsRuntimeSystemExtensions].GetMethods() | Where-Object { $_.Name -eq 'AsTask' -and $_.GetParameters().Count -eq 1 -and $_.GetParameters()[0].ParameterType.Name -eq 'IAsyncOperation\`1' })[0]
|
||||
Function Await($WinRtTask, $ResultType) {
|
||||
$asTask = $asTaskGeneric.MakeGenericMethod($ResultType)
|
||||
$netTask = $asTask.Invoke($null, @($WinRtTask))
|
||||
$netTask.Wait(-1) | Out-Null
|
||||
$netTask.Result
|
||||
}
|
||||
|
||||
$sessionManager = [Windows.Media.Control.GlobalSystemMediaTransportControlsSessionManager,Windows.Media.Control,ContentType=WindowsRuntime]
|
||||
$sessions = Await ($sessionManager::RequestAsync()) ([Windows.Media.Control.GlobalSystemMediaTransportControlsSessionManager])
|
||||
$currentSession = $sessions.GetCurrentSession()
|
||||
|
||||
if ($null -eq $currentSession) {
|
||||
Write-Output "ERROR: No active media session"
|
||||
exit 1
|
||||
}
|
||||
|
||||
$mediaProperties = Await ($currentSession.TryGetMediaPropertiesAsync()) ([Windows.Media.Control.GlobalSystemMediaTransportControlsSessionMediaProperties])
|
||||
|
||||
$title = $mediaProperties.Title
|
||||
$artist = $mediaProperties.Artist
|
||||
$album = $mediaProperties.AlbumTitle
|
||||
$player = $currentSession.SourceAppUserModelId
|
||||
|
||||
Write-Output "$player|||$title|||$artist|||$album"
|
||||
`
|
||||
|
||||
exec(
|
||||
`powershell -NoProfile -Command "${script.replace(/"/g, '\\"')}"`,
|
||||
(error, stdout, stderr) => {
|
||||
if (error || stdout.includes('ERROR:')) {
|
||||
reject(new Error('No active media player found'))
|
||||
return
|
||||
}
|
||||
|
||||
const parts = stdout.trim().split('|||')
|
||||
const metadata = {
|
||||
player: parts[0],
|
||||
title: parts[1],
|
||||
artist: parts[2],
|
||||
album: parts[3],
|
||||
}
|
||||
|
||||
Music.metadata = metadata
|
||||
resolve(metadata)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
switch (platform) {
|
||||
case 'linux':
|
||||
getMetaLinux()
|
||||
break
|
||||
case 'darwin':
|
||||
getMetaMac()
|
||||
break
|
||||
case 'win32':
|
||||
getMetaWindows()
|
||||
break
|
||||
default:
|
||||
reject(new Error(`Platform ${platform} not supported`))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static bind(callback) {
|
||||
// bind a callback to status updates
|
||||
// support many listeners
|
||||
this.listeners.add(callback)
|
||||
}
|
||||
|
||||
static trigger(payload) {
|
||||
this.listeners.forEach(callback => callback(payload))
|
||||
}
|
||||
static emit(payload) {
|
||||
this.listeners.forEach(callback => callback(payload))
|
||||
}
|
||||
}
|
||||
|
||||
export default Music
|
||||
export { controlLinux, controlWindows }
|
||||
@@ -0,0 +1,52 @@
|
||||
import QRCode from 'qrcode'
|
||||
import logger from '../logger.js'
|
||||
import env from '../env.js'
|
||||
|
||||
export default class Qr {
|
||||
static #cache = null
|
||||
static #host = null
|
||||
|
||||
static init(host) {
|
||||
this.#host = host
|
||||
logger.info('Qr', 'host for qr', host)
|
||||
if (!host) logger.warn('env', 'SERVER_HOST is not defined, QR codes will not be generated')
|
||||
}
|
||||
|
||||
static serve() {
|
||||
return async (req, res, next) => {
|
||||
if (req.path !== '/qr') return next()
|
||||
|
||||
try {
|
||||
if (this.host === null) {
|
||||
throw new Error('SERVER_HOST is not defined')
|
||||
}
|
||||
|
||||
if (!this.#cache) {
|
||||
const payload = this.#payload()
|
||||
this.#cache = await this.#generate(payload)
|
||||
}
|
||||
|
||||
res.setHeader('Content-Type', 'image/png')
|
||||
res.setHeader('Cache-Control', 'public, max-age=3600')
|
||||
res.send(this.#cache)
|
||||
} catch (error) {
|
||||
logger.error('http', 'QR code generation error:', error)
|
||||
res.status(500).send('Failed to generate QR code')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static async #generate(data) {
|
||||
return await QRCode.toBuffer(data, {
|
||||
errorCorrectionLevel: 'M',
|
||||
type: 'png',
|
||||
width: 512,
|
||||
margin: 2,
|
||||
})
|
||||
}
|
||||
|
||||
static #payload() {
|
||||
const port = env.HTTP_PORT
|
||||
return `http://${this.#host}:${port}/player`
|
||||
}
|
||||
}
|
||||
+5
-6
@@ -1,4 +1,4 @@
|
||||
import Client from './Client.js'
|
||||
import logger from '../logger.js'
|
||||
|
||||
class Queue {
|
||||
static array = []
|
||||
@@ -11,8 +11,9 @@ class Queue {
|
||||
}
|
||||
|
||||
if (this.isEmpty) this.active = 0
|
||||
this.array.push(client)
|
||||
|
||||
this.push(client)
|
||||
logger.debug('Queue', `client added to queue`, client.ip)
|
||||
}
|
||||
|
||||
static get isEmpty() {
|
||||
@@ -23,13 +24,11 @@ class Queue {
|
||||
return this.array.some(c => c.ip === client.ip)
|
||||
}
|
||||
|
||||
static push(client) {
|
||||
this.array.push(client)
|
||||
}
|
||||
|
||||
static clear() {
|
||||
this.array = []
|
||||
this.active = null
|
||||
|
||||
logger.debug('Queue', `queue cleared`)
|
||||
}
|
||||
|
||||
static nextPlayer() {
|
||||
|
||||
@@ -1,22 +1,23 @@
|
||||
import dotenv from 'dotenv'
|
||||
|
||||
const NODE_ENV = process.env.NODE_ENV,
|
||||
dotfile = {
|
||||
production: '.env',
|
||||
development: '.dev.env',
|
||||
}[NODE_ENV ?? 'production']
|
||||
dotfile = {
|
||||
production: '.env',
|
||||
development: '.dev.env',
|
||||
}[NODE_ENV ?? 'production']
|
||||
|
||||
console.info(`env : ${NODE_ENV} | ${dotfile}`)
|
||||
// logger.info('env', `${NODE_ENV} | ${dotfile}`)
|
||||
|
||||
const config = dotenv.config({ path: `./${dotfile}` })
|
||||
|
||||
if (config.error) throw `enviroment file ${dotfile} not found`
|
||||
// Try to load env file, but don't throw if it doesn't exist
|
||||
dotenv.config({ path: `./${dotfile}` })
|
||||
|
||||
const env = {
|
||||
HTTP_PORT: 2500,
|
||||
WS_PORT: 2501,
|
||||
HTTP_PORT: 2500,
|
||||
WS_PORT: 2501,
|
||||
LOG_LEVEL: 'info',
|
||||
}
|
||||
|
||||
// Override defaults with environment variables if they exist
|
||||
for (let key in env) {
|
||||
process.env[key] && (env[key] = env[key].constructor(process.env[key]))
|
||||
}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
import env from './env.js'
|
||||
|
||||
const colors = {
|
||||
reset: '\x1b[0m',
|
||||
dim: '\x1b[2m',
|
||||
bright: '\x1b[1m',
|
||||
|
||||
trace: '\x1b[90m',
|
||||
debug: '\x1b[36m',
|
||||
info: '\x1b[34m',
|
||||
warn: '\x1b[33m',
|
||||
error: '\x1b[31m',
|
||||
|
||||
emphasis: '\x1b[35m',
|
||||
}
|
||||
|
||||
const levels = {
|
||||
trace: 0,
|
||||
debug: 1,
|
||||
info: 2,
|
||||
warn: 3,
|
||||
error: 4,
|
||||
}
|
||||
|
||||
const threshold = levels[env.LOG_LEVEL?.toLowerCase()] ?? levels.info
|
||||
|
||||
function log(level, category, message, emphasis) {
|
||||
if (levels[level] < threshold) return
|
||||
|
||||
const now = new Date()
|
||||
const time = `${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(
|
||||
2,
|
||||
'0'
|
||||
)}:${String(now.getSeconds()).padStart(2, '0')}`
|
||||
|
||||
const timestamp = `${colors.dim}${time}${colors.reset}`
|
||||
const levelStr = `${colors[level]}${level.toUpperCase().padEnd(5)}${colors.reset}`
|
||||
const categoryStr = `${colors.bright}${category.padEnd(6)}${colors.reset}`
|
||||
|
||||
const isDebuggerAttached = typeof process !== 'undefined' && process.execArgv?.includes('--inspect')
|
||||
|
||||
const emphasisStr = emphasis
|
||||
? ` ${colors.emphasis}[${typeof emphasis === 'object' ? JSON.stringify(emphasis) : emphasis}]${
|
||||
colors.reset
|
||||
}`
|
||||
: ''
|
||||
|
||||
if (isDebuggerAttached) console.log(`${timestamp} ${levelStr} ${categoryStr} ${message}`, emphasis)
|
||||
else console.log(`${timestamp} ${levelStr} ${categoryStr} ${message}${emphasisStr}`)
|
||||
}
|
||||
|
||||
export default {
|
||||
trace: (category, message, emphasis) => log('trace', category, message, emphasis),
|
||||
debug: (category, message, emphasis) => log('debug', category, message, emphasis),
|
||||
info: (category, message, emphasis) => log('info', category, message, emphasis),
|
||||
warn: (category, message, emphasis) => log('warn', category, message, emphasis),
|
||||
error: (category, message, emphasis) => log('error', category, message, emphasis),
|
||||
}
|
||||
@@ -29,6 +29,7 @@
|
||||
"dependencies": {
|
||||
"dotenv": "^16.4.5",
|
||||
"express": "^4.18.2",
|
||||
"qrcode": "^1.5.4",
|
||||
"ws": "^8.11.0"
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,8 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
|
||||
<title>Host - Jaka To Melodia</title>
|
||||
|
||||
<link rel="stylesheet" href="/pattern.css" />
|
||||
<script src="/socket.js"></script>
|
||||
<style>
|
||||
* {
|
||||
@@ -15,33 +17,35 @@
|
||||
}
|
||||
|
||||
body {
|
||||
--fgcolor: #e77021;
|
||||
--bgcolor: #f97a1e;
|
||||
--pattern: 22px;
|
||||
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background: linear-gradient(135deg, #ffd700 0%, #ff4444 100%);
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.container {
|
||||
width: 100%;
|
||||
max-width: 600px;
|
||||
background: white;
|
||||
border-radius: 1rem;
|
||||
padding: 2rem;
|
||||
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
|
||||
background: #1a1a1a;
|
||||
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
|
||||
}
|
||||
|
||||
h1 {
|
||||
text-align: center;
|
||||
margin-bottom: 1.5rem;
|
||||
color: #333;
|
||||
color: #f0f0f0;
|
||||
font-size: 2rem;
|
||||
}
|
||||
|
||||
.track-info {
|
||||
background: linear-gradient(135deg, #ffd700 0%, #ff4444 100%);
|
||||
background: var(--bgcolor);
|
||||
border-radius: 0.75rem;
|
||||
padding: 1.5rem;
|
||||
margin-bottom: 2rem;
|
||||
@@ -70,7 +74,7 @@
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
color: #666;
|
||||
color: #999;
|
||||
margin-bottom: 0.75rem;
|
||||
}
|
||||
|
||||
@@ -85,7 +89,7 @@
|
||||
font-size: 1rem;
|
||||
font-weight: 600;
|
||||
color: white;
|
||||
background: linear-gradient(135deg, #ffd700 0%, #ff4444 100%);
|
||||
background: var(--bgcolor);
|
||||
border: none;
|
||||
border-radius: 0.5rem;
|
||||
cursor: pointer;
|
||||
@@ -102,58 +106,67 @@
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
body {
|
||||
background: linear-gradient(135deg, #664d00 0%, #660000 100%);
|
||||
}
|
||||
/* @media (prefers-color-scheme: dark) {
|
||||
|
||||
.container {
|
||||
background: #1a1a1a;
|
||||
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #f0f0f0;
|
||||
|
||||
}
|
||||
|
||||
.section-title {
|
||||
color: #999;
|
||||
|
||||
}
|
||||
|
||||
button {
|
||||
background: linear-gradient(135deg, #cc9900 0%, #cc0000 100%);
|
||||
}
|
||||
}
|
||||
} */
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<body class="patterned">
|
||||
<div class="container">
|
||||
<h1>Host Panel</h1>
|
||||
|
||||
<div class="track-info">
|
||||
<div class="artist" id="artist">—</div>
|
||||
<div class="track" id="track">—</div>
|
||||
<div class="artist" id="artist">—</div>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<div class="section-title">Playback</div>
|
||||
<div class="button-group">
|
||||
<button onclick="socket.send({action: 'play'})">Play</button>
|
||||
<button onclick="socket.send({action: 'pause'})">Pause</button>
|
||||
<button onclick="socket.send({action: 'next'})">Next</button>
|
||||
<button onclick="socket.send({action: 'clear'})">Clear</button>
|
||||
<button onclick="socket.host('play')">Play</button>
|
||||
<button onclick="socket.host('pause')">Pause</button>
|
||||
<button onclick="socket.host('next')">Next</button>
|
||||
<button onclick="socket.host('clear')">Clear</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<div class="section-title">Points</div>
|
||||
<div class="button-group">
|
||||
<button onclick="socket.send({action: 'points', points: 0.5})">+0.5</button>
|
||||
<button onclick="socket.send({action: 'points', points: 1})">+1</button>
|
||||
<button onclick="socket.send({action: 'points', points: 2})">+2</button>
|
||||
<button onclick="socket.send({action: 'nextPlayer'})">Next Player</button>
|
||||
<button onclick="socket.host('points', { points: 0.5 })">+0.5</button>
|
||||
<button onclick="socket.host('points', { points: 1 })">+1</button>
|
||||
<button onclick="socket.host('points', { points: 2 })">+2</button>
|
||||
<button onclick="socket.host('nextPlayer')">Next Player</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<div class="section-title">QR Code</div>
|
||||
<div class="button-group">
|
||||
<button onclick="socket.host('showQr', { show: true })">Show QR</button>
|
||||
<button onclick="socket.host('showQr', { show: false })">Hide QR</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <div class="section">
|
||||
<div class="section-title">Scoreboard</div>
|
||||
<div class="button-group">
|
||||
<button onclick="socket.host('showScoreboard', { show: true })">Show Scoreboard</button>
|
||||
<button onclick="socket.host('showScoreboard', { show: false })">Hide Scoreboard</button>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
<script>
|
||||
@@ -162,11 +175,10 @@
|
||||
const artistElement = document.querySelector('#artist')
|
||||
const trackElement = document.querySelector('#track')
|
||||
|
||||
socket.bind((data) => {
|
||||
if (data.metadata) {
|
||||
artistElement.textContent = data.metadata.artist
|
||||
trackElement.textContent = data.metadata.title
|
||||
}
|
||||
// Use custom event listener for metadata updates
|
||||
socket.on('metadata', metadata => {
|
||||
artistElement.textContent = metadata.author
|
||||
trackElement.textContent = metadata.track
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
@@ -70,15 +70,15 @@
|
||||
</style>
|
||||
</head>
|
||||
<body class="patterned">
|
||||
<div id="score">
|
||||
<!-- <div id="score">
|
||||
<span>Punkty:</span>
|
||||
<span id="points">0</span>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<input type="text" id="nick" placeholder="nick" maxlength="20" />
|
||||
|
||||
<button>
|
||||
<img src="twerk.gif" alt="doopa" />
|
||||
<!-- <img src="twerk.gif" alt="doopa" /> -->
|
||||
</button>
|
||||
|
||||
<script>
|
||||
@@ -94,7 +94,7 @@
|
||||
// Initialize nickname
|
||||
const savedNick = localStorage.getItem('nick') || ''
|
||||
nodeNick.value = savedNick
|
||||
socket.player('nick', savedNick)
|
||||
socket.player('setNick', { nick: savedNick })
|
||||
|
||||
// Handle button press
|
||||
nodeButton.addEventListener('mousedown', () => socket.player('enter'))
|
||||
@@ -103,18 +103,16 @@
|
||||
// Handle nickname changes
|
||||
const setNick = e => {
|
||||
const nick = e.target.value.trim().toLowerCase()
|
||||
socket.player('nick', nick)
|
||||
socket.player('setNick', { nick })
|
||||
localStorage.setItem('nick', nick)
|
||||
}
|
||||
|
||||
nodeNick.addEventListener('change', setNick)
|
||||
|
||||
// Update points display
|
||||
socket.bind(data => {
|
||||
if (data.points !== undefined) {
|
||||
nodePoints.textContent = data.points
|
||||
}
|
||||
})
|
||||
// // Update points display using custom event listener
|
||||
// socket.on('points', points => {
|
||||
// nodePoints.textContent = points
|
||||
// })
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
+302
@@ -0,0 +1,302 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
|
||||
<title>TV - Jaka To Melodia</title>
|
||||
<script src="/socket.js"></script>
|
||||
<script src="/wakelock.js"></script>
|
||||
|
||||
<link rel="stylesheet" href="/common.css" />
|
||||
<link rel="stylesheet" href="/pattern.css" />
|
||||
<link rel="stylesheet" href="/loader.css" />
|
||||
|
||||
<style>
|
||||
body {
|
||||
height: 100vh;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
--pattern: 22px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.section {
|
||||
flex: 1;
|
||||
padding: 2rem;
|
||||
overflow-y: auto;
|
||||
background: #0005;
|
||||
--margin: 1em;
|
||||
margin: var(--margin);
|
||||
border-radius: 1em;
|
||||
}
|
||||
|
||||
.section.l {
|
||||
margin-right: calc(var(--margin) / 2);
|
||||
}
|
||||
|
||||
.section.r {
|
||||
margin-left: calc(var(--margin) / 2);
|
||||
}
|
||||
|
||||
.section .title {
|
||||
font-size: 2.5rem;
|
||||
font-weight: bold;
|
||||
margin-bottom: 1.5rem;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
font-family: monospace;
|
||||
border-bottom: 1px solid #fff3;
|
||||
padding-bottom: 0.5em;
|
||||
}
|
||||
|
||||
#status {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
z-index: 100;
|
||||
pointer-events: none;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 200px;
|
||||
text-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
#queue {
|
||||
font-size: 30px;
|
||||
font-family: monospace;
|
||||
text-align: left;
|
||||
counter-reset: poz;
|
||||
}
|
||||
|
||||
#queue > .nick {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 0.8rem 1.5rem;
|
||||
margin: 0.5rem 0;
|
||||
background-color: rgba(255, 255, 255, 0.15);
|
||||
border-radius: 0.5rem;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#queue > .nick::before {
|
||||
counter-increment: poz;
|
||||
content: '#' counter(poz) ' ';
|
||||
font-weight: bold;
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
#queue > img {
|
||||
height: 10vh;
|
||||
}
|
||||
|
||||
#queue .nick.active {
|
||||
outline: 2px solid #fff;
|
||||
}
|
||||
|
||||
#qr-modal {
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.9);
|
||||
z-index: 1000;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
#qr-modal.show {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
#qr-modal .content {
|
||||
background-color: white;
|
||||
padding: 2rem;
|
||||
border-radius: 1rem;
|
||||
text-align: center;
|
||||
max-width: 90vw;
|
||||
max-height: 90vh;
|
||||
}
|
||||
|
||||
#qr-modal .content img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
border-radius: 0.5rem;
|
||||
}
|
||||
|
||||
#scoreboard {
|
||||
width: 100%;
|
||||
font-size: 1.5rem;
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
#scoreboard .item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 0.8rem 1.5rem;
|
||||
margin: 0.5rem 0;
|
||||
background-color: rgba(255, 255, 255, 0.15);
|
||||
border-radius: 0.5rem;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#scoreboard .item .rank i {
|
||||
font-size: 2rem;
|
||||
}
|
||||
|
||||
#scoreboard .item:nth-child(1) .rank {
|
||||
color: gold;
|
||||
}
|
||||
|
||||
#scoreboard .item:nth-child(2) .rank {
|
||||
color: silver;
|
||||
}
|
||||
|
||||
#scoreboard .item:nth-child(3) .rank {
|
||||
color: #cd7f32; /* Bronze */
|
||||
}
|
||||
|
||||
#scoreboard .item > .rank {
|
||||
font-weight: bold;
|
||||
margin-right: 1rem;
|
||||
min-width: 2.5rem;
|
||||
}
|
||||
|
||||
#scoreboard .item > .nick {
|
||||
flex: 1;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
#scoreboard .item > .score {
|
||||
font-weight: bold;
|
||||
min-width: 3rem;
|
||||
text-align: right;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body class="patterned">
|
||||
<!-- Status Indicator -->
|
||||
<div id="status" class="status"></div>
|
||||
|
||||
<!-- Left: Queue -->
|
||||
<div class="section l">
|
||||
<div class="title">
|
||||
<i class="icon-stopwatch"></i>
|
||||
</div>
|
||||
<div id="queue">
|
||||
<!-- Example
|
||||
<div class="nick active"> </div>
|
||||
-->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Right: Scoreboard -->
|
||||
<div class="section r">
|
||||
<div class="title">
|
||||
<i class="icon-award"></i>
|
||||
</div>
|
||||
<div id="scoreboard">
|
||||
<!-- Example
|
||||
<div class="item">
|
||||
<span class="rank"> </span>
|
||||
<span class="nick"> </span>
|
||||
<span class="score"> </span>
|
||||
</div>
|
||||
-->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- QR Modal -->
|
||||
<div id="qr-modal">
|
||||
<div class="content">
|
||||
<img src="/qr" alt="QR Code" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// SETUP
|
||||
const statuses = {
|
||||
paused: '<i class="icon-pause-circled"></i>',
|
||||
playing: '<i class="icon-play-circled"></i>',
|
||||
waiting: '<i class="icon-stop-circled"></i>',
|
||||
}
|
||||
|
||||
const nodeStatus = document.querySelector('#status'),
|
||||
nodeQueue = document.querySelector('#queue'),
|
||||
nodeScore = document.querySelector('#scoreboard'),
|
||||
nodeQrModal = document.querySelector('#qr-modal')
|
||||
|
||||
const socket = new Socket('tv')
|
||||
|
||||
var localStatus = 'waiting',
|
||||
localQueue = [],
|
||||
localActive = 0
|
||||
|
||||
function setStatus(status = 'waiting') {
|
||||
const patternColors = {
|
||||
playing: { fg: '#18dd5c', bg: '#1bc957' },
|
||||
paused: { fg: '#28357d', bg: '#22307b' },
|
||||
waiting: { fg: '#364d69', bg: '#425b79' },
|
||||
}
|
||||
|
||||
console.info('status', status)
|
||||
|
||||
nodeStatus.innerHTML = statuses[status]
|
||||
document.body.style.setProperty('--fgcolor', patternColors[status].fg)
|
||||
document.body.style.setProperty('--bgcolor', patternColors[status].bg)
|
||||
}
|
||||
|
||||
function setQueue(queue, active = 0) {
|
||||
nodeQueue.innerHTML = queue
|
||||
.map((nick, i) => `<div class="nick ${i == active ? 'active' : ''}">${nick}</div>`)
|
||||
.join('')
|
||||
}
|
||||
|
||||
function showQrModal(show = true) {
|
||||
if (show) nodeQrModal.classList.add('show')
|
||||
else nodeQrModal.classList.remove('show')
|
||||
}
|
||||
|
||||
function setScoreboard(scoreboard) {
|
||||
const sorted = [...scoreboard].sort((a, b) => b.score - a.score)
|
||||
|
||||
const icon = '<i class="icon-award-1"></i>'
|
||||
|
||||
nodeScore.innerHTML = sorted
|
||||
.map((player, i) => {
|
||||
return `<div class="item">
|
||||
<span class="rank">${i < 3 ? icon : `#${i + 1}`}</span>
|
||||
<span class="nick">${player.nick || '---'}</span>
|
||||
<span class="score">${player.score}</span>
|
||||
</div>`
|
||||
})
|
||||
.join('')
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
requestWakeLock()
|
||||
setStatus()
|
||||
|
||||
socket.on('update', ({ board, active, queue, status }) => {
|
||||
setQueue(queue, active)
|
||||
setStatus(status)
|
||||
setScoreboard(board)
|
||||
})
|
||||
|
||||
socket.on('showQr', data => {
|
||||
showQrModal(data.show)
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Generated
+216
@@ -14,6 +14,9 @@ importers:
|
||||
express:
|
||||
specifier: ^4.18.2
|
||||
version: 4.18.2
|
||||
qrcode:
|
||||
specifier: ^1.5.4
|
||||
version: 1.5.4
|
||||
ws:
|
||||
specifier: ^8.11.0
|
||||
version: 8.11.0
|
||||
@@ -24,6 +27,14 @@ packages:
|
||||
resolution: {integrity: sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==}
|
||||
engines: {node: '>= 0.6'}
|
||||
|
||||
ansi-regex@5.0.1:
|
||||
resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
ansi-styles@4.3.0:
|
||||
resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
array-flatten@1.1.1:
|
||||
resolution: {integrity: sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==}
|
||||
|
||||
@@ -38,6 +49,20 @@ packages:
|
||||
call-bind@1.0.2:
|
||||
resolution: {integrity: sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==}
|
||||
|
||||
camelcase@5.3.1:
|
||||
resolution: {integrity: sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==}
|
||||
engines: {node: '>=6'}
|
||||
|
||||
cliui@6.0.0:
|
||||
resolution: {integrity: sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==}
|
||||
|
||||
color-convert@2.0.1:
|
||||
resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==}
|
||||
engines: {node: '>=7.0.0'}
|
||||
|
||||
color-name@1.1.4:
|
||||
resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==}
|
||||
|
||||
content-disposition@0.5.4:
|
||||
resolution: {integrity: sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==}
|
||||
engines: {node: '>= 0.6'}
|
||||
@@ -61,6 +86,10 @@ packages:
|
||||
supports-color:
|
||||
optional: true
|
||||
|
||||
decamelize@1.2.0:
|
||||
resolution: {integrity: sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
depd@2.0.0:
|
||||
resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==}
|
||||
engines: {node: '>= 0.8'}
|
||||
@@ -69,6 +98,9 @@ packages:
|
||||
resolution: {integrity: sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==}
|
||||
engines: {node: '>= 0.8', npm: 1.2.8000 || >= 1.4.16}
|
||||
|
||||
dijkstrajs@1.0.3:
|
||||
resolution: {integrity: sha512-qiSlmBq9+BCdCA/L46dw8Uy93mloxsPSbwnm5yrKn2vMPiy8KyAskTF6zuV/j5BMsmOGZDPs7KjU+mjb670kfA==}
|
||||
|
||||
dotenv@16.4.5:
|
||||
resolution: {integrity: sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==}
|
||||
engines: {node: '>=12'}
|
||||
@@ -76,6 +108,9 @@ packages:
|
||||
ee-first@1.1.1:
|
||||
resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==}
|
||||
|
||||
emoji-regex@8.0.0:
|
||||
resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==}
|
||||
|
||||
encodeurl@1.0.2:
|
||||
resolution: {integrity: sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==}
|
||||
engines: {node: '>= 0.8'}
|
||||
@@ -95,6 +130,10 @@ packages:
|
||||
resolution: {integrity: sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==}
|
||||
engines: {node: '>= 0.8'}
|
||||
|
||||
find-up@4.1.0:
|
||||
resolution: {integrity: sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
forwarded@0.2.0:
|
||||
resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==}
|
||||
engines: {node: '>= 0.6'}
|
||||
@@ -106,6 +145,10 @@ packages:
|
||||
function-bind@1.1.1:
|
||||
resolution: {integrity: sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==}
|
||||
|
||||
get-caller-file@2.0.5:
|
||||
resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==}
|
||||
engines: {node: 6.* || 8.* || >= 10.*}
|
||||
|
||||
get-intrinsic@1.2.1:
|
||||
resolution: {integrity: sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==}
|
||||
|
||||
@@ -136,6 +179,14 @@ packages:
|
||||
resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==}
|
||||
engines: {node: '>= 0.10'}
|
||||
|
||||
is-fullwidth-code-point@3.0.0:
|
||||
resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
locate-path@5.0.0:
|
||||
resolution: {integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
media-typer@0.3.0:
|
||||
resolution: {integrity: sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==}
|
||||
engines: {node: '>= 0.6'}
|
||||
@@ -177,17 +228,42 @@ packages:
|
||||
resolution: {integrity: sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==}
|
||||
engines: {node: '>= 0.8'}
|
||||
|
||||
p-limit@2.3.0:
|
||||
resolution: {integrity: sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==}
|
||||
engines: {node: '>=6'}
|
||||
|
||||
p-locate@4.1.0:
|
||||
resolution: {integrity: sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
p-try@2.2.0:
|
||||
resolution: {integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==}
|
||||
engines: {node: '>=6'}
|
||||
|
||||
parseurl@1.3.3:
|
||||
resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==}
|
||||
engines: {node: '>= 0.8'}
|
||||
|
||||
path-exists@4.0.0:
|
||||
resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
path-to-regexp@0.1.7:
|
||||
resolution: {integrity: sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==}
|
||||
|
||||
pngjs@5.0.0:
|
||||
resolution: {integrity: sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw==}
|
||||
engines: {node: '>=10.13.0'}
|
||||
|
||||
proxy-addr@2.0.7:
|
||||
resolution: {integrity: sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==}
|
||||
engines: {node: '>= 0.10'}
|
||||
|
||||
qrcode@1.5.4:
|
||||
resolution: {integrity: sha512-1ca71Zgiu6ORjHqFBDpnSMTR2ReToX4l1Au1VFLyVeBTFavzQnv5JxMFr3ukHVKpSrSA2MCk0lNJSykjUfz7Zg==}
|
||||
engines: {node: '>=10.13.0'}
|
||||
hasBin: true
|
||||
|
||||
qs@6.11.0:
|
||||
resolution: {integrity: sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==}
|
||||
engines: {node: '>=0.6'}
|
||||
@@ -200,6 +276,13 @@ packages:
|
||||
resolution: {integrity: sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==}
|
||||
engines: {node: '>= 0.8'}
|
||||
|
||||
require-directory@2.1.1:
|
||||
resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
require-main-filename@2.0.0:
|
||||
resolution: {integrity: sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==}
|
||||
|
||||
safe-buffer@5.2.1:
|
||||
resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==}
|
||||
|
||||
@@ -214,6 +297,9 @@ packages:
|
||||
resolution: {integrity: sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==}
|
||||
engines: {node: '>= 0.8.0'}
|
||||
|
||||
set-blocking@2.0.0:
|
||||
resolution: {integrity: sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==}
|
||||
|
||||
setprototypeof@1.2.0:
|
||||
resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==}
|
||||
|
||||
@@ -224,6 +310,14 @@ packages:
|
||||
resolution: {integrity: sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==}
|
||||
engines: {node: '>= 0.8'}
|
||||
|
||||
string-width@4.2.3:
|
||||
resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
strip-ansi@6.0.1:
|
||||
resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
toidentifier@1.0.1:
|
||||
resolution: {integrity: sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==}
|
||||
engines: {node: '>=0.6'}
|
||||
@@ -244,6 +338,13 @@ packages:
|
||||
resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==}
|
||||
engines: {node: '>= 0.8'}
|
||||
|
||||
which-module@2.0.1:
|
||||
resolution: {integrity: sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==}
|
||||
|
||||
wrap-ansi@6.2.0:
|
||||
resolution: {integrity: sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
ws@8.11.0:
|
||||
resolution: {integrity: sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==}
|
||||
engines: {node: '>=10.0.0'}
|
||||
@@ -256,6 +357,17 @@ packages:
|
||||
utf-8-validate:
|
||||
optional: true
|
||||
|
||||
y18n@4.0.3:
|
||||
resolution: {integrity: sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==}
|
||||
|
||||
yargs-parser@18.1.3:
|
||||
resolution: {integrity: sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==}
|
||||
engines: {node: '>=6'}
|
||||
|
||||
yargs@15.4.1:
|
||||
resolution: {integrity: sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
snapshots:
|
||||
|
||||
accepts@1.3.8:
|
||||
@@ -263,6 +375,12 @@ snapshots:
|
||||
mime-types: 2.1.35
|
||||
negotiator: 0.6.3
|
||||
|
||||
ansi-regex@5.0.1: {}
|
||||
|
||||
ansi-styles@4.3.0:
|
||||
dependencies:
|
||||
color-convert: 2.0.1
|
||||
|
||||
array-flatten@1.1.1: {}
|
||||
|
||||
body-parser@1.20.1:
|
||||
@@ -289,6 +407,20 @@ snapshots:
|
||||
function-bind: 1.1.1
|
||||
get-intrinsic: 1.2.1
|
||||
|
||||
camelcase@5.3.1: {}
|
||||
|
||||
cliui@6.0.0:
|
||||
dependencies:
|
||||
string-width: 4.2.3
|
||||
strip-ansi: 6.0.1
|
||||
wrap-ansi: 6.2.0
|
||||
|
||||
color-convert@2.0.1:
|
||||
dependencies:
|
||||
color-name: 1.1.4
|
||||
|
||||
color-name@1.1.4: {}
|
||||
|
||||
content-disposition@0.5.4:
|
||||
dependencies:
|
||||
safe-buffer: 5.2.1
|
||||
@@ -303,14 +435,20 @@ snapshots:
|
||||
dependencies:
|
||||
ms: 2.0.0
|
||||
|
||||
decamelize@1.2.0: {}
|
||||
|
||||
depd@2.0.0: {}
|
||||
|
||||
destroy@1.2.0: {}
|
||||
|
||||
dijkstrajs@1.0.3: {}
|
||||
|
||||
dotenv@16.4.5: {}
|
||||
|
||||
ee-first@1.1.1: {}
|
||||
|
||||
emoji-regex@8.0.0: {}
|
||||
|
||||
encodeurl@1.0.2: {}
|
||||
|
||||
escape-html@1.0.3: {}
|
||||
@@ -365,12 +503,19 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
find-up@4.1.0:
|
||||
dependencies:
|
||||
locate-path: 5.0.0
|
||||
path-exists: 4.0.0
|
||||
|
||||
forwarded@0.2.0: {}
|
||||
|
||||
fresh@0.5.2: {}
|
||||
|
||||
function-bind@1.1.1: {}
|
||||
|
||||
get-caller-file@2.0.5: {}
|
||||
|
||||
get-intrinsic@1.2.1:
|
||||
dependencies:
|
||||
function-bind: 1.1.1
|
||||
@@ -402,6 +547,12 @@ snapshots:
|
||||
|
||||
ipaddr.js@1.9.1: {}
|
||||
|
||||
is-fullwidth-code-point@3.0.0: {}
|
||||
|
||||
locate-path@5.0.0:
|
||||
dependencies:
|
||||
p-locate: 4.1.0
|
||||
|
||||
media-typer@0.3.0: {}
|
||||
|
||||
merge-descriptors@1.0.1: {}
|
||||
@@ -428,15 +579,35 @@ snapshots:
|
||||
dependencies:
|
||||
ee-first: 1.1.1
|
||||
|
||||
p-limit@2.3.0:
|
||||
dependencies:
|
||||
p-try: 2.2.0
|
||||
|
||||
p-locate@4.1.0:
|
||||
dependencies:
|
||||
p-limit: 2.3.0
|
||||
|
||||
p-try@2.2.0: {}
|
||||
|
||||
parseurl@1.3.3: {}
|
||||
|
||||
path-exists@4.0.0: {}
|
||||
|
||||
path-to-regexp@0.1.7: {}
|
||||
|
||||
pngjs@5.0.0: {}
|
||||
|
||||
proxy-addr@2.0.7:
|
||||
dependencies:
|
||||
forwarded: 0.2.0
|
||||
ipaddr.js: 1.9.1
|
||||
|
||||
qrcode@1.5.4:
|
||||
dependencies:
|
||||
dijkstrajs: 1.0.3
|
||||
pngjs: 5.0.0
|
||||
yargs: 15.4.1
|
||||
|
||||
qs@6.11.0:
|
||||
dependencies:
|
||||
side-channel: 1.0.4
|
||||
@@ -450,6 +621,10 @@ snapshots:
|
||||
iconv-lite: 0.4.24
|
||||
unpipe: 1.0.0
|
||||
|
||||
require-directory@2.1.1: {}
|
||||
|
||||
require-main-filename@2.0.0: {}
|
||||
|
||||
safe-buffer@5.2.1: {}
|
||||
|
||||
safer-buffer@2.1.2: {}
|
||||
@@ -481,6 +656,8 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
set-blocking@2.0.0: {}
|
||||
|
||||
setprototypeof@1.2.0: {}
|
||||
|
||||
side-channel@1.0.4:
|
||||
@@ -491,6 +668,16 @@ snapshots:
|
||||
|
||||
statuses@2.0.1: {}
|
||||
|
||||
string-width@4.2.3:
|
||||
dependencies:
|
||||
emoji-regex: 8.0.0
|
||||
is-fullwidth-code-point: 3.0.0
|
||||
strip-ansi: 6.0.1
|
||||
|
||||
strip-ansi@6.0.1:
|
||||
dependencies:
|
||||
ansi-regex: 5.0.1
|
||||
|
||||
toidentifier@1.0.1: {}
|
||||
|
||||
type-is@1.6.18:
|
||||
@@ -504,4 +691,33 @@ snapshots:
|
||||
|
||||
vary@1.1.2: {}
|
||||
|
||||
which-module@2.0.1: {}
|
||||
|
||||
wrap-ansi@6.2.0:
|
||||
dependencies:
|
||||
ansi-styles: 4.3.0
|
||||
string-width: 4.2.3
|
||||
strip-ansi: 6.0.1
|
||||
|
||||
ws@8.11.0: {}
|
||||
|
||||
y18n@4.0.3: {}
|
||||
|
||||
yargs-parser@18.1.3:
|
||||
dependencies:
|
||||
camelcase: 5.3.1
|
||||
decamelize: 1.2.0
|
||||
|
||||
yargs@15.4.1:
|
||||
dependencies:
|
||||
cliui: 6.0.0
|
||||
decamelize: 1.2.0
|
||||
find-up: 4.1.0
|
||||
get-caller-file: 2.0.5
|
||||
require-directory: 2.1.1
|
||||
require-main-filename: 2.0.0
|
||||
set-blocking: 2.0.0
|
||||
string-width: 4.2.3
|
||||
which-module: 2.0.1
|
||||
y18n: 4.0.3
|
||||
yargs-parser: 18.1.3
|
||||
@@ -0,0 +1 @@
|
||||
@import url('./fontello/css/fontello.css');
|
||||
@@ -0,0 +1,39 @@
|
||||
Font license info
|
||||
|
||||
|
||||
## Font Awesome
|
||||
|
||||
Copyright (C) 2016 by Dave Gandy
|
||||
|
||||
Author: Dave Gandy
|
||||
License: SIL ()
|
||||
Homepage: http://fortawesome.github.com/Font-Awesome/
|
||||
|
||||
|
||||
## Elusive
|
||||
|
||||
Copyright (C) 2013 by Aristeides Stathopoulos
|
||||
|
||||
Author: Aristeides Stathopoulos
|
||||
License: SIL (http://scripts.sil.org/OFL)
|
||||
Homepage: http://aristeides.com/
|
||||
|
||||
|
||||
## MFG Labs
|
||||
|
||||
Copyright (C) 2012 by Daniel Bruce
|
||||
|
||||
Author: MFG Labs
|
||||
License: SIL (http://scripts.sil.org/OFL)
|
||||
Homepage: http://www.mfglabs.com/
|
||||
|
||||
|
||||
## Iconic
|
||||
|
||||
Copyright (C) 2012 by P.J. Onori
|
||||
|
||||
Author: P.J. Onori
|
||||
License: SIL (http://scripts.sil.org/OFL)
|
||||
Homepage: http://somerandomdude.com/work/iconic/
|
||||
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
This webfont is generated by https://fontello.com open source project.
|
||||
|
||||
|
||||
================================================================================
|
||||
Please, note, that you should obey original font licenses, used to make this
|
||||
webfont pack. Details available in LICENSE.txt file.
|
||||
|
||||
- Usually, it's enough to publish content of LICENSE.txt file somewhere on your
|
||||
site in "About" section.
|
||||
|
||||
- If your project is open-source, usually, it will be ok to make LICENSE.txt
|
||||
file publicly available in your repository.
|
||||
|
||||
- Fonts, used in Fontello, don't require a clickable link on your site.
|
||||
But any kind of additional authors crediting is welcome.
|
||||
================================================================================
|
||||
|
||||
|
||||
Comments on archive content
|
||||
---------------------------
|
||||
|
||||
- /font/* - fonts in different formats
|
||||
|
||||
- /css/* - different kinds of css, for all situations. Should be ok with
|
||||
twitter bootstrap. Also, you can skip <i> style and assign icon classes
|
||||
directly to text elements, if you don't mind about IE7.
|
||||
|
||||
- demo.html - demo file, to show your webfont content
|
||||
|
||||
- LICENSE.txt - license info about source fonts, used to build your one.
|
||||
|
||||
- config.json - keeps your settings. You can import it back into fontello
|
||||
anytime, to continue your work
|
||||
|
||||
|
||||
Why so many CSS files ?
|
||||
-----------------------
|
||||
|
||||
Because we like to fit all your needs :)
|
||||
|
||||
- basic file, <your_font_name>.css - is usually enough, it contains @font-face
|
||||
and character code definitions
|
||||
|
||||
- *-ie7.css - if you need IE7 support, but still don't wish to put char codes
|
||||
directly into html
|
||||
|
||||
- *-codes.css and *-ie7-codes.css - if you like to use your own @font-face
|
||||
rules, but still wish to benefit from css generation. That can be very
|
||||
convenient for automated asset build systems. When you need to update font -
|
||||
no need to manually edit files, just override old version with archive
|
||||
content. See fontello source code for examples.
|
||||
|
||||
- *-embedded.css - basic css file, but with embedded WOFF font, to avoid
|
||||
CORS issues in Firefox and IE9+, when fonts are hosted on the separate domain.
|
||||
We strongly recommend to resolve this issue by `Access-Control-Allow-Origin`
|
||||
server headers. But if you ok with dirty hack - this file is for you. Note,
|
||||
that data url moved to separate @font-face to avoid problems with <IE9, when
|
||||
string is too long.
|
||||
|
||||
- animate.css - use it to get ideas about spinner rotation animation.
|
||||
|
||||
|
||||
Attention for server setup
|
||||
--------------------------
|
||||
|
||||
You MUST setup server to reply with proper `mime-types` for font files -
|
||||
otherwise some browsers will fail to show fonts.
|
||||
|
||||
Usually, `apache` already has necessary settings, but `nginx` and other
|
||||
webservers should be tuned. Here is list of mime types for our file extensions:
|
||||
|
||||
- `application/vnd.ms-fontobject` - eot
|
||||
- `application/x-font-woff` - woff
|
||||
- `application/x-font-ttf` - ttf
|
||||
- `image/svg+xml` - svg
|
||||
@@ -0,0 +1,52 @@
|
||||
{
|
||||
"name": "",
|
||||
"css_prefix_text": "icon-",
|
||||
"css_use_suffix": false,
|
||||
"hinting": true,
|
||||
"units_per_em": 1000,
|
||||
"ascent": 850,
|
||||
"glyphs": [
|
||||
{
|
||||
"uid": "ab656e280958018a7859eba9a1eabbc7",
|
||||
"css": "award",
|
||||
"code": 59392,
|
||||
"src": "fontawesome"
|
||||
},
|
||||
{
|
||||
"uid": "f6766a8b042c2453a4e153af03294383",
|
||||
"css": "list-numbered",
|
||||
"code": 61643,
|
||||
"src": "fontawesome"
|
||||
},
|
||||
{
|
||||
"uid": "fc006ff27e50163bdec3a7588226171b",
|
||||
"css": "play-circled",
|
||||
"code": 59393,
|
||||
"src": "elusive"
|
||||
},
|
||||
{
|
||||
"uid": "8710d1e404dcb3a55b3ab97f797355b5",
|
||||
"css": "pause-circled",
|
||||
"code": 59394,
|
||||
"src": "elusive"
|
||||
},
|
||||
{
|
||||
"uid": "fa2a253fba2da626ef08edcc62d1e4b6",
|
||||
"css": "stop-circled",
|
||||
"code": 59395,
|
||||
"src": "elusive"
|
||||
},
|
||||
{
|
||||
"uid": "53c977df16b09e3f7700a27ec90c43dc",
|
||||
"css": "stopwatch",
|
||||
"code": 59396,
|
||||
"src": "mfglabs"
|
||||
},
|
||||
{
|
||||
"uid": "96f70b04affa57b79d70f5874815a912",
|
||||
"css": "award-1",
|
||||
"code": 59397,
|
||||
"src": "iconic"
|
||||
}
|
||||
]
|
||||
}
|
||||
Vendored
+85
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
Animation example, for spinners
|
||||
*/
|
||||
.animate-spin {
|
||||
-moz-animation: spin 2s infinite linear;
|
||||
-o-animation: spin 2s infinite linear;
|
||||
-webkit-animation: spin 2s infinite linear;
|
||||
animation: spin 2s infinite linear;
|
||||
display: inline-block;
|
||||
}
|
||||
@-moz-keyframes spin {
|
||||
0% {
|
||||
-moz-transform: rotate(0deg);
|
||||
-o-transform: rotate(0deg);
|
||||
-webkit-transform: rotate(0deg);
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
-moz-transform: rotate(359deg);
|
||||
-o-transform: rotate(359deg);
|
||||
-webkit-transform: rotate(359deg);
|
||||
transform: rotate(359deg);
|
||||
}
|
||||
}
|
||||
@-webkit-keyframes spin {
|
||||
0% {
|
||||
-moz-transform: rotate(0deg);
|
||||
-o-transform: rotate(0deg);
|
||||
-webkit-transform: rotate(0deg);
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
-moz-transform: rotate(359deg);
|
||||
-o-transform: rotate(359deg);
|
||||
-webkit-transform: rotate(359deg);
|
||||
transform: rotate(359deg);
|
||||
}
|
||||
}
|
||||
@-o-keyframes spin {
|
||||
0% {
|
||||
-moz-transform: rotate(0deg);
|
||||
-o-transform: rotate(0deg);
|
||||
-webkit-transform: rotate(0deg);
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
-moz-transform: rotate(359deg);
|
||||
-o-transform: rotate(359deg);
|
||||
-webkit-transform: rotate(359deg);
|
||||
transform: rotate(359deg);
|
||||
}
|
||||
}
|
||||
@-ms-keyframes spin {
|
||||
0% {
|
||||
-moz-transform: rotate(0deg);
|
||||
-o-transform: rotate(0deg);
|
||||
-webkit-transform: rotate(0deg);
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
-moz-transform: rotate(359deg);
|
||||
-o-transform: rotate(359deg);
|
||||
-webkit-transform: rotate(359deg);
|
||||
transform: rotate(359deg);
|
||||
}
|
||||
}
|
||||
@keyframes spin {
|
||||
0% {
|
||||
-moz-transform: rotate(0deg);
|
||||
-o-transform: rotate(0deg);
|
||||
-webkit-transform: rotate(0deg);
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
-moz-transform: rotate(359deg);
|
||||
-o-transform: rotate(359deg);
|
||||
-webkit-transform: rotate(359deg);
|
||||
transform: rotate(359deg);
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
|
||||
.icon-award:before { content: '\e800'; } /* '' */
|
||||
.icon-play-circled:before { content: '\e801'; } /* '' */
|
||||
.icon-pause-circled:before { content: '\e802'; } /* '' */
|
||||
.icon-stop-circled:before { content: '\e803'; } /* '' */
|
||||
.icon-stopwatch:before { content: '\e804'; } /* '' */
|
||||
.icon-award-1:before { content: '\e805'; } /* '' */
|
||||
.icon-list-numbered:before { content: '\f0cb'; } /* '' */
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
@font-face {
|
||||
font-family: 'fontello';
|
||||
src: url('../font/fontello.eot?5046504');
|
||||
src: url('../font/fontello.eot?5046504#iefix') format('embedded-opentype'),
|
||||
url('../font/fontello.svg?5046504#fontello') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'fontello';
|
||||
src: url('data:application/octet-stream;base64,d09GRgABAAAAABEcAA8AAAAAHWQAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABWAAAADsAAABUIIslek9TLzIAAAGUAAAARAAAAGA+MFLYY21hcAAAAdgAAABzAAABzOLqli5jdnQgAAACTAAAAAsAAAAOAAAAAGZwZ20AAAJYAAAG7QAADgxiLvl6Z2FzcAAACUgAAAAIAAAACAAAABBnbHlmAAAJUAAABNUAAAckhP0ZeGhlYWQAAA4oAAAAMwAAADYt8I0XaGhlYQAADlwAAAAgAAAAJAdbA3hobXR4AAAOfAAAABwAAAAgHRH//2xvY2EAAA6YAAAAEgAAABIGtAO0bWF4cAAADqwAAAAgAAAAIAGnDuluYW1lAAAOzAAAAXQAAALNzZ0cHXBvc3QAABBAAAAAXgAAAINJCDtPcHJlcAAAEKAAAAB6AAAAnH62O7Z4nGNgZGBg4GIwYLBjYHJx8wlh4MtJLMljkGJgYYAAkDwymzEnMz2RgQPGA8qxgGkOIGaDiAIAJjsFSAB4nGNgYV7EOIGBlYGBqYppDwMDQw+EZnzAYMjIBBRlYGVmwAoC0lxTGA68YPhwmjnofxZDFPMahsVAYUYURUwAm7gNjnic7ZHBDYQwDATHEBIJ8aAQ3lcQ4nG9XiN+0gGsE5dxK01WdpQ8doEFmMUhCtgXI3Rqa30/s/Z94aO5yo3Jl/v3POAMl0x3e/dJb4p+rjSNlb+2fl45tchtEBl7otzwJDrxJHrxJPryRPkq/QHtBVY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658duXo6+196sXP4yaqqnEnIKOECmXvRMjs/b1d3aY2Pd26cPt4/caFXbsu3KifP5HvultfrteXby8fJM8vmXFTvWhuatK8N2OELal/1fo9/Iq2ARe1zle6GCEiuVFZohSGvdwWhQ9ZFJqCswhBIS/gyCUW63YLrmpzNUZL6Uj6N6f/lZNbruOnjeovemPp1Ck8quP4t42qYDDBOE5/orshBQOwG6bgJXiDGBV3sraP6k3nXiZh/SSGwn3IfTO9OapoQwlC5W1tYRqQmCi0LATtHz2EitFMKBkZuRnc81zlCDTpTYtRVDTVr8yLhwpQaR5IQOhzHvRwSN8fi5BwM4Z84dCMUBLXfHwWNFD9mjoDfmCynx0TryrTWhBlCBA5MCN6BrAmugYOe/0zsWHkZodAHf0vVIDgwhNk5QRrepWlKerC/wWrvPhvnMDCkwbVarVKfmwsnT7/2un5udkjh8emxqYOHtg7sWd8ZHhHNT2QHtjan90QU7V4c8Y0xCw2dMZN2xWTt+yUuF3ehqKZTGZHM6KleBKboxnLKQ1St2Rxk9uDXh89GthFRxaT2v57UouxjN4/Tsl1MozbbjEqr53k4pwKm6+xvx7Mb82mEulIvD8sheOK4s/6+285CRO/kBJmZ4xqoRa9N1ROd262eiwcorsV38NJb0ST93nwj58/2YooG52j/XRs7QGuNcobC9ixqSUSyUgppqVCPtFiyX2btrMcVmu60taTjMdD4Qim2xPpns5ET2uyyfx47tElcz4liL9u3rxjo8EVPTf0/TcnuKJwb8HYHFcwyISL8ieASyhEAAAAeJxjYGRgYADiru03GeL5bb4y8DO/AIowPE1eshtG////P5aFnTkeyOVgYAKJAgCBbw3VAHicY2BkYGAO+p/FwMDC/v///38s7AxAERTAAQCQDwXaeJxjfsLine truncated
|
||||
url('data:application/octet-stream;base64,AAEAAAAPAIAAAwBwR1NVQiCLJXoAAAD8AAAAVE9TLzI+MFLYAAABUAAAAGBjbWFw4uqWLgAAAbAAAAHMY3Z0IAAAAAAAAA6sAAAADmZwZ21iLvl6AAAOvAAADgxnYXNwAAAAEAAADqQAA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dABlAGwAbABvAFIAZQBnAHUAbABhAHIAZgBvAG4AdABlAGwAbABvAGYAbwBuAHQAZQBsAGwAbwBWAGUAcgBzAGkAbwBuACAAMQAuADAAZgBvAG4AdABlAGwAbABvAEcAZQBuAGUAcgBhAHQAZQBkACAAYgB5ACAAcwB2AGcAMgB0AHQAZgAgAGYAcgBvAG0AIABGAG8AbgB0AGUAbABsAG8AIABwAHIAbwBqAGUAYwB0AC4AaAB0AHQAcAA6AC8ALwBmAG8AbgB0AGUAbABsAG8ALgBjAG8AbQAAAAACAAAAAAAAAAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgBAgEDAQQBBQEGAQcBCAEJAAVhd2FyZAxwbGF5LWNpcmNsZWQNcGF1c2UtY2lyY2xlZAxzdG9wLWNpcmNsZWLine truncated
|
||||
}
|
||||
/* Chrome hack: SVG is rendered more smooth in Windozze. 100% magic, uncomment if you need it. */
|
||||
/* Note, that will break hinting! In other OS-es font will be not as sharp as it could be */
|
||||
/*
|
||||
@media screen and (-webkit-min-device-pixel-ratio:0) {
|
||||
@font-face {
|
||||
font-family: 'fontello';
|
||||
src: url('../font/fontello.svg?5046504#fontello') format('svg');
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
[class^="icon-"]:before, [class*=" icon-"]:before {
|
||||
font-family: "fontello";
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
speak: never;
|
||||
|
||||
display: inline-block;
|
||||
text-decoration: inherit;
|
||||
width: 1em;
|
||||
margin-right: .2em;
|
||||
text-align: center;
|
||||
/* opacity: .8; */
|
||||
|
||||
/* For safety - reset parent styles, that can break glyph codes*/
|
||||
font-variant: normal;
|
||||
text-transform: none;
|
||||
|
||||
/* fix buttons height, for twitter bootstrap */
|
||||
line-height: 1em;
|
||||
|
||||
/* Animation center compensation - margins should be symmetric */
|
||||
/* remove if not needed */
|
||||
margin-left: .2em;
|
||||
|
||||
/* you can be more comfortable with increased icons size */
|
||||
/* font-size: 120%; */
|
||||
|
||||
/* Font smoothing. That was taken from TWBS */
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
|
||||
/* Uncomment for 3D effect */
|
||||
/* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */
|
||||
}
|
||||
|
||||
.icon-award:before { content: '\e800'; } /* '' */
|
||||
.icon-play-circled:before { content: '\e801'; } /* '' */
|
||||
.icon-pause-circled:before { content: '\e802'; } /* '' */
|
||||
.icon-stop-circled:before { content: '\e803'; } /* '' */
|
||||
.icon-stopwatch:before { content: '\e804'; } /* '' */
|
||||
.icon-award-1:before { content: '\e805'; } /* '' */
|
||||
.icon-list-numbered:before { content: '\f0cb'; } /* '' */
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
|
||||
.icon-award { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
|
||||
.icon-play-circled { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
|
||||
.icon-pause-circled { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
|
||||
.icon-stop-circled { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
|
||||
.icon-stopwatch { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
|
||||
.icon-award-1 { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
|
||||
.icon-list-numbered { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
[class^="icon-"], [class*=" icon-"] {
|
||||
font-family: 'fontello';
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
|
||||
/* fix buttons height */
|
||||
line-height: 1em;
|
||||
|
||||
/* you can be more comfortable with increased icons size */
|
||||
/* font-size: 120%; */
|
||||
}
|
||||
|
||||
.icon-award { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
|
||||
.icon-play-circled { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
|
||||
.icon-pause-circled { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
|
||||
.icon-stop-circled { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
|
||||
.icon-stopwatch { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
|
||||
.icon-award-1 { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
|
||||
.icon-list-numbered { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
|
||||
Vendored
+63
@@ -0,0 +1,63 @@
|
||||
@font-face {
|
||||
font-family: 'fontello';
|
||||
src: url('../font/fontello.eot?47725071');
|
||||
src: url('../font/fontello.eot?47725071#iefix') format('embedded-opentype'),
|
||||
url('../font/fontello.woff2?47725071') format('woff2'),
|
||||
url('../font/fontello.woff?47725071') format('woff'),
|
||||
url('../font/fontello.ttf?47725071') format('truetype'),
|
||||
url('../font/fontello.svg?47725071#fontello') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
/* Chrome hack: SVG is rendered more smooth in Windozze. 100% magic, uncomment if you need it. */
|
||||
/* Note, that will break hinting! In other OS-es font will be not as sharp as it could be */
|
||||
/*
|
||||
@media screen and (-webkit-min-device-pixel-ratio:0) {
|
||||
@font-face {
|
||||
font-family: 'fontello';
|
||||
src: url('../font/fontello.svg?47725071#fontello') format('svg');
|
||||
}
|
||||
}
|
||||
*/
|
||||
[class^="icon-"]:before, [class*=" icon-"]:before {
|
||||
font-family: "fontello";
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
speak: never;
|
||||
|
||||
display: inline-block;
|
||||
text-decoration: inherit;
|
||||
width: 1em;
|
||||
margin-right: .2em;
|
||||
text-align: center;
|
||||
/* opacity: .8; */
|
||||
|
||||
/* For safety - reset parent styles, that can break glyph codes*/
|
||||
font-variant: normal;
|
||||
text-transform: none;
|
||||
|
||||
/* fix buttons height, for twitter bootstrap */
|
||||
line-height: 1em;
|
||||
|
||||
/* Animation center compensation - margins should be symmetric */
|
||||
/* remove if not needed */
|
||||
margin-left: .2em;
|
||||
|
||||
/* you can be more comfortable with increased icons size */
|
||||
/* font-size: 120%; */
|
||||
|
||||
/* Font smoothing. That was taken from TWBS */
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
|
||||
/* Uncomment for 3D effect */
|
||||
/* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */
|
||||
}
|
||||
|
||||
.icon-award:before { content: '\e800'; } /* '' */
|
||||
.icon-play-circled:before { content: '\e801'; } /* '' */
|
||||
.icon-pause-circled:before { content: '\e802'; } /* '' */
|
||||
.icon-stop-circled:before { content: '\e803'; } /* '' */
|
||||
.icon-stopwatch:before { content: '\e804'; } /* '' */
|
||||
.icon-award-1:before { content: '\e805'; } /* '' */
|
||||
.icon-list-numbered:before { content: '\f0cb'; } /* '' */
|
||||
@@ -0,0 +1,241 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<!--[if lt IE 9]><script language="javascript" type="text/javascript" src="//html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
|
||||
<meta charset="UTF-8">
|
||||
<style>
|
||||
html {
|
||||
font-size: 100%;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
-ms-text-size-adjust: 100%;
|
||||
}
|
||||
a:focus {
|
||||
outline: thin dotted #333;
|
||||
outline: 5px auto -webkit-focus-ring-color;
|
||||
outline-offset: -2px;
|
||||
}
|
||||
a:hover,
|
||||
a:active {
|
||||
outline: 0;
|
||||
}
|
||||
input {
|
||||
margin: 0;
|
||||
font-size: 100%;
|
||||
vertical-align: middle;
|
||||
*overflow: visible;
|
||||
line-height: normal;
|
||||
}
|
||||
input::-moz-focus-inner {
|
||||
padding: 0;
|
||||
border: 0;
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
font-size: 14px;
|
||||
line-height: 20px;
|
||||
color: #333;
|
||||
background-color: #fff;
|
||||
}
|
||||
a {
|
||||
color: #08c;
|
||||
text-decoration: none;
|
||||
}
|
||||
a:hover {
|
||||
color: #005580;
|
||||
text-decoration: underline;
|
||||
}
|
||||
.row {
|
||||
margin-left: -20px;
|
||||
*zoom: 1;
|
||||
}
|
||||
.row:before,
|
||||
.row:after {
|
||||
display: table;
|
||||
content: "";
|
||||
line-height: 0;
|
||||
}
|
||||
.row:after {
|
||||
clear: both;
|
||||
}
|
||||
.span3 {
|
||||
float: left;
|
||||
min-height: 1px;
|
||||
margin-left: 20px;
|
||||
width: 220px;
|
||||
}
|
||||
.container {
|
||||
width: 940px;
|
||||
margin-right: auto;
|
||||
margin-left: auto;
|
||||
*zoom: 1;
|
||||
}
|
||||
.container:before,
|
||||
.container:after {
|
||||
display: table;
|
||||
content: "";
|
||||
line-height: 0;
|
||||
}
|
||||
.container:after {
|
||||
clear: both;
|
||||
}
|
||||
small {
|
||||
font-size: 85%;
|
||||
}
|
||||
h1 {
|
||||
margin: 10px 0;
|
||||
font-family: inherit;
|
||||
font-weight: bold;
|
||||
line-height: 20px;
|
||||
color: inherit;
|
||||
text-rendering: optimizelegibility;
|
||||
line-height: 40px;
|
||||
font-size: 38.5px;
|
||||
}
|
||||
h1 small {
|
||||
font-weight: normal;
|
||||
line-height: 1;
|
||||
color: #999;
|
||||
font-size: 24.5px;
|
||||
}
|
||||
|
||||
body {
|
||||
margin-top: 90px;
|
||||
}
|
||||
.header {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 50%;
|
||||
margin-left: -480px;
|
||||
background-color: #fff;
|
||||
border-bottom: 1px solid #ddd;
|
||||
padding-top: 10px;
|
||||
z-index: 10;
|
||||
}
|
||||
.footer {
|
||||
color: #ddd;
|
||||
font-size: 12px;
|
||||
text-align: center;
|
||||
margin-top: 20px;
|
||||
}
|
||||
.footer a {
|
||||
color: #ccc;
|
||||
text-decoration: underline;
|
||||
}
|
||||
.the-icons {
|
||||
font-size: 14px;
|
||||
line-height: 24px;
|
||||
}
|
||||
.switch {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 10px;
|
||||
color: #666;
|
||||
}
|
||||
.switch input {
|
||||
margin-right: 0.3em;
|
||||
}
|
||||
.codesOn .i-name {
|
||||
display: none;
|
||||
}
|
||||
.codesOn .i-code {
|
||||
display: inline;
|
||||
}
|
||||
.i-code {
|
||||
display: none;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'fontello';
|
||||
src: url('./font/fontello.eot?1498157');
|
||||
src: url('./font/fontello.eot?1498157#iefix') format('embedded-opentype'),
|
||||
url('./font/fontello.woff?1498157') format('woff'),
|
||||
url('./font/fontello.ttf?1498157') format('truetype'),
|
||||
url('./font/fontello.svg?1498157#fontello') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
.demo-icon {
|
||||
font-family: "fontello";
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
speak: never;
|
||||
|
||||
display: inline-block;
|
||||
text-decoration: inherit;
|
||||
width: 1em;
|
||||
margin-right: .2em;
|
||||
text-align: center;
|
||||
/* opacity: .8; */
|
||||
|
||||
/* For safety - reset parent styles, that can break glyph codes*/
|
||||
font-variant: normal;
|
||||
text-transform: none;
|
||||
|
||||
/* fix buttons height, for twitter bootstrap */
|
||||
line-height: 1em;
|
||||
|
||||
/* Animation center compensation - margins should be symmetric */
|
||||
/* remove if not needed */
|
||||
margin-left: .2em;
|
||||
|
||||
/* You can be more comfortable with increased icons size */
|
||||
/* font-size: 120%; */
|
||||
|
||||
/* Font smoothing. That was taken from TWBS */
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
|
||||
/* Uncomment for 3D effect */
|
||||
/* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" href="css/animation.css"><!--[if IE 7]><link rel="stylesheet" href="css/" + font.fontname + "-ie7.css"><![endif]-->
|
||||
<script>
|
||||
function toggleCodes(on) {
|
||||
var obj = document.getElementById('icons');
|
||||
|
||||
if (on) {
|
||||
obj.className += ' codesOn';
|
||||
} else {
|
||||
obj.className = obj.className.replace(' codesOn', '');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container header">
|
||||
<h1>fontello <small>font demo</small></h1>
|
||||
<label class="switch">
|
||||
<input type="checkbox" onclick="toggleCodes(this.checked)">show codes
|
||||
</label>
|
||||
</div>
|
||||
<div class="container" id="icons">
|
||||
<div class="row">
|
||||
<div class="span3" title="Code: 0xe800">
|
||||
<i class="demo-icon icon-award"></i> <span class="i-name">icon-award</span><span class="i-code">0xe800</span>
|
||||
</div>
|
||||
<div class="span3" title="Code: 0xe801">
|
||||
<i class="demo-icon icon-play-circled"></i> <span class="i-name">icon-play-circled</span><span class="i-code">0xe801</span>
|
||||
</div>
|
||||
<div class="span3" title="Code: 0xe802">
|
||||
<i class="demo-icon icon-pause-circled"></i> <span class="i-name">icon-pause-circled</span><span class="i-code">0xe802</span>
|
||||
</div>
|
||||
<div class="span3" title="Code: 0xe803">
|
||||
<i class="demo-icon icon-stop-circled"></i> <span class="i-name">icon-stop-circled</span><span class="i-code">0xe803</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="span3" title="Code: 0xe804">
|
||||
<i class="demo-icon icon-stopwatch"></i> <span class="i-name">icon-stopwatch</span><span class="i-code">0xe804</span>
|
||||
</div>
|
||||
<div class="span3" title="Code: 0xe805">
|
||||
<i class="demo-icon icon-award-1"></i> <span class="i-name">icon-award-1</span><span class="i-code">0xe805</span>
|
||||
</div>
|
||||
<div class="span3" title="Code: 0xf0cb">
|
||||
<i class="demo-icon icon-list-numbered"></i> <span class="i-name">icon-list-numbered</span><span class="i-code">0xf0cb</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container footer">Generated by <a href="https://fontello.com">fontello.com</a></div>
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<metadata>Copyright (C) 2025 by original authors @ fontello.com</metadata>
|
||||
<defs>
|
||||
<font id="fontello" horiz-adv-x="1000" >
|
||||
<font-face font-family="fontello" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
|
||||
<missing-glyph horiz-adv-x="1000" />
|
||||
<glyph glyph-name="award" unicode="" d="M256 357q-42 91-42 207h-143v-53q0-44 53-91t132-63z m601 154v53h-143q0-116-41-207 79 16 131 63t53 91z m72 71v-71q0-40-24-80t-62-73-97-54-120-25q-23-30-53-53-21-19-29-40t-8-50q0-30 17-51t54-21q42 0 75-25t32-64v-36q0-8-5-13t-13-5h-464q-8 0-13 5t-5 13v36q0 39 33 64t74 25q38 0 55 21t17 51q0 28-8 50t-29 40q-30 23-53 53-64 3-121 25t-96 54-63 73-23 80v71q0 23 16 38t38 16h160v53q0 37 27 63t63 27h321q37 0 63-27t26-63v-53h161q22 0 38-16t16-38z" horiz-adv-x="928.6" />
|
||||
|
||||
<glyph glyph-name="play-circled" unicode="" d="M0 350q0 207 147 354t353 146 354-146 146-354-146-354-354-146-353 146-147 354z m375-250l375 250-375 250 0-500z" horiz-adv-x="1000" />
|
||||
|
||||
<glyph glyph-name="pause-circled" unicode="" d="M0 350q0 207 147 354t353 146 354-146 146-354-146-354-354-146-353 146-147 354z m275-260l153 0 0 520-153 0 0-520z m297 0l153 0 0 520-153 0 0-520z" horiz-adv-x="1000" />
|
||||
|
||||
<glyph glyph-name="stop-circled" unicode="" d="M0 350q0 207 147 354t353 146 354-146 146-354-146-354-354-146-353 146-147 354z m250-250l500 0 0 500-500 0 0-500z" horiz-adv-x="1000" />
|
||||
|
||||
<glyph glyph-name="stopwatch" unicode="" d="M0 617l246 246 81-82-40-41 42-43q58 34 124 52v101h231v-101q99-26 178-90t124-158 45-200q0-94-36-180t-99-148-148-99-179-37-181 37-147 99-99 148-37 180q0 123 62 231l-44 44-41-41z m222-316q0-94 46-174t127-127 174-47 174 47 126 127 47 174-47 174-126 126-174 47-174-47-127-126-46-174z m118 130q0 24 16 41 17 17 41 17t41-17l140-140h198q24 0 41-17t16-41q0-25-17-40-17-18-40-18h-222q-3 0-11 1l-5 2q-1 0-3 1t-3 0q-1 1-3 2t-2 1l-5 3q-3 2-9 8l-157 156q-16 17-16 41z" horiz-adv-x="1031.7" />
|
||||
|
||||
<glyph glyph-name="award-1" unicode="" d="M241 239q53 0 112 20l0-356-112 113-111-113 0 356q58-20 111-20z m-223 335q0 223 223 223t223-223-223-223-223 223z" horiz-adv-x="482" />
|
||||
|
||||
<glyph glyph-name="list-numbered" unicode="" d="M213-54q0-45-31-70t-75-26q-60 0-96 37l31 49q28-25 60-25 16 0 28 8t12 24q0 35-59 31l-14 31q4 6 18 24t24 31 20 21v1q-9 0-27-1t-27 0v-30h-59v85h186v-49l-53-65q28-6 45-27t17-49z m1 350v-89h-202q-4 20-4 30 0 29 14 52t31 38 37 27 31 24 14 25q0 14-9 22t-22 7q-25 0-45-32l-47 33q13 28 40 44t59 16q40 0 68-23t28-63q0-28-19-51t-42-36-42-28-20-30h71v34h59z m786-178v-107q0-7-5-13t-13-5h-678q-8 0-13 5t-5 13v107q0 8 5 13t13 5h678q7 0 13-6t5-12z m-786 502v-56h-187v56h60q0 22 0 67t1 68v7h-1q-5-10-28-30l-40 42 76 71h59v-225h60z m786-216v-108q0-7-5-12t-13-5h-678q-8 0-13 5t-5 12v108q0 7 5 12t13 5h678q7 0 13-5t5-12z m0 285v-107q0-7-5-12t-13-6h-678q-8 0-13 6t-5 12v107q0 8 5 13t13 5h678q7 0 13-5t5-13z" horiz-adv-x="1000" />
|
||||
</font>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.0 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
+3
-3
@@ -92,9 +92,9 @@
|
||||
<div class="container">
|
||||
<h1>SongDash</h1>
|
||||
<div class="button-list">
|
||||
<a href="/player.html" class="button">Player</a>
|
||||
<a href="/host.html" class="button">Host</a>
|
||||
<a href="/tv.html" class="button">TV</a>
|
||||
<a href="/player" class="button">Player</a>
|
||||
<a href="/host" class="button">Host</a>
|
||||
<a href="/tv" class="button">TV</a>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
+101
-28
@@ -3,57 +3,130 @@ function playSound() {
|
||||
}
|
||||
|
||||
class Socket {
|
||||
deffered = []
|
||||
#deferred = []
|
||||
#messageListeners = []
|
||||
#eventListeners = new Map()
|
||||
|
||||
constructor(whoami) {
|
||||
constructor(clientType) {
|
||||
this.clientType = clientType
|
||||
this.ws = new WebSocket('ws://' + location.hostname + ':2501')
|
||||
|
||||
this.ws.onopen = () => {
|
||||
this.send({ whoami })
|
||||
// Send registration message
|
||||
this.send({
|
||||
type: 'register',
|
||||
data: { clientType },
|
||||
})
|
||||
|
||||
if (this.deffered.length) {
|
||||
this.deffered.forEach(payload => {
|
||||
// Send any deferred messages
|
||||
if (this.#deferred.length) {
|
||||
this.#deferred.forEach(payload => {
|
||||
this.send(payload)
|
||||
})
|
||||
this.deffered = []
|
||||
this.#deferred = []
|
||||
}
|
||||
}
|
||||
|
||||
this.ws.onclose = () => {
|
||||
// alert('connection lost')
|
||||
location.reload()
|
||||
setTimeout(() => {
|
||||
location.reload()
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
// Set up message routing
|
||||
this.ws.onmessage = e => {
|
||||
const message = JSON.parse(e.data)
|
||||
console.debug('recv', message)
|
||||
|
||||
this.receive(message)
|
||||
|
||||
// // Layer 1: Notify all message listeners
|
||||
// this.#messageListeners.forEach(listener => listener(message))
|
||||
|
||||
// Layer 2: Trigger custom events based on message content
|
||||
// this.#triggerCustomEvents(message)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a message to the server
|
||||
* @param {Object} payload - Message payload following the protocol
|
||||
*/
|
||||
send(payload) {
|
||||
// check if ws is ready
|
||||
if (this.ws.readyState != 1) {
|
||||
this.deffered.push(payload)
|
||||
if (this.ws.readyState !== 1) {
|
||||
this.#deferred.push(payload)
|
||||
} else {
|
||||
this.ws.send(JSON.stringify(payload))
|
||||
console.log('ws send:', payload)
|
||||
console.log('send', payload)
|
||||
}
|
||||
}
|
||||
|
||||
player(action, data) {
|
||||
let payload = null
|
||||
switch (action) {
|
||||
case 'nick':
|
||||
payload = { nick: data }
|
||||
break
|
||||
case 'enter':
|
||||
payload = { entry: true }
|
||||
break
|
||||
}
|
||||
receive(message) {
|
||||
const { action, data } = message
|
||||
|
||||
this.send(payload)
|
||||
this.#emit(action, data)
|
||||
}
|
||||
|
||||
bind(callback) {
|
||||
this.ws.onmessage = e => {
|
||||
let payload = JSON.parse(e.data)
|
||||
console.info(payload)
|
||||
callback(payload)
|
||||
// /**
|
||||
// * Layer 1: Listen to all incoming WebSocket messages
|
||||
// * @param {Function} callback - Called with raw message object
|
||||
// */
|
||||
// onMessage(callback) {
|
||||
// this.#messageListeners.push(callback)
|
||||
// }
|
||||
|
||||
on(eventName, callback) {
|
||||
if (!this.#eventListeners.has(eventName)) {
|
||||
this.#eventListeners.set(eventName, [])
|
||||
}
|
||||
this.#eventListeners.get(eventName).push(callback)
|
||||
}
|
||||
|
||||
// off(eventName, callback) {
|
||||
// if (!this.#eventListeners.has(eventName)) return
|
||||
|
||||
// const listeners = this.#eventListeners.get(eventName)
|
||||
// const index = listeners.indexOf(callback)
|
||||
// if (index > -1) {
|
||||
// listeners.splice(index, 1)
|
||||
// }
|
||||
// }
|
||||
|
||||
#emit(eventName, data) {
|
||||
if (!this.#eventListeners.has(eventName)) return
|
||||
|
||||
this.#eventListeners.get(eventName).forEach(callback => {
|
||||
callback(data)
|
||||
})
|
||||
}
|
||||
|
||||
// #triggerCustomEvents(message) {
|
||||
// return console.warn(message)
|
||||
|
||||
// // Extract event-like data from the message
|
||||
// const { type, action, data } = message
|
||||
|
||||
// // Emit based on message structure
|
||||
// if (type && action) {
|
||||
// this.#emit(`${type}:${action}`, data)
|
||||
// }
|
||||
|
||||
// // Emit for specific data fields (backwards compatibility & convenience)
|
||||
// if (data) {
|
||||
// Object.keys(data).forEach(key => {
|
||||
// this.#emit(key, data[key])
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
|
||||
#createTypedSender = type => (action, data) => {
|
||||
const message = { type, action }
|
||||
if (data !== undefined) {
|
||||
message.data = data
|
||||
}
|
||||
this.send(message)
|
||||
}
|
||||
|
||||
player = this.#createTypedSender('player')
|
||||
host = this.#createTypedSender('host')
|
||||
}
|
||||
-179
@@ -1,179 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
|
||||
<title>TV - Jaka To Melodia</title>
|
||||
<script src="/socket.js"></script>
|
||||
<script src="/wakelock.js"></script>
|
||||
|
||||
<link rel="stylesheet" href="/pattern.css" />
|
||||
<link rel="stylesheet" href="/loader.css" />
|
||||
|
||||
<style>
|
||||
body {
|
||||
height: 100vh;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
--pattern: 22px;
|
||||
}
|
||||
|
||||
.status {
|
||||
font-size: 150px;
|
||||
}
|
||||
|
||||
.queue {
|
||||
font-size: 30px;
|
||||
font-family: monospace;
|
||||
text-align: left;
|
||||
width: 80vw;
|
||||
counter-reset: poz;
|
||||
}
|
||||
|
||||
.queue > .nick {
|
||||
padding: 0.1em 0.25em 0.2em;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.queue > .nick::before {
|
||||
counter-increment: poz;
|
||||
content: '#' counter(poz) ' ';
|
||||
font-weight: bold;
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
.queue > img {
|
||||
height: 10vh;
|
||||
}
|
||||
|
||||
.nick.active {
|
||||
background-color: #fff6;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
#loader {
|
||||
margin: auto;
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body class="patterned">
|
||||
<div id="status" class="status">⏯</div>
|
||||
|
||||
<span id="spinner" class="loader"></span>
|
||||
|
||||
<div id="queue" class="queue"></div>
|
||||
|
||||
<script>
|
||||
requestWakeLock()
|
||||
|
||||
const statuses = {
|
||||
paused: '⏸',
|
||||
playing: '⏵',
|
||||
waiting: '⏯',
|
||||
},
|
||||
colors = {
|
||||
playing: '#00ff58',
|
||||
paused: '#1b2660',
|
||||
waiting: '#2f3d40',
|
||||
}
|
||||
|
||||
let nodeStatus = document.querySelector('#status'),
|
||||
nodeSpinner = document.querySelector('#spinner'),
|
||||
nodeQueue = document.querySelector('#queue')
|
||||
|
||||
function setStatus(status = 'waiting') {
|
||||
const patternColors = {
|
||||
playing: { fg: '#18dd5c', bg: '#1bc957' },
|
||||
paused: { fg: '#28357d', bg: '#22307b' },
|
||||
waiting: { fg: '#364d69', bg: '#425b79' },
|
||||
}
|
||||
|
||||
console.info('status', status)
|
||||
|
||||
nodeStatus.innerHTML = statuses[status]
|
||||
document.body.style.setProperty('--fgcolor', patternColors[status].fg)
|
||||
document.body.style.setProperty('--bgcolor', patternColors[status].bg)
|
||||
}
|
||||
|
||||
function setQueue(queue, active = 0) {
|
||||
nodeQueue.innerHTML = queue
|
||||
.map(
|
||||
(nick, i) =>
|
||||
`<div class="nick ${i == active && 'active'}">${nick}</div>`
|
||||
)
|
||||
.join('')
|
||||
}
|
||||
|
||||
function showSpinner(show = true) {
|
||||
nodeSpinner.style.display = show ? 'block' : 'none'
|
||||
}
|
||||
|
||||
const socket = new Socket('tv')
|
||||
|
||||
var localStatus = 'waiting',
|
||||
localQueue = [],
|
||||
localActive = 0
|
||||
|
||||
setStatus()
|
||||
|
||||
socket.bind((data) => {
|
||||
if (data.status != localStatus) {
|
||||
localStatus = data.status
|
||||
setStatus(data.status)
|
||||
}
|
||||
|
||||
if (data.active == null) {
|
||||
setQueue([])
|
||||
showSpinner()
|
||||
}
|
||||
|
||||
if (data.queue.length > 0) {
|
||||
setQueue(data.queue, data.active)
|
||||
showSpinner(false)
|
||||
}
|
||||
|
||||
// nodeStatus.innerHTML = statuses[data.status ?? 'waiting']
|
||||
// document.body.style.background = colors[data.status ?? 'waiting']
|
||||
// document.body.style.setProperty(
|
||||
// '--fgcolor',
|
||||
// patternColors[data.status ?? 'waiting'].fg
|
||||
// )
|
||||
// document.body.style.setProperty(
|
||||
// '--bgcolor',
|
||||
// patternColors[data.status ?? 'waiting'].bg
|
||||
// )
|
||||
})
|
||||
|
||||
// ws.onopen = () => {
|
||||
// // clear()
|
||||
// // send.tv()
|
||||
|
||||
// ws.onmessage = (data) => {
|
||||
// // let stats = JSON.parse(data.data)
|
||||
// // if (stats.clear) {
|
||||
// // clear()
|
||||
// // return
|
||||
// // }
|
||||
// // if (stats.queue.length > 0)
|
||||
// // nodeList.innerHTML = stats.queue
|
||||
// // .map(
|
||||
// // (nick) =>
|
||||
// // `<div class="nick ${
|
||||
// // stats.active == nick && 'active'
|
||||
// // }">${nick}</div>`
|
||||
// // )
|
||||
// // .join('')
|
||||
// // nodePlaypause.innerHTML = statuses[stats.status ?? 'waiting']
|
||||
// // document.body.style.background = colors[stats.status ?? 'waiting']
|
||||
// }
|
||||
// }
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,23 +1,117 @@
|
||||
import { WebSocketServer } from 'ws'
|
||||
import express from 'express'
|
||||
import os from 'os'
|
||||
|
||||
import env from './env.js'
|
||||
import logger from './logger.js'
|
||||
import Client from './backend/Client.js'
|
||||
import Music from './backend/Music.js'
|
||||
import Qr from './backend/Qr.js'
|
||||
import Queue from './backend/Queue.js'
|
||||
import Board from './backend/Board.js'
|
||||
|
||||
const app = express()
|
||||
|
||||
app.use(express.static('public'))
|
||||
|
||||
app.listen(env.HTTP_PORT, () => console.log(`http : listening on ${env.HTTP_PORT}`))
|
||||
// Serve pages from /pages directory with clean URLs
|
||||
app.get('/:page', (req, res, next) => {
|
||||
const allowedPages = ['host', 'player', 'tv']
|
||||
if (allowedPages.includes(req.params.page)) {
|
||||
res.sendFile(`pages/${req.params.page}.html`, { root: '.' })
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
})
|
||||
|
||||
app.use(Qr.serve())
|
||||
|
||||
app.listen(env.HTTP_PORT, () => logger.info('server', 'http port is', env.HTTP_PORT))
|
||||
|
||||
const wss = new WebSocketServer({
|
||||
port: env.WS_PORT,
|
||||
}).on('listening', () => console.log(`ws : listening on ${env.WS_PORT}`))
|
||||
port: env.WS_PORT,
|
||||
}).on('listening', () => logger.info('server', 'websocket port is', env.WS_PORT))
|
||||
|
||||
Qr.init(process.env.SERVER_HOST)
|
||||
Music.init(os.platform())
|
||||
|
||||
wss.on('connection', (ws, req) => new Client(ws, req))
|
||||
|
||||
// bind music metadata broadcasts to clients
|
||||
// used to avoid dependency cycles
|
||||
// Bind music metadata broadcasts to clients
|
||||
// Used to avoid dependency cycles
|
||||
|
||||
Music.bind(p => Client.trigger('musicMetadata', p))
|
||||
Music.on(data => {
|
||||
if (!data.metadata) return
|
||||
|
||||
Client.getBy.type('host').forEach(host =>
|
||||
host.send({
|
||||
type: 'state',
|
||||
action: 'metadata',
|
||||
data: data.metadata,
|
||||
})
|
||||
)
|
||||
})
|
||||
|
||||
Client.on('update', () => {
|
||||
Client.getBy.type('tv').forEach(tv => {
|
||||
tv.send({
|
||||
action: 'update',
|
||||
data: {
|
||||
queue: Queue.rendered,
|
||||
active: Queue.active,
|
||||
status: Music.status,
|
||||
board: Board.rendered,
|
||||
},
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Client.on('hostAction-play', () => Music.control('Play'))
|
||||
Client.on('hostAction-pause', () => Music.control('Pause'))
|
||||
Client.on('hostAction-next', () => {
|
||||
Music.control('Next')
|
||||
Queue.clear()
|
||||
})
|
||||
Client.on('hostAction-clear', () => {
|
||||
Queue.clear()
|
||||
Music.newStatus = 'waiting'
|
||||
})
|
||||
Client.on('hostAction-nextPlayer', () => Queue.nextPlayer())
|
||||
|
||||
Client.on('hostAction-points', ({ points }) => {
|
||||
Board.score.bump(Queue.activeClient, points || 0)
|
||||
// Client.emit('score', Queue.activeClient)
|
||||
|
||||
// Client.getBy.type('tv').forEach(client => {
|
||||
// client.send({
|
||||
// type: 'ui',
|
||||
// action: 'updateScoreboard',
|
||||
// data: {
|
||||
// scoreboard: Board.rendered,
|
||||
// },
|
||||
// })
|
||||
// })
|
||||
})
|
||||
|
||||
Client.on('hostAction-showQr', ({ show }) => {
|
||||
Client.getBy.type('tv').forEach(tv => {
|
||||
tv.send({
|
||||
action: 'showQr',
|
||||
data: { show },
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Client.on('playerAction-setNick', ({ client, data }) => {
|
||||
const nick = data?.nick
|
||||
if (typeof nick !== 'string' || nick.trim() === '') return
|
||||
|
||||
client.nick = nick
|
||||
logger.info('Client', `'${client.ip}' renamed to '${client.nick}'`)
|
||||
})
|
||||
|
||||
Client.on('playerAction-enter', ({ client }) => {
|
||||
logger.debug('Client', `'${client.nick}' entered`)
|
||||
Queue.add(client)
|
||||
Music.control('Pause')
|
||||
})
|
||||
Reference in new issue
Block a user