Implement XDG compliance, logging, and improved 401 error handling
- Install to ~/.local/bin/winamp-mpris - Use ~/.local/state/winamp-mpris/bridge.log for logging - Use $XDG_RUNTIME_DIR/winamp-mpris.pid for PID management - Add detailed user notification for 401 Unauthorized errors - Add install.sh for automated, standard-compliant setup - Include Winamp Web Interface source code and installer in repository
This commit is contained in:
108
Wawi Source/types.h
Normal file
108
Wawi Source/types.h
Normal file
@@ -0,0 +1,108 @@
|
||||
// Global types and definitions
|
||||
|
||||
// list to store user information from ini file
|
||||
struct user
|
||||
{
|
||||
char name[20];
|
||||
user * next;
|
||||
};
|
||||
|
||||
|
||||
// return values from DeletePlaylistEntry
|
||||
#define DPE_OK 1
|
||||
#define DPE_NOREAD 2
|
||||
#define DPE_NOWRITE 3
|
||||
|
||||
|
||||
// playlist for deleting items
|
||||
struct playlistitem
|
||||
{
|
||||
int number;
|
||||
char time[10];
|
||||
char name[MAX_PATH];
|
||||
char path[MAX_PATH];
|
||||
playlistitem * next;
|
||||
};
|
||||
|
||||
struct fileinfo
|
||||
{
|
||||
char path[MAX_PATH];
|
||||
char name[MAX_PATH];
|
||||
bool playlist;
|
||||
bool urlsct;
|
||||
fileinfo *next;
|
||||
fileinfo *prev;
|
||||
};
|
||||
|
||||
struct filesearch
|
||||
{
|
||||
fileinfo *firstfile;
|
||||
fileinfo *firstdir;
|
||||
int dnodes;
|
||||
int fnodes;
|
||||
};
|
||||
|
||||
// Request IDs
|
||||
#define RID_GET 101
|
||||
#define RID_HEAD 102
|
||||
|
||||
// Image types
|
||||
#define IMG_GIF 301
|
||||
#define IMG_ICO 302
|
||||
|
||||
// Access level IDs. These get OR-ed together to come up with a single value
|
||||
#define AUTH_ANON 0
|
||||
#define AUTH_BROWSE 1
|
||||
#define AUTH_DOWNLOAD 2
|
||||
#define AUTH_PLAYLIST 4
|
||||
#define AUTH_CLEAR 8
|
||||
#define AUTH_CONTROL 16
|
||||
#define AUTH_SERVER 32
|
||||
|
||||
// Target frames
|
||||
#define T_NONE 601
|
||||
#define T_MAIN 602
|
||||
#define T_BOTTOM 603
|
||||
#define T_TOP 604
|
||||
|
||||
// holds information about 1 name/value pair ...?<name>=<value>&...
|
||||
struct argument
|
||||
{
|
||||
char name[30];
|
||||
char value[128];
|
||||
};
|
||||
|
||||
// Main connection information structure
|
||||
struct http_request
|
||||
{
|
||||
char user[20]; // logged on user (or 'anon')
|
||||
char request[10]; // 'GET', 'HEAD' etc
|
||||
int reqID; // integer representing the above
|
||||
char file[512]; // full requested url
|
||||
char page[MAX_PATH]; // just the page, without arguments
|
||||
char http_version[10]; // HTTP Version; eg. "HTTP/1.0"
|
||||
int responsecode; // HTTP response; 200, 400, 401 etc
|
||||
char realm[50]; // authentication realm
|
||||
int auth; // access level
|
||||
argument pairs[50]; // name/value pairs for arguments
|
||||
int num_args; // number of arguments
|
||||
};
|
||||
|
||||
|
||||
#define BUF_LEN 10000
|
||||
|
||||
// Return states
|
||||
#define ST_NONE 200
|
||||
#define ST_CLOSE 201
|
||||
#define ST_CLOSEBODY 202
|
||||
|
||||
struct connection
|
||||
{
|
||||
char output[BUF_LEN];
|
||||
http_request http;
|
||||
SOCKET socket;
|
||||
sockaddr_in remote_host;
|
||||
int state;
|
||||
bool log;
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user