diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..31686a3 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +github: byemc diff --git a/.gitignore b/.gitignore index a078a68..cf76f7b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ config.php -vendor/ \ No newline at end of file +vendor/ +.idea/ \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index b58b603..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml deleted file mode 100644 index a55e7a1..0000000 --- a/.idea/codeStyles/codeStyleConfig.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/dataSources.local.xml b/.idea/dataSources.local.xml deleted file mode 100644 index 92eddc1..0000000 --- a/.idea/dataSources.local.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - #@ - ` - - - master_key - bye - - - - - - - - \ No newline at end of file diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml deleted file mode 100644 index b7c12c5..0000000 --- a/.idea/dataSources.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - mariadb - true - org.mariadb.jdbc.Driver - jdbc:mariadb://id:3306/id - $ProjectFileDir$ - - - \ No newline at end of file diff --git a/.idea/dataSources/5bc27beb-c8ab-420d-bdbc-055b37ae9e39.xml b/.idea/dataSources/5bc27beb-c8ab-420d-bdbc-055b37ae9e39.xml deleted file mode 100644 index f35c051..0000000 --- a/.idea/dataSources/5bc27beb-c8ab-420d-bdbc-055b37ae9e39.xml +++ /dev/null @@ -1,1487 +0,0 @@ - - - - - exact - InnoDB - |root||bye||ALTER|G -|root||bye|100.12.43.1|ALTER|G -|root||mysql|localhost|ALTER|G -|root||root|localhost|ALTER|G -|root||bye||ALTER ROUTINE|G -|root||bye|100.12.43.1|ALTER ROUTINE|G -|root||mysql|localhost|ALTER ROUTINE|G -|root||root|localhost|ALTER ROUTINE|G -|root||bye||BINLOG ADMIN|G -|root||bye|100.12.43.1|BINLOG ADMIN|G -|root||mysql|localhost|BINLOG ADMIN|G -|root||root|localhost|BINLOG ADMIN|G -|root||bye||BINLOG MONITOR|G -|root||bye|100.12.43.1|BINLOG MONITOR|G -|root||mysql|localhost|BINLOG MONITOR|G -|root||root|localhost|BINLOG MONITOR|G -|root||bye||BINLOG REPLAY|G -|root||bye|100.12.43.1|BINLOG REPLAY|G -|root||mysql|localhost|BINLOG REPLAY|G -|root||root|localhost|BINLOG REPLAY|G -|root||bye||CONNECTION ADMIN|G -|root||bye|100.12.43.1|CONNECTION ADMIN|G -|root||mysql|localhost|CONNECTION ADMIN|G -|root||root|localhost|CONNECTION ADMIN|G -|root||bye||CREATE|G -|root||bye|100.12.43.1|CREATE|G -|root||mysql|localhost|CREATE|G -|root||root|localhost|CREATE|G -|root||bye||CREATE ROUTINE|G -|root||bye|100.12.43.1|CREATE ROUTINE|G -|root||mysql|localhost|CREATE ROUTINE|G -|root||root|localhost|CREATE ROUTINE|G -|root||bye||CREATE TABLESPACE|G -|root||bye|100.12.43.1|CREATE TABLESPACE|G -|root||mysql|localhost|CREATE TABLESPACE|G -|root||root|localhost|CREATE TABLESPACE|G -|root||bye||CREATE TEMPORARY TABLES|G -|root||bye|100.12.43.1|CREATE TEMPORARY TABLES|G -|root||mysql|localhost|CREATE TEMPORARY TABLES|G -|root||root|localhost|CREATE TEMPORARY TABLES|G -|root||bye||CREATE USER|G -|root||bye|100.12.43.1|CREATE USER|G -|root||mysql|localhost|CREATE USER|G -|root||root|localhost|CREATE USER|G -|root||bye||CREATE VIEW|G -|root||bye|100.12.43.1|CREATE VIEW|G -|root||mysql|localhost|CREATE VIEW|G -|root||root|localhost|CREATE VIEW|G -|root||bye||DELETE|G -|root||bye|100.12.43.1|DELETE|G -|root||mysql|localhost|DELETE|G -|root||root|localhost|DELETE|G -|root||bye||DELETE HISTORY|G -|root||bye|100.12.43.1|DELETE HISTORY|G -|root||mysql|localhost|DELETE HISTORY|G -|root||root|localhost|DELETE HISTORY|G -|root||bye||DROP|G -|root||bye|100.12.43.1|DROP|G -|root||mysql|localhost|DROP|G -|root||root|localhost|DROP|G -|root||bye||EVENT|G -|root||bye|100.12.43.1|EVENT|G -|root||mysql|localhost|EVENT|G -|root||root|localhost|EVENT|G -|root||bye||EXECUTE|G -|root||bye|100.12.43.1|EXECUTE|G -|root||mysql|localhost|EXECUTE|G -|root||root|localhost|EXECUTE|G -|root||bye||FEDERATED ADMIN|G -|root||bye|100.12.43.1|FEDERATED ADMIN|G -|root||mysql|localhost|FEDERATED ADMIN|G -|root||root|localhost|FEDERATED ADMIN|G -|root||bye||FILE|G -|root||bye|100.12.43.1|FILE|G -|root||mysql|localhost|FILE|G -|root||root|localhost|FILE|G -|root||bye||INDEX|G -|root||bye|100.12.43.1|INDEX|G -|root||mysql|localhost|INDEX|G -|root||root|localhost|INDEX|G -|root||bye||INSERT|G -|root||bye|100.12.43.1|INSERT|G -|root||mysql|localhost|INSERT|G -|root||root|localhost|INSERT|G -|root||bye||LOCK TABLES|G -|root||bye|100.12.43.1|LOCK TABLES|G -|root||mysql|localhost|LOCK TABLES|G -|root||root|localhost|LOCK TABLES|G -|root||bye||PROCESS|G -|root||bye|100.12.43.1|PROCESS|G -|root||mysql|localhost|PROCESS|G -|root||root|localhost|PROCESS|G -|root||bye||READ_ONLY ADMIN|G -|root||bye|100.12.43.1|READ_ONLY ADMIN|G -|root||mysql|localhost|READ_ONLY ADMIN|G -|root||root|localhost|READ_ONLY ADMIN|G -|root||bye||REFERENCES|G -|root||bye|100.12.43.1|REFERENCES|G -|root||mysql|localhost|REFERENCES|G -|root||root|localhost|REFERENCES|G -|root||bye||RELOAD|G -|root||bye|100.12.43.1|RELOAD|G -|root||mysql|localhost|RELOAD|G -|root||root|localhost|RELOAD|G -|root||bye||REPLICATION MASTER ADMIN|G -|root||bye|100.12.43.1|REPLICATION MASTER ADMIN|G -|root||mysql|localhost|REPLICATION MASTER ADMIN|G -|root||root|localhost|REPLICATION MASTER ADMIN|G -|root||bye||REPLICATION SLAVE|G -|root||bye|100.12.43.1|REPLICATION SLAVE|G -|root||mysql|localhost|REPLICATION SLAVE|G -|root||root|localhost|REPLICATION SLAVE|G -|root||bye||REPLICATION SLAVE ADMIN|G -|root||bye|100.12.43.1|REPLICATION SLAVE ADMIN|G -|root||mysql|localhost|REPLICATION SLAVE ADMIN|G -|root||root|localhost|REPLICATION SLAVE ADMIN|G -|root||bye||SELECT|G -|root||bye|100.12.43.1|SELECT|G -|root||mysql|localhost|SELECT|G -|root||root|localhost|SELECT|G -|root||bye||SET USER|G -|root||bye|100.12.43.1|SET USER|G -|root||mysql|localhost|SET USER|G -|root||root|localhost|SET USER|G -|root||bye||SHOW DATABASES|G -|root||bye|100.12.43.1|SHOW DATABASES|G -|root||mysql|localhost|SHOW DATABASES|G -|root||root|localhost|SHOW DATABASES|G -|root||bye||SHOW VIEW|G -|root||bye|100.12.43.1|SHOW VIEW|G -|root||mysql|localhost|SHOW VIEW|G -|root||root|localhost|SHOW VIEW|G -|root||bye||SHUTDOWN|G -|root||bye|100.12.43.1|SHUTDOWN|G -|root||mysql|localhost|SHUTDOWN|G -|root||root|localhost|SHUTDOWN|G -|root||bye||SLAVE MONITOR|G -|root||bye|100.12.43.1|SLAVE MONITOR|G -|root||mysql|localhost|SLAVE MONITOR|G -|root||root|localhost|SLAVE MONITOR|G -|root||bye||SUPER|G -|root||bye|100.12.43.1|SUPER|G -|root||mysql|localhost|SUPER|G -|root||root|localhost|SUPER|G -|root||bye||TRIGGER|G -|root||bye|100.12.43.1|TRIGGER|G -|root||mysql|localhost|TRIGGER|G -|root||root|localhost|TRIGGER|G -|root||bye||UPDATE|G -|root||bye|100.12.43.1|UPDATE|G -|root||mysql|localhost|UPDATE|G -|root||root|localhost|UPDATE|G -|root||bye||grant option|G -|root||bye|100.12.43.1|grant option|G -|root||mysql|localhost|grant option|G -|root||root|localhost|grant option|G -id|schema||id||ALTER|G -id|schema||id||ALTER ROUTINE|G -id|schema||id||CREATE|G -id|schema||id||CREATE ROUTINE|G -id|schema||id||CREATE TEMPORARY TABLES|G -id|schema||id||CREATE VIEW|G -id|schema||id||DELETE|G -id|schema||id||DELETE HISTORY|G -id|schema||id||DROP|G -id|schema||id||EVENT|G -id|schema||id||EXECUTE|G -id|schema||id||INDEX|G -id|schema||id||INSERT|G -id|schema||id||LOCK TABLES|G -id|schema||id||REFERENCES|G -id|schema||id||SELECT|G -id|schema||id||SHOW VIEW|G -id|schema||id||TRIGGER|G -id|schema||id||UPDATE|G -phpmyadmin|schema||phpmyadmin|localhost|ALTER|G -phpmyadmin|schema||phpmyadmin|localhost|ALTER ROUTINE|G -phpmyadmin|schema||phpmyadmin|localhost|CREATE|G -phpmyadmin|schema||phpmyadmin|localhost|CREATE ROUTINE|G -phpmyadmin|schema||phpmyadmin|localhost|CREATE TEMPORARY TABLES|G -phpmyadmin|schema||phpmyadmin|localhost|CREATE VIEW|G -phpmyadmin|schema||phpmyadmin|localhost|DELETE|G -phpmyadmin|schema||phpmyadmin|localhost|DELETE HISTORY|G -phpmyadmin|schema||phpmyadmin|localhost|DROP|G -phpmyadmin|schema||phpmyadmin|localhost|EVENT|G -phpmyadmin|schema||phpmyadmin|localhost|EXECUTE|G -phpmyadmin|schema||phpmyadmin|localhost|INDEX|G -phpmyadmin|schema||phpmyadmin|localhost|INSERT|G -phpmyadmin|schema||phpmyadmin|localhost|LOCK TABLES|G -phpmyadmin|schema||phpmyadmin|localhost|REFERENCES|G -phpmyadmin|schema||phpmyadmin|localhost|SELECT|G -phpmyadmin|schema||phpmyadmin|localhost|SHOW VIEW|G -phpmyadmin|schema||phpmyadmin|localhost|TRIGGER|G -phpmyadmin|schema||phpmyadmin|localhost|UPDATE|G - 10.6.12 - - - big5 - 1 - - - big5 - - - big5 - - - big5 - - - dec8 - 1 - - - dec8 - - - dec8 - - - dec8 - - - cp850 - 1 - - - cp850 - - - cp850 - - - cp850 - - - hp8 - 1 - - - hp8 - - - hp8 - - - hp8 - - - koi8r - 1 - - - koi8r - - - koi8r - - - koi8r - - - latin1 - - - latin1 - 1 - - - latin1 - - - latin1 - - - latin1 - - - latin1 - - - latin1 - - - latin1 - - - latin1 - - - latin1 - - - latin2 - - - latin2 - 1 - - - latin2 - - - latin2 - - - latin2 - - - latin2 - - - latin2 - - - swe7 - 1 - - - swe7 - - - swe7 - - - swe7 - - - ascii - 1 - - - ascii - - - ascii - - - ascii - - - ujis - 1 - - - ujis - - - ujis - - - ujis - - - sjis - 1 - - - sjis - - - sjis - - - sjis - - - hebrew - 1 - - - hebrew - - - hebrew - - - hebrew - - - tis620 - 1 - - - tis620 - - - tis620 - - - tis620 - - - euckr - 1 - - - euckr - - - euckr - - - euckr - - - koi8u - 1 - - - koi8u - - - koi8u - - - koi8u - - - gb2312 - 1 - - - gb2312 - - - gb2312 - - - gb2312 - - - greek - 1 - - - greek - - - greek - - - greek - - - cp1250 - 1 - - - cp1250 - - - cp1250 - - - cp1250 - - - cp1250 - - - cp1250 - - - cp1250 - - - gbk - 1 - - - gbk - - - gbk - - - gbk - - - latin5 - 1 - - - latin5 - - - latin5 - - - latin5 - - - armscii8 - 1 - - - armscii8 - - - armscii8 - - - armscii8 - - - utf8mb3 - 1 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - ucs2 - 1 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - cp866 - 1 - - - cp866 - - - cp866 - - - cp866 - - - keybcs2 - 1 - - - keybcs2 - - - keybcs2 - - - keybcs2 - - - macce - 1 - - - macce - - - macce - - - macce - - - macroman - 1 - - - macroman - - - macroman - - - macroman - - - cp852 - 1 - - - cp852 - - - cp852 - - - cp852 - - - latin7 - - - latin7 - 1 - - - latin7 - - - latin7 - - - latin7 - - - latin7 - - - utf8mb4 - 1 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - cp1251 - - - cp1251 - - - cp1251 - - - cp1251 - 1 - - - cp1251 - - - cp1251 - - - cp1251 - - - utf16 - 1 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16le - 1 - - - utf16le - - - utf16le - - - utf16le - - - cp1256 - 1 - - - cp1256 - - - cp1256 - - - cp1256 - - - cp1257 - - - cp1257 - - - cp1257 - 1 - - - cp1257 - - - cp1257 - - - utf32 - 1 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - binary - 1 - - - geostd8 - 1 - - - geostd8 - - - geostd8 - - - geostd8 - - - cp932 - 1 - - - cp932 - - - cp932 - - - cp932 - - - eucjpms - 1 - - - eucjpms - - - eucjpms - - - eucjpms - - - utf8mb3_general_ci - - - utf8mb4_general_ci - - - utf8mb3_general_ci - - - 1 - 2023-11-16.19:58:39 - 2023-11-16.19:58:50 - utf8mb4_general_ci - - - utf8mb4_general_ci - - - utf8mb3_general_ci - - - localhost - - - localhost - - - localhost - - - - localhost - - - - 100.12.43.1 - - - InnoDB - utf8mb4_general_ci -
- - InnoDB - utf8mb4_general_ci -
- - InnoDB - utf8mb4_general_ci -
- - InnoDB - utf8mb4_general_ci -
- - InnoDB - utf8mb4_general_ci -
- - varchar(7)|0s - 1 - 1 - - - text|0s - 1 - 2 - - - date|0s - current_timestamp() - 1 - 3 - - - text|0s - 4 - - - text|0s - 1 - 5 - - - tinyint(1)|0s - 1 - 6 - - - tinyint(1)|0s - 0 - 1 - 7 - - - tinyint(1)|0s - 0 - 1 - 8 - - - id - btree - 1 - - - email - hash - 1 - - - 1 - 1 - PRIMARY - - - email - - - int(10)|0s - 1 - 1 - - - varchar(7)|0s - 2 - - - text|0s - 1 - 3 - - - text|0s - 4 - - - owner_id - set-null - cascade - id - accounts - - - id - btree - 1 - - - owner_id - btree - - - 1 - 1 - PRIMARY - - - 1 - int(11)|0s - 1 - 1 - - - int(11)|0s - 1 - 2 - - - text|0s - 1 - 3 - - - text|0s - 4 - - - text|0s - 1 - 5 - - - app_id - id - apps - - - id - btree - 1 - - - app_id - btree - - - 1 - 1 - PRIMARY - - - 8 - int(11)|0s - 1 - 1 - - - tinytext|0s - 1 - 2 - - - varchar(7)|0s - 1 - 3 - - - int(11)|0s - 1 - 4 - - - owner_id - id - accounts - - - id - btree - 1 - - - owner_id - btree - - - 1 - 1 - PRIMARY - - - varchar(7)|0s - 1 - 1 - - - text|0s - 2 - - - tinyint(1)|0s - 0 - 1 - 3 - - - tinyint(1)|0s - 0 - 1 - 4 - - - id - id - accounts - - - id - btree - 1 - - - 1 - 1 - PRIMARY - -
-
\ No newline at end of file diff --git a/.idea/dataSources/5bc27beb-c8ab-420d-bdbc-055b37ae9e39/storage_v2/_src_/schema/id.Gw0AAA.meta b/.idea/dataSources/5bc27beb-c8ab-420d-bdbc-055b37ae9e39/storage_v2/_src_/schema/id.Gw0AAA.meta deleted file mode 100644 index d4880e4..0000000 --- a/.idea/dataSources/5bc27beb-c8ab-420d-bdbc-055b37ae9e39/storage_v2/_src_/schema/id.Gw0AAA.meta +++ /dev/null @@ -1,2 +0,0 @@ -#n:id -! [1700164719000, 0, null, null, -2147483648, -2147483648] diff --git a/.idea/dataSources/5bc27beb-c8ab-420d-bdbc-055b37ae9e39/storage_v2/_src_/schema/information_schema.FNRwLQ.meta b/.idea/dataSources/5bc27beb-c8ab-420d-bdbc-055b37ae9e39/storage_v2/_src_/schema/information_schema.FNRwLQ.meta deleted file mode 100644 index 1ff3db2..0000000 --- a/.idea/dataSources/5bc27beb-c8ab-420d-bdbc-055b37ae9e39/storage_v2/_src_/schema/information_schema.FNRwLQ.meta +++ /dev/null @@ -1,2 +0,0 @@ -#n:information_schema -! [null, 0, null, null, -2147483648, -2147483648] diff --git a/.idea/dataSources/5bc27beb-c8ab-420d-bdbc-055b37ae9e39/storage_v2/_src_/schema/mysql.osA4Bg.meta b/.idea/dataSources/5bc27beb-c8ab-420d-bdbc-055b37ae9e39/storage_v2/_src_/schema/mysql.osA4Bg.meta deleted file mode 100644 index 86a53f1..0000000 --- a/.idea/dataSources/5bc27beb-c8ab-420d-bdbc-055b37ae9e39/storage_v2/_src_/schema/mysql.osA4Bg.meta +++ /dev/null @@ -1,2 +0,0 @@ -#n:mysql -! [null, 0, null, null, -2147483648, -2147483648] diff --git a/.idea/dataSources/5bc27beb-c8ab-420d-bdbc-055b37ae9e39/storage_v2/_src_/schema/performance_schema.kIw0nw.meta b/.idea/dataSources/5bc27beb-c8ab-420d-bdbc-055b37ae9e39/storage_v2/_src_/schema/performance_schema.kIw0nw.meta deleted file mode 100644 index 9394db1..0000000 --- a/.idea/dataSources/5bc27beb-c8ab-420d-bdbc-055b37ae9e39/storage_v2/_src_/schema/performance_schema.kIw0nw.meta +++ /dev/null @@ -1,2 +0,0 @@ -#n:performance_schema -! [null, 0, null, null, -2147483648, -2147483648] diff --git a/.idea/id.iml b/.idea/id.iml deleted file mode 100644 index 21a8ff4..0000000 --- a/.idea/id.iml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 9367315..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml deleted file mode 100644 index 4c1495a..0000000 --- a/.idea/php.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/sqldialects.xml b/.idea/sqldialects.xml deleted file mode 100644 index 63772a3..0000000 --- a/.idea/sqldialects.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1dd..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/account.php b/account.php index d4408c1..fe7931c 100644 --- a/account.php +++ b/account.php @@ -77,8 +77,8 @@ if (isset($message )) { ?>
-
- +
+
diff --git a/accounts_handler.php b/accounts_handler.php index c262cac..1ae09c3 100644 --- a/accounts_handler.php +++ b/accounts_handler.php @@ -2,32 +2,22 @@ // This file carries functions related to accounts. function get_avatar_url($bcid):string { - global $pdo; - $sql = "SELECT has_pfp FROM `accounts` WHERE id = ?"; + $exists = db_execute('SELECT public FROM avatars WHERE id = ? LIMIT 1', [$bcid]); - try { - $stmt = $pdo -> prepare($sql); - $stmt->execute([$bcid]); - $has_pfp = $stmt->fetch(); - } catch (PDOException $e) { - http_response_code(500); - die($e); - } - - $appendix = "default.png"; - - if ($has_pfp['has_pfp']) { - $appendix = $bcid; - } - - return 'https://cdn.byecorps.com/id/profile/'.$appendix; + if (empty($exists)) { + return '/assets/default.png'; + } + return '/public/avatars/' . $bcid; } -function get_display_name($bcid, $use_bcid_fallback=true):string { +function get_display_name($bcid, $use_bcid_fallback=true, $put_bcid_in_parenthesis=false, $format_bcid=false):string { $display_name = db_execute("SELECT display_name FROM accounts WHERE id = ?", [$bcid])['display_name']; if (!empty($display_name)) { + if ($put_bcid_in_parenthesis) { + return $display_name . " ($bcid)"; + } return $display_name; } @@ -38,6 +28,94 @@ function get_display_name($bcid, $use_bcid_fallback=true):string { return ""; } +// Tokens so apps can get VERY BASIC information + +function generate_basic_access_token($bcid, $application_id=""): array +{ + // Returns an access token, a refresh token and an expiry timestamp. + + $access_token = md5(uniqid(more_entropy: true).rand(1000000, 9999999)); + $refresh_token = md5(uniqid("rfish").rand(1000000, 9999999)); + + $valid_time = 12; // in hours + $expiry = time() + ($valid_time * 60 * 60); + +// echo $access_token . ":" . $refresh_token; + + if ($application_id) { + db_execute( + "INSERT INTO tokens (access_token, refresh_token, expiry, owner_id, application_id, permissions) VALUES (?,?,?,?,?, (1<<0 | 1<<1))", + [$access_token, $refresh_token, $expiry, $bcid, $application_id] + ); + } else { + db_execute( + "INSERT INTO tokens (access_token, refresh_token, expiry, owner_id, permissions) VALUES (?,?,?,?, (1<<0 | 1<<1))", + [$access_token, $refresh_token, $expiry, $bcid] + ); + } + + return [ + "access" => $access_token, + "refresh" => $refresh_token, + "expiry" => $expiry, + "id" => $bcid + ]; +} + +function generate_token($bcid, $application_id=null, $permissions=0): array { + $access_token = md5(uniqid(more_entropy: true).rand(1000000, 9999999)); + $refresh_token = md5(uniqid("rfish").rand(1000000, 9999999)); + + $valid_time = 12; // in hours + $expiry = time() + ($valid_time * 60 * 60); + + db_execute( + "INSERT INTO tokens (access_token, refresh_token, expiry, owner_id, application_id, permissions, type) VALUES (?,?,?,?,?,?, 'oauth')", + [$access_token, $refresh_token, $expiry, $bcid, $application_id, $permissions] + ); + + return [ + "access" => $access_token, + "refresh" => $refresh_token, + "permissions" => $permissions, + "expiry" => $expiry, + "id" => $bcid + ]; +} + +function generate_cookie_access_token($bcid) { + $access_token = md5(uniqid(prefix: "COOKIECOOKIECOOKIE", more_entropy: true).rand(1000000, 9999999)); + + $valid_time = 365 * 24; // 1 year + $expiry = time() + ($valid_time * 60 * 60); + +// echo $access_token . ":" . $refresh_token; + + db_execute( + "INSERT INTO tokens (access_token, expiry, owner_id, type) VALUES (?,?,?,'cookie')", + [$access_token, $expiry, $bcid] + ); + + return [ + "access" => $access_token, + "expiry" => $expiry, + "id" => $bcid + ]; +} + +function validate_access_token($access_token): bool +{ + $token_details = db_execute("SELECT * FROM tokens WHERE access_token = ?", [$access_token]); + if (null == $token_details) { + return false; + } + if (time() > $token_details['expiry']) { + db_execute("DELETE FROM tokens where access_token = ?", [$access_token]); + return false; + } + return true; +} + // Password resets const PASSWORD_RESET_VALIDITY = 300; // in seconds. function create_password_reset($bcid):string { diff --git a/admin.php b/admin.php index d92d029..efb0b73 100644 --- a/admin.php +++ b/admin.php @@ -18,6 +18,11 @@ +

API

+ +

Init

  • diff --git a/admin_accounts.php b/admin_accounts.php index 3a73e80..b353838 100644 --- a/admin_accounts.php +++ b/admin_accounts.php @@ -21,9 +21,9 @@ $count = $count_req->fetchColumn(); diff --git a/admin_apps_create.php b/admin_apps_create.php index bc3bec9..c769a22 100644 --- a/admin_apps_create.php +++ b/admin_apps_create.php @@ -13,7 +13,7 @@ function check_app_id($app_id): bool if ($_SERVER['REQUEST_METHOD'] == "POST") { $app_id = generate_app_id(); - db_execute("INSERT INTO apps (id, owner_id, title, description) VALUES (?, ?, ?, ?)", [$app_id, $_POST['owner'], $_POST['title'], $_POST['description']]); + db_execute("INSERT INTO apps (id, owner_id, title, description, type, callback) VALUES (?, ?, ?, ?, ?, ?)", [$app_id, $_POST['owner'], $_POST['title'], $_POST['description'], $_POST['type'], $_POST['callback']]); die(); } @@ -23,11 +23,11 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
    - + - - + + + + + + + + +
    \ No newline at end of file diff --git a/admin_create_token.php b/admin_create_token.php new file mode 100644 index 0000000..6456f05 --- /dev/null +++ b/admin_create_token.php @@ -0,0 +1,86 @@ +"; + print_r($_POST); + echo ""; + + $token = generate_token($_POST['owner'], $_POST['application'], $_POST['permissions']); + + echo "

    Created token. Access token: ". $token['access'] ."

    "; +} + +?> + +

    Token generator

    + +
    +
    + + +
    +
    + + +
    + + + +

    Permissions

    +

    Permission number:

    +
    + + +
    + + +
    + + + + diff --git a/admin_initdatabase.php b/admin_initdatabase.php index 2a61acc..fb860c9 100644 --- a/admin_initdatabase.php +++ b/admin_initdatabase.php @@ -6,13 +6,15 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { echo "

    Create table `accounts`"; $stmt = $pdo->prepare('create table accounts ( - id varchar(7) not null + id varchar(7) not null primary key, - email text not null, - created_date date default current_timestamp() not null, - display_name text null, - password text not null, - verified tinyint(1) not null, + email text not null, + created_date datetime default current_timestamp() not null, + display_name text null, + password text not null, + verified tinyint(1) default 0 not null, + has_pfp tinyint(1) default 0 not null, + is_admin tinyint(1) default 0 not null, constraint email unique (email) using hash );'); @@ -23,7 +25,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { echo('

    An error occurred: '. $e->getMessage() .'. Will skip. (Most likely the table already exists.)'); } - echo '

    Create the `password_resets` table

    '; + echo '

    Create the `password_resets` table'; $stmt = $pdo->prepare('create table password_resets ( id int auto_increment @@ -33,11 +35,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { expiration int not null, constraint password_resets_ibfk_1 foreign key (owner_id) references accounts (id) -); - -create index owner_id - on password_resets (owner_id); -'); +);'); try { $stmt->execute(); @@ -45,13 +43,106 @@ create index owner_id echo('

    An error occurred: '. $e->getMessage() .'. Most likely this is already set.'); } + echo '

    Create the `apps` table'; + + try { + db_execute('create table apps ( + id int auto_increment + primary key, + owner_id varchar(7) not null, + title text not null, + description text, + image text default "https://id.byecorps.com/assets/default.png" not null, + type text null, + callback text null, + constraint apps_ibfk_1 + foreign key (owner_id) references accounts (id) + );'); + } catch (PDOException $e) { + echo('

    An error occurred: '. $e->getMessage() .'. Most likely this is already set.'); + } + + + echo '

    Create the `badges` table'; + + try { + db_execute('create table badges ( + id int auto_increment + primary key, + app_id int not null, + title text not null, + description text, + image text default "https://id.byecorps.com/assets/default.png" not null, + type text null, + callback text null, + constraint badges_ibfk_1 + foreign key (app_id) references apps (id) + );'); + } catch (PDOException $e) { + echo('

    An error occurred: '. $e->getMessage() .'. Most likely this is already set.'); + } + + echo '

    Create the `profiles` table'; + + try { + db_execute('create table profiles ( + id varchar(7) + primary key, + description text null, + public_avatar tinyint(1) default 0, + public_display_name tinyint(1) default 0, + + constraint profiles_ibfk_1 + foreign key (id) references accounts (id) + );'); + } catch (PDOException $e) { + echo('

    An error occurred: '. $e->getMessage() .'. Most likely this is already set.'); + } + + echo '

    Create the `tokens` table'; + + try { + db_execute('create table tokens ( + id int auto_increment primary key, + access_token text unique, + refresh_token text null, + expiry int not null, + owner_id varchar(7), + application_id int(10) null, + + constraint tokens_application_id + foreign key (application_id) references apps (id), + constraint tokens_owner_id + foreign key (owner_id) references accounts (id) + );'); + } catch (PDOException $e) { + echo('

    An error occurred: '. $e->getMessage() .'. Most likely this is already set.'); + } + + echo '

    Create the `tokens` table'; + + try { + db_query('CREATE TABLE `badge_owners` ( + `badge_id` int(11) NOT NULL, + `owner_id` varchar(7) NOT NULL, + `earned` timestamp NULL DEFAULT current_timestamp(), + `info` text DEFAULT NULL COMMENT \'App may attach more info about how the badge was won (Killed "CoolGamer69 in battle!")\', + + constraint badges_owners_badge + foreign key (badge_id) references badges (id), + constraint badges_owners_owner + foreign key (owner_id) references accounts (id) +);'); + } catch (PDOException $e) { + echo('

    An error occurred: ' . $e->getMessage() . '. Most likely this is already set.'); + } + echo "

    Database initialised.

    "; } } ?> -

    Admin

    Init database

    Assuming you have the database config configured, you can click this button to create the tables required for this thing to function.

    diff --git a/admin_purge.php b/admin_purge.php new file mode 100644 index 0000000..691e757 --- /dev/null +++ b/admin_purge.php @@ -0,0 +1,29 @@ + + + + +

    Purge

    +
    +

    + +

    +
    + +

    Expired password resets

    +
    + +

    Expired Login tokens

    +
    diff --git a/api_handler.php b/api_handler.php new file mode 100644 index 0000000..164e5c0 --- /dev/null +++ b/api_handler.php @@ -0,0 +1,198 @@ + "dangerous" + ]; + $token_owner = $_SESSION['id']; + } else { + return 0; + } + } else { + return 0; + } + } + + return match ($token_row['type']) { + "dangerous" => 1<<0 | 1<<1, // Everything + "basic" => 1<<1, // Basic + "oauth" => $token_row['permissions'], + default => 0, + }; +} + +// Misc (unauthorised) + +function redirect_to_documentation(): void +{ + header('Location: /docs/api'); +} + +// Health check + +function api_health_check(): array +{ + return ["message" => "Science compels us to explode the sun!", "time" => time(), "response_code" => 200]; +} + +// Potentially authenticated image endpoints + +function get_avatar(): array +{ + if (!array_key_exists('id', $query)) { + return [ + 'response_code' => 404, + 'message' => 'ID not assigned/found' + ]; + } + $user_id = $query['id']; + return []; +} + +// User (REQUIRES AUTHORISATION) + +function api_user_info(): array +{ + global $access_token, $token_owner; + // Authorisation levels: + // `display_name` = 1 (basic) + // `id` = 1 (basic) + // `email` = 1 (basic) + $level = check_authorisation($access_token); + $data = null; + if ($level & (1 << 0)) { + $data = db_execute("SELECT id, email, display_name FROM accounts WHERE id = ? LIMIT 1", [$token_owner]); + } else { + $data = db_execute("SELECT id, display_name FROM accounts WHERE id = ? LIMIT 1", [$token_owner]); + } + + if (null != $data) { + return [ + "response_code" => 200, + "data" => $data + ]; + } + + http_response_code(401); + return [ + "response_code" => 401, + "message" => "Unauthorized." + ]; +} + +function api_settings(): array +{ + // GET: Return all settings + // POST/PATCH: Update settings + + global $access_token, $token_owner; + + $level = check_authorisation($access_token); + + if (!($level & (1 << 1))) { // account.settings + http_response_code(401); + return [ + "response_code" => 401, + "message" => "Unauthorized." + ]; + } + + if ($_SERVER['REQUEST_METHOD'] === "POST") { + + // Now for the fucking worstest code ever + $settings_changed = json_decode(file_get_contents('php://input'), true); + + if (isset($settings_changed['account'])) { + if (isset($settings_changed['account']['display_name'])) { + $display_name = db_execute('UPDATE accounts SET display_name = ? WHERE id = ?', + [$settings_changed['account']['display_name'], $token_owner]); + } + } + } + + // Get account settings + $display_name = db_execute('SELECT display_name FROM accounts WHERE id = ?', [$token_owner])["display_name"]; + + + return [ + "response_code" => 200, + "settings" => [ + "account" => [ + "display_name" => $display_name, + ] + ] + ]; +} + +$api_routes = [ // base url is base_url.'/api' + // "/path" => "function_name" + // Misc + "" => "redirect_to_documentation", + "/status" => "api_health_check", + + // Account stuff + "/account/me" => "api_user_info", + + // Settings + "/settings" => "api_settings", + + // Get avatar + "/avatars/get" => "get_avatar" +]; + +$path = str_replace("/api", "", $path); + +if (isset($api_routes[$path])) { + if (isset($invalid_token)) { + http_response_code(498); + echo (json_encode([ + "response_code" => "498", + "message" => "Token expired or invalid." + ])); + exit(); + } + $response = $api_routes[$path](); + if (array_key_exists('response_code', $response)) { + http_response_code($response['response_code']); + } + echo json_encode($response); +} else { + http_response_code(404); + echo (json_encode([ + "response_code" => "404", + "message" => "Route not found." + ])); +} diff --git a/assets/bcid.svg b/assets/bcid.svg new file mode 100644 index 0000000..8911001 --- /dev/null +++ b/assets/bcid.svg @@ -0,0 +1,6 @@ + + Made with Pixels to Svg https://codepen.io/shshaw/pen/XbxvNj + + + + \ No newline at end of file diff --git a/assets/buttons/signinwith.svg b/assets/buttons/signinwith.svg new file mode 100644 index 0000000..ca72560 --- /dev/null +++ b/assets/buttons/signinwith.svg @@ -0,0 +1,88 @@ + + + + diff --git a/assets/default.png b/assets/default.png new file mode 100644 index 0000000..a1d6ae4 Binary files /dev/null and b/assets/default.png differ diff --git a/assets/icons/apple-icon-180.png b/assets/icons/apple-icon-180.png new file mode 100644 index 0000000..f07b87c Binary files /dev/null and b/assets/icons/apple-icon-180.png differ diff --git a/assets/icons/apple-splash-1125-2436.png b/assets/icons/apple-splash-1125-2436.png new file mode 100644 index 0000000..50920b9 Binary files /dev/null and b/assets/icons/apple-splash-1125-2436.png differ diff --git a/assets/icons/apple-splash-1136-640.png b/assets/icons/apple-splash-1136-640.png new file mode 100644 index 0000000..235e1f9 Binary files /dev/null and b/assets/icons/apple-splash-1136-640.png differ diff --git a/assets/icons/apple-splash-1170-2532.png b/assets/icons/apple-splash-1170-2532.png new file mode 100644 index 0000000..c6cd4a1 Binary files /dev/null and b/assets/icons/apple-splash-1170-2532.png differ diff --git a/assets/icons/apple-splash-1179-2556.png b/assets/icons/apple-splash-1179-2556.png new file mode 100644 index 0000000..5f90799 Binary files /dev/null and b/assets/icons/apple-splash-1179-2556.png differ diff --git a/assets/icons/apple-splash-1242-2208.png b/assets/icons/apple-splash-1242-2208.png new file mode 100644 index 0000000..2e56b17 Binary files /dev/null and b/assets/icons/apple-splash-1242-2208.png differ diff --git a/assets/icons/apple-splash-1242-2688.png b/assets/icons/apple-splash-1242-2688.png new file mode 100644 index 0000000..45c72d4 Binary files /dev/null and b/assets/icons/apple-splash-1242-2688.png differ diff --git a/assets/icons/apple-splash-1284-2778.png b/assets/icons/apple-splash-1284-2778.png new file mode 100644 index 0000000..5d26b9d Binary files /dev/null and b/assets/icons/apple-splash-1284-2778.png differ diff --git a/assets/icons/apple-splash-1290-2796.png b/assets/icons/apple-splash-1290-2796.png new file mode 100644 index 0000000..cee06db Binary files /dev/null and b/assets/icons/apple-splash-1290-2796.png differ diff --git a/assets/icons/apple-splash-1334-750.png b/assets/icons/apple-splash-1334-750.png new file mode 100644 index 0000000..fb37712 Binary files /dev/null and b/assets/icons/apple-splash-1334-750.png differ diff --git a/assets/icons/apple-splash-1488-2266.png b/assets/icons/apple-splash-1488-2266.png new file mode 100644 index 0000000..657fcb3 Binary files /dev/null and b/assets/icons/apple-splash-1488-2266.png differ diff --git a/assets/icons/apple-splash-1536-2048.png b/assets/icons/apple-splash-1536-2048.png new file mode 100644 index 0000000..c313eec Binary files /dev/null and b/assets/icons/apple-splash-1536-2048.png differ diff --git a/assets/icons/apple-splash-1620-2160.png b/assets/icons/apple-splash-1620-2160.png new file mode 100644 index 0000000..7e08f6d Binary files /dev/null and b/assets/icons/apple-splash-1620-2160.png differ diff --git a/assets/icons/apple-splash-1640-2360.png b/assets/icons/apple-splash-1640-2360.png new file mode 100644 index 0000000..b400cd3 Binary files /dev/null and b/assets/icons/apple-splash-1640-2360.png differ diff --git a/assets/icons/apple-splash-1668-2224.png b/assets/icons/apple-splash-1668-2224.png new file mode 100644 index 0000000..f01df0b Binary files /dev/null and b/assets/icons/apple-splash-1668-2224.png differ diff --git a/assets/icons/apple-splash-1668-2388.png b/assets/icons/apple-splash-1668-2388.png new file mode 100644 index 0000000..41f4ca6 Binary files /dev/null and b/assets/icons/apple-splash-1668-2388.png differ diff --git a/assets/icons/apple-splash-1792-828.png b/assets/icons/apple-splash-1792-828.png new file mode 100644 index 0000000..2d7e312 Binary files /dev/null and b/assets/icons/apple-splash-1792-828.png differ diff --git a/assets/icons/apple-splash-2048-1536.png b/assets/icons/apple-splash-2048-1536.png new file mode 100644 index 0000000..a53ba1c Binary files /dev/null and b/assets/icons/apple-splash-2048-1536.png differ diff --git a/assets/icons/apple-splash-2048-2732.png b/assets/icons/apple-splash-2048-2732.png new file mode 100644 index 0000000..75dcd5f Binary files /dev/null and b/assets/icons/apple-splash-2048-2732.png differ diff --git a/assets/icons/apple-splash-2160-1620.png b/assets/icons/apple-splash-2160-1620.png new file mode 100644 index 0000000..760d67a Binary files /dev/null and b/assets/icons/apple-splash-2160-1620.png differ diff --git a/assets/icons/apple-splash-2208-1242.png b/assets/icons/apple-splash-2208-1242.png new file mode 100644 index 0000000..1b5012d Binary files /dev/null and b/assets/icons/apple-splash-2208-1242.png differ diff --git a/assets/icons/apple-splash-2224-1668.png b/assets/icons/apple-splash-2224-1668.png new file mode 100644 index 0000000..24d1b32 Binary files /dev/null and b/assets/icons/apple-splash-2224-1668.png differ diff --git a/assets/icons/apple-splash-2266-1488.png b/assets/icons/apple-splash-2266-1488.png new file mode 100644 index 0000000..fa7ff4e Binary files /dev/null and b/assets/icons/apple-splash-2266-1488.png differ diff --git a/assets/icons/apple-splash-2360-1640.png b/assets/icons/apple-splash-2360-1640.png new file mode 100644 index 0000000..74192f7 Binary files /dev/null and b/assets/icons/apple-splash-2360-1640.png differ diff --git a/assets/icons/apple-splash-2388-1668.png b/assets/icons/apple-splash-2388-1668.png new file mode 100644 index 0000000..2895613 Binary files /dev/null and b/assets/icons/apple-splash-2388-1668.png differ diff --git a/assets/icons/apple-splash-2436-1125.png b/assets/icons/apple-splash-2436-1125.png new file mode 100644 index 0000000..d4b6f87 Binary files /dev/null and b/assets/icons/apple-splash-2436-1125.png differ diff --git a/assets/icons/apple-splash-2532-1170.png b/assets/icons/apple-splash-2532-1170.png new file mode 100644 index 0000000..b8ca512 Binary files /dev/null and b/assets/icons/apple-splash-2532-1170.png differ diff --git a/assets/icons/apple-splash-2556-1179.png b/assets/icons/apple-splash-2556-1179.png new file mode 100644 index 0000000..44a462f Binary files /dev/null and b/assets/icons/apple-splash-2556-1179.png differ diff --git a/assets/icons/apple-splash-2688-1242.png b/assets/icons/apple-splash-2688-1242.png new file mode 100644 index 0000000..6c8da45 Binary files /dev/null and b/assets/icons/apple-splash-2688-1242.png differ diff --git a/assets/icons/apple-splash-2732-2048.png b/assets/icons/apple-splash-2732-2048.png new file mode 100644 index 0000000..6d325da Binary files /dev/null and b/assets/icons/apple-splash-2732-2048.png differ diff --git a/assets/icons/apple-splash-2778-1284.png b/assets/icons/apple-splash-2778-1284.png new file mode 100644 index 0000000..f3d1776 Binary files /dev/null and b/assets/icons/apple-splash-2778-1284.png differ diff --git a/assets/icons/apple-splash-2796-1290.png b/assets/icons/apple-splash-2796-1290.png new file mode 100644 index 0000000..e906f5e Binary files /dev/null and b/assets/icons/apple-splash-2796-1290.png differ diff --git a/assets/icons/apple-splash-640-1136.png b/assets/icons/apple-splash-640-1136.png new file mode 100644 index 0000000..1e8208d Binary files /dev/null and b/assets/icons/apple-splash-640-1136.png differ diff --git a/assets/icons/apple-splash-750-1334.png b/assets/icons/apple-splash-750-1334.png new file mode 100644 index 0000000..a9ae504 Binary files /dev/null and b/assets/icons/apple-splash-750-1334.png differ diff --git a/assets/icons/apple-splash-828-1792.png b/assets/icons/apple-splash-828-1792.png new file mode 100644 index 0000000..668f2f7 Binary files /dev/null and b/assets/icons/apple-splash-828-1792.png differ diff --git a/assets/icons/manifest-icon-192.maskable.png b/assets/icons/manifest-icon-192.maskable.png new file mode 100644 index 0000000..f7735bc Binary files /dev/null and b/assets/icons/manifest-icon-192.maskable.png differ diff --git a/assets/icons/manifest-icon-512.maskable.png b/assets/icons/manifest-icon-512.maskable.png new file mode 100644 index 0000000..ad7db2b Binary files /dev/null and b/assets/icons/manifest-icon-512.maskable.png differ diff --git a/composer.json b/composer.json index 7e441b3..96cd7b5 100644 --- a/composer.json +++ b/composer.json @@ -1,9 +1,8 @@ { "require": { "sentry/sdk": "^4.0", - "phpmailer/phpmailer": "^6.8", "erusev/parsedown": "^1.7", "erusev/parsedown-extra": "^0.8.1", - "kornrunner/blurhash": "^1.2" + "resend/resend-php": "^0.11.0" } } diff --git a/composer.lock b/composer.lock index 1f28978..7dfa69b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9baad85ecd1e18878c3fe588203305a1", + "content-hash": "7cbb1a410be00f937b47c45077c89f9a", "packages": [ { "name": "erusev/parsedown", @@ -107,6 +107,215 @@ }, "time": "2019-12-30T23:20:37+00:00" }, + { + "name": "guzzlehttp/guzzle", + "version": "7.8.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "41042bc7ab002487b876a0683fc8dce04ddce104" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/41042bc7ab002487b876a0683fc8dce04ddce104", + "reference": "41042bc7ab002487b876a0683fc8dce04ddce104", + "shasum": "" + }, + "require": { + "ext-json": "*", + "guzzlehttp/promises": "^1.5.3 || ^2.0.1", + "guzzlehttp/psr7": "^1.9.1 || ^2.5.1", + "php": "^7.2.5 || ^8.0", + "psr/http-client": "^1.0", + "symfony/deprecation-contracts": "^2.2 || ^3.0" + }, + "provide": { + "psr/http-client-implementation": "1.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "ext-curl": "*", + "php-http/client-integration-tests": "dev-master#2c025848417c1135031fdf9c728ee53d0a7ceaee as 3.0.999", + "php-http/message-factory": "^1.1", + "phpunit/phpunit": "^8.5.36 || ^9.6.15", + "psr/log": "^1.1 || ^2.0 || ^3.0" + }, + "suggest": { + "ext-curl": "Required for CURL handler support", + "ext-intl": "Required for Internationalized Domain Name (IDN) support", + "psr/log": "Required for using the Log middleware" + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Jeremy Lindblom", + "email": "jeremeamia@gmail.com", + "homepage": "https://github.com/jeremeamia" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "psr-18", + "psr-7", + "rest", + "web service" + ], + "support": { + "issues": "https://github.com/guzzle/guzzle/issues", + "source": "https://github.com/guzzle/guzzle/tree/7.8.1" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle", + "type": "tidelift" + } + ], + "time": "2023-12-03T20:35:24+00:00" + }, + { + "name": "guzzlehttp/promises", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "bbff78d96034045e58e13dedd6ad91b5d1253223" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/bbff78d96034045e58e13dedd6ad91b5d1253223", + "reference": "bbff78d96034045e58e13dedd6ad91b5d1253223", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "phpunit/phpunit": "^8.5.36 || ^9.6.15" + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "support": { + "issues": "https://github.com/guzzle/promises/issues", + "source": "https://github.com/guzzle/promises/tree/2.0.2" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises", + "type": "tidelift" + } + ], + "time": "2023-12-03T20:19:20+00:00" + }, { "name": "guzzlehttp/psr7", "version": "2.6.1", @@ -410,6 +619,58 @@ ], "time": "2023-08-29T08:26:30+00:00" }, + { + "name": "psr/http-client", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-client.git", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0", + "psr/http-message": "^1.0 || ^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Client\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP clients", + "homepage": "https://github.com/php-fig/http-client", + "keywords": [ + "http", + "http-client", + "psr", + "psr-18" + ], + "support": { + "source": "https://github.com/php-fig/http-client" + }, + "time": "2023-09-23T14:17:50+00:00" + }, { "name": "psr/http-factory", "version": "1.0.2", @@ -612,6 +873,63 @@ }, "time": "2019-03-08T08:55:37+00:00" }, + { + "name": "resend/resend-php", + "version": "v0.11.0", + "source": { + "type": "git", + "url": "https://github.com/resend/resend-php.git", + "reference": "31ec02fc2d16b3badc10612289a3325afe68147c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/resend/resend-php/zipball/31ec02fc2d16b3badc10612289a3325afe68147c", + "reference": "31ec02fc2d16b3badc10612289a3325afe68147c", + "shasum": "" + }, + "require": { + "guzzlehttp/guzzle": "^7.5", + "php": "^8.1.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.13", + "mockery/mockery": "^1.6", + "pestphp/pest": "^2.0" + }, + "type": "library", + "autoload": { + "files": [ + "src/Resend.php" + ], + "psr-4": { + "Resend\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Resend and contributors", + "homepage": "https://github.com/resend/resend-php/contributors" + } + ], + "description": "Resend PHP library.", + "homepage": "https://resend.com/", + "keywords": [ + "api", + "client", + "php", + "resend", + "sdk" + ], + "support": { + "issues": "https://github.com/resend/resend-php/issues", + "source": "https://github.com/resend/resend-php/tree/v0.11.0" + }, + "time": "2024-02-01T18:06:15+00:00" + }, { "name": "sentry/sdk", "version": "4.0.0", diff --git a/credits.html b/credits.php similarity index 100% rename from credits.html rename to credits.php diff --git a/dashboard.php b/dashboard.php new file mode 100644 index 0000000..61c814b --- /dev/null +++ b/dashboard.php @@ -0,0 +1,43 @@ + + + + +
    +
    +
    + ' /> +
    +
    + + +
    +
    + +
    diff --git a/database.php b/database.php index bd1fcbd..9d794f9 100644 --- a/database.php +++ b/database.php @@ -10,6 +10,15 @@ function db_execute($sql, $variables=[]) { } +function db_execute_all($sql, $variables=[]) { + global $pdo; + + $stmt = $pdo->prepare($sql); + $stmt->execute($variables); + return $stmt->fetchAll(); + +} + function db_query($sql) { global $pdo; diff --git a/docs/hosting/errors.md b/docs/hosting/errors.md new file mode 100644 index 0000000..f7adbff --- /dev/null +++ b/docs/hosting/errors.md @@ -0,0 +1,7 @@ +# Errors + +Here's all the error codes and what they mean. + +| Error Code | Explanation | +|-----------:|:----------------------------| +| 12 | A generic error explaing something went wrong adding a password reset diff --git a/forgot_password.php b/forgot_password.php index f96d8ee..bd02325 100644 --- a/forgot_password.php +++ b/forgot_password.php @@ -1,7 +1,4 @@ SMTPDebug = SMTP::DEBUG_SERVER; Verbose output - $mail->isSMTP(); //Send using SMTP - $mail->Host = MAIL_HOST; //Set the SMTP server to send through - $mail->SMTPAuth = true; //Enable SMTP authentication - $mail->Username = MAIL_USERNAME; //SMTP username - $mail->Password = MAIL_PASSWORD; //SMTP password - $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Enable implicit TLS encryption - $mail->Port = 465; - - $mail->setFrom('id@byecorps.com', 'ByeCorps ID'); - $mail->addAddress($user['email'], $safe_display_name); - $mail->addReplyTo('hello@byecorps.com', 'ByeCorps Support'); - - $mail->Subject = 'Reset your password'; - $mail->Body = 'Hey there '.$safe_display_name.'! Here is that password reset you requested. Just click the following link and you\'ll be sorted: + $resend->emails->send([ + 'from' => 'ByeCorps ID ', + 'to' => [$safe_display_name . "<" . $user['email']. ">"], + 'subject' => 'Reset your password', + 'text' => 'Hey there '.$safe_display_name.'! Here is that password reset you requested. Just click the following link and you\'ll be sorted: '.$password_reset_link.' -This link expires in 5 minutes.'; - $mail->send(); +This link expires in 5 minutes. + +If you did not request this password reset, please ignore it (or tighten your account\'s security)']); + +// echo("This is a security issue."); } catch (Exception $e) { - echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}"; + echo "Message could not be sent. Mailer Error: $e"; } } @@ -65,7 +45,7 @@ This link expires in 5 minutes.'; ".$message."

    "; ?> -

    Forgot your password? We'll send you an email to reset it.

    +

    Forgot your password? We'll email you to reset it.

    diff --git a/head.php b/head.php index 2d5c655..5ea88ad 100644 --- a/head.php +++ b/head.php @@ -7,7 +7,15 @@ > <?php if (isset($doc_title)) { echo $doc_title." | "; } ?>ByeCorps ID - + - - \ No newline at end of file + + + + + + + + + + \ No newline at end of file diff --git a/image_grabber.php b/image_grabber.php new file mode 100644 index 0000000..ed82256 --- /dev/null +++ b/image_grabber.php @@ -0,0 +1,17 @@ + SENTRY_DSN, - // Specify a fixed sample rate - 'traces_sample_rate' => 1.0, - // Set a sampling rate for profiling - this is relative to traces_sample_rate - 'profiles_sample_rate' => 1.0, -]); - -function does_variable_exists( $variable ) { - return (isset($$variable)) ? "true" : "false"; -} +skip_cookie: $host_string = $_SERVER['HTTP_HOST']; $host = explode('.', $host_string); @@ -45,6 +55,45 @@ if (str_ends_with($path,'/') && $path != "/") { exit; } $uri = array_values(array_filter(explode('/', $uri_string))); +try { + if ($_SESSION['auth']) { + $user = db_execute("SELECT * FROM `accounts` WHERE id = ? LIMIT 1", [$_SESSION['id']]); + if (!$user) { + // Account doesn't exist. Log the user out. + + // We won't redirect to the logout endpoint because if this is going off there's something + // broken anyway. + session_destroy(); + die("Your session was invalid so we've logged you out."); + } + } +} +catch (Exception) { + echo('
    Database is broken. Please tell an admin.
    '); + if ($uri_string == "/admin/init/database") { // Allows access to this page even if user doesn't have admin rights + // because you can't check the rights. + echo "
    "; + include "admin_initdatabase.php"; + die ("
    "); + + } +} + + +if (defined("SENTRY_DSN")) { + \Sentry\init([ + 'dsn' => SENTRY_DSN, + // Specify a fixed sample rate + 'traces_sample_rate' => 1.0, + // Set a sampling rate for profiling - this is relative to traces_sample_rate + 'profiles_sample_rate' => 1.0, + ]); +} + + +function does_variable_exists( $variable ) { + return (isset($$variable)) ? "true" : "false"; +} if(isset($query_string[1])) { $uri_string = $query_string[0]; @@ -65,29 +114,54 @@ $include = "404.html"; $paths = array( "/" => ["landing.php"], + "/admin" => ['admin.php'], "/admin/init/database" => ["admin_initdatabase.php"], "/admin/list/accounts" => ["admin_accounts.php"], "/admin/list/apps" => ["admin_apps.php"], "/admin/create/app" => ["admin_apps_create.php"], + "/admin/create/token" => ["admin_create_token.php"], + "/admin/signinas" => ["signinas.php"], + "/admin/purge" => ["admin_purge.php"], + + // Settings + "/dashboard" => ["dashboard.php", "Dashboard"], + "/settings" => ["settings.php", "Settings"], + "/settings/account" => ["settings_account.php", "Settings -> Account"], "/account" => ["account.php", "Your account"], "/signin" => ["signin.php", "Sign in"], "/signup" => ["signup.php", "Sign up"], "/signout" => ["signout.php", "Signed out"], "/forgot/password" => ["forgot_password.php", "Forgot password"], - "/admin/signinas" => ["signinas.php"], "/reset/password" => ["reset_password.php", "Reset password"], "/docs" => ["docs.php", "Docs"], - "/credits" => ["credits.html", "Credits"], + "/credits" => ["credits.php", "Credits"], "/profile" => ["profile.php", "Profile"], + + "/signin/external/basic" => ["login_external_basic.php"] ); +if (!empty($uri) ) { // Go to jail. Go directly to jail. Do not pass Go. + if ($uri[0] == "api") { + include("api_handler.php"); + exit(); // fuck this shit i'm out + } + if ($uri[0] == "public" && $uri[1] == "avatars") { + include("image_grabber.php"); + exit(); + } +} + +$migrated = false; if (isset($paths[$path])) { $include = $paths[$path][0]; if (isset($paths[$path][1])) { $doc_title = $paths[$path][1]; } + if (isset($paths[$path][2])) { + $migrated = $paths[$path][2]; + } } else { @@ -95,6 +169,12 @@ else { http_response_code(404); } + +if ($migrated) { + $output = ""; + + include($include); +} ?> @@ -105,8 +185,7 @@ else {
    - "); + die("A cat standing in front of a door with a No Cats Allowed sign on it."); } + if ($uri[0] == "docs") { $include = "docs.php"; } } - - include($include); ?> + if ($migrated) { + echo $output; + } + else { + include ($include); + } + ?>
    - \ No newline at end of file + diff --git a/landing.php b/landing.php index 6e59f94..c4769b4 100644 --- a/landing.php +++ b/landing.php @@ -1,14 +1,38 @@ + +
    - +

    ByeCorps ID

    Log into ByeCorps and beyond with a single ID.

    - Manage account"; } - else { echo "Sign inCreate an account"; } + Manage account"; } + else { echo "Sign inCreate an account"; } ?>
    -
    \ No newline at end of file +
+ + + +
+
+ +

ByeCorps ID

+

Log into ByeCorps and beyond with a single ID.

+
+ diff --git a/login_external_basic.php b/login_external_basic.php new file mode 100644 index 0000000..2a1c68c --- /dev/null +++ b/login_external_basic.php @@ -0,0 +1,163 @@ + + ?", + [$_SESSION['id'], "basic", $app_id, time()]); + + if (sizeof($valid_tokens) > 0) { + print_r($valid_tokens); + + $token = $valid_tokens[0]; + + header('Location: '. $_GET['callback'].'?access_token='.$token['access_token'].'&refresh='.$token['refresh_token'] + .'&expiry='.$token['expiry']); + exit(); + } + +// if (validate_access_token()) + + +} + +if ($_SERVER['REQUEST_METHOD'] === 'POST') { + // Here's a few easy steps to figure out if we should give the other party a token or not. +// print_r($_POST); + + // First: match the session ids. If they aren't the same it's probably Not Ok. + if (session_id() != $_POST['sessionid']) { + echo "

401 Unauthorised

You are not permitted to view this content.

"; + exit(401); + } + + // Now let's determine if we're logged in or not. We can use the session for this, and verify using the + // `bcid` value (which only appears if youre logged in!!!) + if ($_SESSION['auth']) { + if (null == $_POST['bcid'] || $_SESSION['id'] != $_POST['bcid']) { + // Both of these suggest tampering, + // let's log the user out and throw an error. + $_SESSION['auth'] = false; + $_SESSION['id'] = null; + + $flash = "Sorry, something went wrong. Please sign in again."; + + goto login; + } + } + else { // of course, there's also the case that you WERENT logged in. Let's verify if you're logged in or not. + $user_db_version = db_execute("SELECT * FROM accounts WHERE email = ?", [$_POST['email']]); + if (!password_verify($_POST['password'], $user_db_version['password']) || null == $user_db_version) { + // INCORRECT PASSWORD!!!! + // or the account doesn't exist. we don't care either way. + + $flash = "Incorrect email or password."; + } else { + // if it's correct, we'll still force them to click log in again anyway. I'll also be nice and set the + // cookies properly. + + $_SESSION['id'] = $user_db_version['id']; + $_SESSION['auth'] = true; + $user = $user_db_version; + goto login; + } + } + + // The following gets run assuming we know the client is the one CLICKING the button. + $tokens = generate_basic_access_token($_POST['bcid'], $app_id); + + header('Location: '. $_POST['callback'].'?access_token='.$tokens['access'].'&refresh='.$tokens['refresh'] + .'&expiry='.$tokens['expiry']); + exit(); + +} + +login: + +?> + +
+ +
+ <?= htmlspecialchars($user['display_name']) ?>'s avatar + × + <?= htmlspecialchars($user['title']) ?>'s avatar +
+

Sign into

+

Owned by

+ + + +

Something went wrong!

+

Server returned error:
$error[0] (HTTP response code $error[1])

+
+"; + goto dont_show_form; + } + ?> +

uses ByeCorps ID for authentication.

+

Please double-check the information and avoid signing in with your BCID if you do not trust this app.

+

Please confirm that you'd like to sign into .

+ $flash

"; + } else { + echo "
"; + } + ?> + + + "; + echo "

You are signed in as ". get_display_name($_SESSION['id'], + put_bcid_in_parenthesis: true) . ". Not you?."; + goto signedin; } ?> +

You will need to sign in first.

+ + + + +

+ You will be brought to . +
will be able to see your email and display name. +

+ + + + +
diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..14766c7 --- /dev/null +++ b/manifest.json @@ -0,0 +1,34 @@ +{ + "name": "ByeCorps ID", + "short_name": "ByeCorps ID", + "start_url": "/?pwa=true", + + "display": "minimal-ui", + + "icons": [ + { + "src": "/assets/icons/manifest-icon-192.maskable.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "any" + }, + { + "src": "/assets/icons/manifest-icon-192.maskable.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "maskable" + }, + { + "src": "/assets/icons/manifest-icon-512.maskable.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "any" + }, + { + "src": "/assets/icons/manifest-icon-512.maskable.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "maskable" + } + ] +} \ No newline at end of file diff --git a/profile.php b/profile.php index 0c38e6c..71ac284 100644 --- a/profile.php +++ b/profile.php @@ -1,64 +1,23 @@ - + "0000000", + "id" => "9999999", "public_display_name" => false, "public_avatar" => false, "description" => null, ]; } -$avatar = "https://cdn.byecorps.com/id/profile/default.png"; -$display_name = ""; - -if ($_SESSION['id'] != $profile['id']) { - if ($profile['public_avatar']) { - $avatar = get_avatar_url($profile['id']); - } - if ($profile['public_display_name']) { - $display_name = get_display_name($profile['id'], false); - } -} else { - $avatar = get_avatar_url($profile['id']); - $display_name = get_display_name($profile['id'], false); -} - - - ?> -
- Avatar -
-
-
-
-
- -
-
-

Badges

-
- -
-

Info

- - - - - - -
Joined
- -
-
diff --git a/settings.php b/settings.php new file mode 100644 index 0000000..13d3d3a --- /dev/null +++ b/settings.php @@ -0,0 +1,44 @@ + + + + +
+
+
+ /> +
+
+ + +
+
+ + +
diff --git a/settings_account.php b/settings_account.php new file mode 100644 index 0000000..08cf72f --- /dev/null +++ b/settings_account.php @@ -0,0 +1,79 @@ + + + + +
+
+
+ <?= htmlspecialchars(get_display_name($user['id'])) ?>'s avatar +
+
+ + +
+
+ +
+

Account

+
+
+ + +
+ + +
+
+
+ + + + diff --git a/signin.php b/signin.php index 6de8f74..0574d99 100644 --- a/signin.php +++ b/signin.php @@ -1,7 +1,7 @@ "; -// var_dump($user); -// var_dump($_SESSION); -// die(); } exit; @@ -44,17 +53,21 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { ?> -

Sign in to ByeCorps ID

-$message
"; -}?> -
- - - -
+
+

Sign in to ByeCorps ID

+ $message
"; + }?> + -

- Forgot password? • New? Register for a ByeCorps ID. -

\ No newline at end of file +

+ Forgot password? • New? Sign up for a ByeCorps ID. +

+
diff --git a/signout.php b/signout.php index c128d18..03f7dbe 100644 --- a/signout.php +++ b/signout.php @@ -2,6 +2,7 @@ $_SESSION['id'] = null; $_SESSION['auth'] = false; +setcookie('keep_me_logged_in', '', time()-3600); session_destroy(); ?> diff --git a/signup.php b/signup.php index 13fc42e..612426a 100644 --- a/signup.php +++ b/signup.php @@ -55,7 +55,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {

Sign up for ByeCorps ID

- - + +
\ No newline at end of file diff --git a/styles/colours.css b/styles/colours.css index f11cb97..b346a2f 100644 --- a/styles/colours.css +++ b/styles/colours.css @@ -24,9 +24,16 @@ --grey-8: #343a40; --grey-9: #212529; + --error-color: var(--red-5); + --background: white; --background-dark: #121212; + --foreground: black; + --foreground-dark: white; + + --chip-background: var(--grey-0); + color-scheme: light dark; } @@ -101,9 +108,27 @@ input[data-com-onepassword-filled="dark"] { margin: 0; } +.flash { + background: var(--red-5); + color: black; +} + +.fg-error { + color: var(--error-color); +} + @media screen and (prefers-color-scheme: dark) { + :root { + --background: #121212; + --foreground: white; + + --chip-background: var(--grey-9); + + color-scheme: light dark; + } + html { - background: var(--background-dark, #121212); + background: var(--background, #121212); } button.primary, .button.primary { @@ -121,7 +146,6 @@ input[data-com-onepassword-filled="dark"] { } input, textarea { - background-color: #2c2c2c77; } diff --git a/styles/design.css b/styles/design.css index acdac55..0d5d2d8 100644 --- a/styles/design.css +++ b/styles/design.css @@ -15,9 +15,9 @@ button, .button { cursor: pointer; } -header a { - text-decoration: none; -} +/*header a {*/ +/* text-decoration: underline;*/ +/*}*/ /* inputs */ @@ -46,6 +46,11 @@ input:disabled { cursor: not-allowed; } +.flash { + padding: 1rem; + border-radius: 1rem; +} + table { background-color: var(--grey-2); width: 100%; @@ -67,6 +72,23 @@ table > tbody > tr > td { padding: .5em; } +#connection_img { + display: flex; + gap: 1rem; + + justify-content: center; +} + +#connection_img img { + height:7.5rem; + border-radius: 50%; +} + +#connection_img .sep { + font-size: 4rem; + align-self: center; +} + @media screen and (prefers-color-scheme: dark) { table { background-color: var(--grey-9); diff --git a/styles/global.css b/styles/global.css index c689015..adf6fc5 100644 --- a/styles/global.css +++ b/styles/global.css @@ -9,10 +9,10 @@ } body::after { - content: "Development: Subject To Change"; + content: "BETA"; position: fixed; - top: 4.5rem; - right: -1rem; + top: 5rem; + right: 1rem; text-align: right; font-size: 2.5rem; diff --git a/styles/layout.css b/styles/layout.css index 03d20f2..9e89277 100644 --- a/styles/layout.css +++ b/styles/layout.css @@ -148,3 +148,8 @@ form { display: flex; } +#loginform { + max-width: 500px; + margin: auto; +} + diff --git a/styles/profiles.css b/styles/profiles.css index 147c159..d5b4f78 100644 --- a/styles/profiles.css +++ b/styles/profiles.css @@ -1,6 +1,14 @@ #profile { display: flex; +} + +#profile .avatar { + height: 150px; +} + +#mini_profile { + display: flex; gap: 1rem; padding: 1rem; width: 750px; @@ -12,18 +20,18 @@ background: var(--grey-0); } -#profile > .avatar { +#mini_profile > .avatar { height: 150px; border-radius: 1em; } -#profile > .info > .displayname { +#mini_profile > .info > .displayname { font-size: 2.5rem; font-weight: bolder; } -#profile > .info > .bcid { +#mini_profile > .info > .bcid { font-size: 1.5rem; } @@ -32,8 +40,38 @@ grid-template-columns: 3fr 1fr; } +#badges { + display: grid; + grid-template-columns: repeat(auto-fit, 1fr); + gap: 0.5rem; +} + +#badges .badge { + display: flex; + align-items: center; + + gap: 1rem; +} + +.badge .details { + display: flex; + flex-direction: column; +} + +.badge img { + height: 7.5em; + width: 7.5em; + object-fit: contain; + border-radius: 1em; +} + +.badge .details .title { + font-size: 1.5rem; + font-weight: 700; +} + @media screen and (prefers-color-scheme: dark) { - #profile { + #mini_profile { background: var(--grey-9); } } diff --git a/styles/settings.css b/styles/settings.css new file mode 100644 index 0000000..95d424e --- /dev/null +++ b/styles/settings.css @@ -0,0 +1,140 @@ + +main { + display: flex; +} + +#settings_split { + display: grid; + grid-template-columns: 1fr 3fr; + gap: 1rem; +} + +#mini_profile { + display: flex; + flex-direction: column; + + border-radius: 1.5rem; + overflow: clip; + + padding-bottom: 1.5rem; + + background: var(--background); +} + +#mini_profile .image_container { + display: flex; + background: linear-gradient(to bottom, white, var(--background) 95%); +} + +#mini_profile .image_container img { + width: 50%; + margin: 0.5rem auto 0.5rem; + border-radius: 1rem; +} + +#mini_profile .texts { + text-align: center; + display: flex; + flex-direction: column; +} + +#mini_profile .texts .displayname { + font-size: 2rem; + font-weight: bold; +} + +#settings_list { + list-style: none; +} + +#settings_list > h1 { + margin: 0 0 1rem 0; +} + +#settings_list li { + border-top: var(--foreground) 1px solid; +} + +#settings_list li:first-child { + border-top: none; +} + +#settings_list li > a { + display: block; + padding: 1rem 0; + + color: var(--foreground); + text-decoration: none; + + transition: color 0.2s ease-in-out; +} + +#settings_list li > a:hover { + color: var(--flax) +} + +.tiles { + display: grid; + gap: 1rem; + grid-template-columns: repeat(3, 1fr); + grid-template-rows: 150px; + grid-auto-flow: dense; +} + +.tiles .tile { + background: #343a40; + text-align: center; + display: flex; + text-decoration: none; + + font-size: 1.2rem; + font-weight: 500; + + border-radius: 1.5rem; + + transition: scale 0.2s ease-in-out; +} + +.tiles .tile:hover { + scale: 1.05; +} + +.tiles .tile div { + margin: auto; +} + +.tiles .tile span { + display: block; +} + +.tile.double-height { + grid-row: span 2; +} + +@media screen and (max-width: 960px) { + #settings_split { + grid-template-columns: none; + } + + #mini_profile { + flex-direction: row; + padding-bottom: 0; + } + + #mini_profile .image_container { + width: 40%; + background: linear-gradient(to right, white, var(--chip-background) 95%); + } + + #mini_profile .image_container img { + margin: 1rem; + border-radius: 1rem; + } + + #mini_profile .texts { + flex: 1; + margin: auto auto auto 0; + text-align: left; + } +} + diff --git a/styles/types.css b/styles/types.css index 7b09f26..2861f85 100644 --- a/styles/types.css +++ b/styles/types.css @@ -1,7 +1,7 @@ /* This file deals with font types and font families. */ -@import url(https://fonts.bunny.net/css?family=montserrat:400,400i,600,600i,700,700i,900,900i); -@import url(https://fonts.bunny.net/css2?family=courier+prime:wght@400;700&display=swap); /* for BCIDs */ +@import url(https://fonts.bunny.net/css?family=montserrat:400,400i,500,600,600i,700,700i,900,900i); +@import url(https://fonts.bunny.net/css2?family=Space+Mono:wght@400;700&display=swap); /* for BCIDs */ @import url(/fontawesome/css/all.css); @@ -39,13 +39,23 @@ h2.subheading + h1 { } .bcid { - font-family: 'Courier Prime', monospace; + font-family: 'Space Mono', monospace; +} + +.subtitle { + font-size: 0.9rem; + margin: 0; + opacity: 0.8; } .center { text-align: center; } +.vertical-center { + vertical-align: center; +} + .icon-true::before { content: "\f00c"; } @@ -53,3 +63,28 @@ h2.subheading + h1 { .icon-false::before { content: "\f00d"; } + +.space-mono-regular { + font-family: "Space Mono", monospace; + font-weight: 400; + font-style: normal; +} + +.space-mono-regular-italic { + font-family: "Space Mono", monospace; + font-weight: 400; + font-style: italic; +} + +.space-mono-bold { + font-family: "Space Mono", monospace; + font-weight: 700; + font-style: normal; +} + +.space-mono-bold-italic { + font-family: "Space Mono", monospace; + font-weight: 700; + font-style: italic; +} +