Compare commits

..

No commits in common. "master" and "1.2.17" have entirely different histories.

8 changed files with 62 additions and 19 deletions

View File

@ -23,11 +23,10 @@ export class PlayingSong extends QueuedSong {
}
export class Playlist {
constructor(public title: string, public listener: string, public type: SongType, public songs: Song[]) {
constructor(public title: string, public listener: string, public songs: Song[]) {
}
}
export class PlaylistDescription {
constructor(public title: string, public listener: string, public type: SongType) {
constructor(public title: string, public listener: string) {
}
}

6
dist/dataTypes.d.ts vendored
View File

@ -25,13 +25,11 @@ export declare class PlayingSong extends QueuedSong {
export declare class Playlist {
title: string;
listener: string;
type: SongType;
songs: Song[];
constructor(title: string, listener: string, type: SongType, songs: Song[]);
constructor(title: string, listener: string, songs: Song[]);
}
export declare class PlaylistDescription {
title: string;
listener: string;
type: SongType;
constructor(title: string, listener: string, type: SongType);
constructor(title: string, listener: string);
}

6
dist/dataTypes.js vendored
View File

@ -57,20 +57,18 @@ var PlayingSong = /** @class */ (function (_super) {
}(QueuedSong));
exports.PlayingSong = PlayingSong;
var Playlist = /** @class */ (function () {
function Playlist(title, listener, type, songs) {
function Playlist(title, listener, songs) {
this.title = title;
this.listener = listener;
this.type = type;
this.songs = songs;
}
return Playlist;
}());
exports.Playlist = Playlist;
var PlaylistDescription = /** @class */ (function () {
function PlaylistDescription(title, listener, type) {
function PlaylistDescription(title, listener) {
this.title = title;
this.listener = listener;
this.type = type;
}
return PlaylistDescription;
}());

View File

@ -1,5 +1,5 @@
import { Song, PlayingSong, QueuedSong, Playlist, PlaylistDescription } from "./dataTypes";
export type StuenMessages = ListenerList | SendChatMessage | SearchSong | SearchSongResult | Join | QueueSong | CurrentQueue | CurrentSong | UnqueueSong | ReorderSong | SkipSong | SongLikes | ToggleSongLike | CreatePlaylist | RemovePlaylist | AddSongToPlaylist | RemoveSongFromPlaylist | Playlists | GetPlaylist | PlaylistSongs | GetOtherPlaylists | ToggleTag | Shuffle | RemoveFromAutoPlay;
export type StuenMessages = ListenerLeft | ListenerList | ListenerJoined | SendChatMessage | SearchSong | SearchSongResult | Join | QueueSong | CurrentQueue | CurrentSong | UnqueueSong | ReorderSong | SkipSong | SongLikes | ToggleSongLike | CreatePlaylist | RemovePlaylist | AddSongToPlaylist | RemoveSongFromPlaylist | Playlists | GetPlaylist | PlaylistSongs | GetOtherPlaylists | ToggleTag | Shuffle | RemoveFromAutoPlay;
export declare abstract class StuenMessage {
type: string;
constructor(type: string);
@ -8,6 +8,14 @@ export declare class Join extends StuenMessage {
name: string;
constructor(name: string);
}
export declare class ListenerJoined extends StuenMessage {
name: string;
constructor(name: string);
}
export declare class ListenerLeft extends StuenMessage {
name: string;
constructor(name: string);
}
export declare class ListenerList extends StuenMessage {
names: string[];
constructor(names: string[]);

22
dist/messageTypes.js vendored
View File

@ -15,7 +15,7 @@ var __extends = (this && this.__extends) || (function () {
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.RemoveFromAutoPlay = exports.Shuffle = exports.ToggleTag = exports.RemoveSongFromPlaylist = exports.AddSongToPlaylist = exports.OthersPlaylists = exports.GetOtherPlaylists = exports.PlaylistSongs = exports.GetPlaylist = exports.Playlists = exports.RemovePlaylist = exports.CreatePlaylist = exports.SongLikes = exports.ToggleSongLike = exports.SkipSong = exports.ReorderSong = exports.UnqueueSong = exports.CurrentSong = exports.CurrentQueue = exports.QueueSong = exports.SearchSongResult = exports.SearchSong = exports.ChatMessage = exports.SendChatMessage = exports.ListenerList = exports.Join = exports.StuenMessage = void 0;
exports.RemoveFromAutoPlay = exports.Shuffle = exports.ToggleTag = exports.RemoveSongFromPlaylist = exports.AddSongToPlaylist = exports.OthersPlaylists = exports.GetOtherPlaylists = exports.PlaylistSongs = exports.GetPlaylist = exports.Playlists = exports.RemovePlaylist = exports.CreatePlaylist = exports.SongLikes = exports.ToggleSongLike = exports.SkipSong = exports.ReorderSong = exports.UnqueueSong = exports.CurrentSong = exports.CurrentQueue = exports.QueueSong = exports.SearchSongResult = exports.SearchSong = exports.ChatMessage = exports.SendChatMessage = exports.ListenerList = exports.ListenerLeft = exports.ListenerJoined = exports.Join = exports.StuenMessage = void 0;
var StuenMessage = /** @class */ (function () {
function StuenMessage(type) {
this.type = type;
@ -33,6 +33,26 @@ var Join = /** @class */ (function (_super) {
return Join;
}(StuenMessage));
exports.Join = Join;
var ListenerJoined = /** @class */ (function (_super) {
__extends(ListenerJoined, _super);
function ListenerJoined(name) {
var _this = _super.call(this, 'ListenerJoined') || this;
_this.name = name;
return _this;
}
return ListenerJoined;
}(StuenMessage));
exports.ListenerJoined = ListenerJoined;
var ListenerLeft = /** @class */ (function (_super) {
__extends(ListenerLeft, _super);
function ListenerLeft(name) {
var _this = _super.call(this, 'ListenerLeft') || this;
_this.name = name;
return _this;
}
return ListenerLeft;
}(StuenMessage));
exports.ListenerLeft = ListenerLeft;
var ListenerList = /** @class */ (function (_super) {
__extends(ListenerList, _super);
function ListenerList(names) {

View File

@ -7,6 +7,10 @@ function parseMessage(message) {
switch (data.type) {
case 'Join':
return new messageTypes_1.Join(data.name);
case 'ListenerJoined':
return new messageTypes_1.ListenerJoined(data.name);
case 'ListenerLeft':
return new messageTypes_1.ListenerLeft(data.name);
case 'ListenerList':
return new messageTypes_1.ListenerList(data.names);
case 'SendChatMessage':
@ -49,8 +53,6 @@ function parseMessage(message) {
return new messageTypes_1.RemoveSongFromPlaylist(data.song, data.playlist);
case 'GetOtherPlaylists':
return new messageTypes_1.GetOtherPlaylists();
case 'OthersPlaylists':
return new messageTypes_1.OthersPlaylists(data.playlists);
case 'ToggleTag':
return new messageTypes_1.ToggleTag(data.song, data.tag);
case 'Shuffle':

View File

@ -1,7 +1,9 @@
import {Song, PlayingSong, QueuedSong, Playlist, PlaylistDescription} from "./dataTypes";
export type StuenMessages =
ListenerList
ListenerLeft
| ListenerList
| ListenerJoined
| SendChatMessage
| SearchSong
| SearchSongResult
@ -37,6 +39,18 @@ export class Join extends StuenMessage {
}
}
export class ListenerJoined extends StuenMessage {
constructor(public name: string) {
super('ListenerJoined');
}
}
export class ListenerLeft extends StuenMessage {
constructor(public name: string) {
super('ListenerLeft');
}
}
export class ListenerList extends StuenMessage {
constructor(public names: string[]) {
super('ListenerList');

View File

@ -6,6 +6,8 @@ import {
CurrentSong,
GetPlaylist,
Join,
ListenerJoined,
ListenerLeft,
ListenerList,
Playlists,
PlaylistSongs,
@ -20,7 +22,7 @@ import {
SongLikes,
StuenMessage,
ToggleSongLike, ToggleTag,
UnqueueSong, OthersPlaylists,
UnqueueSong,
} from "./messageTypes";
export default function parseMessage(message: string): StuenMessage | null {
@ -30,6 +32,10 @@ export default function parseMessage(message: string): StuenMessage | null {
switch (data.type) {
case 'Join':
return new Join(data.name);
case 'ListenerJoined':
return new ListenerJoined(data.name);
case 'ListenerLeft':
return new ListenerLeft(data.name);
case 'ListenerList':
return new ListenerList(data.names);
case 'SendChatMessage':
@ -72,8 +78,6 @@ export default function parseMessage(message: string): StuenMessage | null {
return new RemoveSongFromPlaylist(data.song, data.playlist);
case 'GetOtherPlaylists':
return new GetOtherPlaylists();
case 'OthersPlaylists':
return new OthersPlaylists(data.playlists);
case 'ToggleTag':
return new ToggleTag(data.song, data.tag);
case 'Shuffle':