FEAT: Add stream_key getter;

REFACTOR: Button component inherits HTML props;
This commit is contained in:
Chris-1010
2025-02-19 23:11:26 +00:00
parent fd5e45a8de
commit bcfe57eeae
2 changed files with 13 additions and 4 deletions

View File

@@ -1,23 +1,22 @@
import React from "react";
interface ButtonProps {
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
type?: "button" | "submit" | "reset";
extraClasses?: string;
children?: React.ReactNode;
onClick?: () => void;
}
const Button: React.FC<ButtonProps> = ({
type = "button",
children = "Submit",
extraClasses = "",
onClick,
...props
}) => {
return (
<button
type={type}
className={`${extraClasses} p-2 text-[1.5rem] text-white hover:text-purple-600 bg-black/30 hover:bg-black/80 rounded-md border border-gray-300 hover:border-purple-500 hover:border-b-4 hover:border-l-4 active:border-b-2 active:border-l-2 transition-all`}
onClick={onClick}
{...props}
>
{children}
</button>

View File

@@ -21,6 +21,16 @@ def user_data(username: str):
data = get_user(user_id)
return jsonify(data)
@user_bp.route('/user/<string:username>/stream_key')
def user_stream_key(username: str):
"""
Returns a stream key for a given user
"""
user_id = get_user_id(username)
with Database() as db:
data = db.fetchone("SELECT stream_key FROM users WHERE user_id = ?", (user_id,))
return jsonify({"stream_key": data["stream_key"]})
## Subscription Routes
@login_required
@user_bp.route('/user/subscription/<string:streamer_name>')