mirror of
https://github.com/spl0k/supysonic.git
synced 2024-12-22 08:56:17 +00:00
Chat as feature
This commit is contained in:
parent
c6b197689a
commit
84c1582446
@ -204,7 +204,7 @@ from .scrobble import *
|
||||
if config.getbool('features', 'star', True):
|
||||
from .star import *
|
||||
else:
|
||||
app.add_url_rule('/rest/star.view', view_func = disabled_api_feature, methods = [ 'GET', 'POST' ])
|
||||
app.add_url_rule('/rest/star.view', view_func = disabled_api_feature, methods = [ 'GET', 'POST' ])
|
||||
app.add_url_rule('/rest/unstar.view', view_func = disabled_api_feature, methods = [ 'GET', 'POST' ])
|
||||
|
||||
if config.getbool('features', 'rating', True):
|
||||
@ -212,7 +212,12 @@ if config.getbool('features', 'rating', True):
|
||||
else:
|
||||
app.add_url_rule('/rest/setRating.view', view_func = disabled_api_feature, methods = [ 'GET', 'POST' ])
|
||||
|
||||
from .chat import *
|
||||
if config.getbool('features', 'chat', True):
|
||||
from .chat import *
|
||||
else:
|
||||
app.add_url_rule('/rest/getChatMessages.view', view_func = disabled_api_feature, methods = [ 'GET', 'POST' ])
|
||||
app.add_url_rule('/rest/addChatMessage.view', view_func = disabled_api_feature, methods = [ 'GET', 'POST' ])
|
||||
|
||||
from .search import *
|
||||
from .playlists import *
|
||||
|
||||
|
27
db.py
27
db.py
@ -368,22 +368,23 @@ if config.getbool('features', 'rating', True):
|
||||
user = relationship('User')
|
||||
rated = relationship('Track')
|
||||
|
||||
class ChatMessage(Base):
|
||||
__tablename__ = 'chat_message'
|
||||
if config.getbool('features', 'chat', True):
|
||||
class ChatMessage(Base):
|
||||
__tablename__ = 'chat_message'
|
||||
|
||||
id = UUID.gen_id_column()
|
||||
user_id = Column(UUID, ForeignKey('user.id'))
|
||||
time = Column(Integer, default = lambda: int(time.time()))
|
||||
message = Column(String(512))
|
||||
id = UUID.gen_id_column()
|
||||
user_id = Column(UUID, ForeignKey('user.id'))
|
||||
time = Column(Integer, default = lambda: int(time.time()))
|
||||
message = Column(String(512))
|
||||
|
||||
user = relationship('User')
|
||||
user = relationship('User')
|
||||
|
||||
def responsize(self):
|
||||
return {
|
||||
'username': self.user.name,
|
||||
'time': self.time * 1000,
|
||||
'message': self.message
|
||||
}
|
||||
def responsize(self):
|
||||
return {
|
||||
'username': self.user.name,
|
||||
'time': self.time * 1000,
|
||||
'message': self.message
|
||||
}
|
||||
|
||||
playlist_track_assoc = Table('playlist_track', Base.metadata,
|
||||
Column('playlist_id', UUID, ForeignKey('playlist.id')),
|
||||
|
Loading…
Reference in New Issue
Block a user