-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #413 from leepeuker/add-plex-oauth
Add Plex OAuth
- Loading branch information
Showing
33 changed files
with
1,317 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
db/migrations/mysql/20230627162519_AddPlexOAuthColumnsToUserTable.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php declare(strict_types=1); | ||
|
||
use Phinx\Migration\AbstractMigration; | ||
|
||
final class AddPlexOAuthColumnsToUserTable extends AbstractMigration | ||
{ | ||
public function down() : void | ||
{ | ||
$this->execute( | ||
<<<SQL | ||
ALTER TABLE user DROP COLUMN plex_client_id; | ||
ALTER TABLE user DROP COLUMN plex_client_temporary_code; | ||
ALTER TABLE user DROP COLUMN plex_access_token; | ||
ALTER TABLE user DROP COLUMN plex_account_id; | ||
ALTER TABLE user DROP COLUMN plex_server_url; | ||
SQL, | ||
); | ||
} | ||
|
||
public function up() : void | ||
{ | ||
$this->execute( | ||
<<<SQL | ||
ALTER TABLE user ADD COLUMN plex_client_id CHAR(64) DEFAULT NULL AFTER trakt_client_id; | ||
ALTER TABLE user ADD COLUMN plex_client_temporary_code CHAR(64) DEFAULT NULL AFTER plex_client_id; | ||
ALTER TABLE user ADD COLUMN plex_access_token CHAR(128) DEFAULT NULL AFTER plex_client_temporary_code; | ||
ALTER TABLE user ADD COLUMN plex_account_id CHAR(64) DEFAULT NULL AFTER plex_access_token; | ||
ALTER TABLE user ADD COLUMN plex_server_url CHAR(128) DEFAULT NULL AFTER plex_account_id; | ||
SQL, | ||
); | ||
} | ||
} |
160 changes: 160 additions & 0 deletions
160
db/migrations/sqlite/20230627162519_AddPlexOAuthColumnsToUserTable.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
<?php declare(strict_types=1); | ||
|
||
use Phinx\Migration\AbstractMigration; | ||
|
||
final class AddPlexColumns extends AbstractMigration | ||
{ | ||
public function down() : void | ||
{ | ||
$this->execute( | ||
<<<SQL | ||
CREATE TABLE `tmp_user` ( | ||
`id` INTEGER, | ||
`email` TEXT NOT NULL, | ||
`name` TEXT NOT NULL, | ||
`password` TEXT NOT NULL , | ||
`is_admin` TINYINT(1) DEFAULT 0, | ||
`dashboard_visible_rows` TEXT DEFAULT NULL, | ||
`dashboard_extended_rows` TEXT DEFAULT NULL, | ||
`dashboard_order_rows` TEXT DEFAULT NULL, | ||
`privacy_level` INTEGER DEFAULT 1, | ||
`date_format_id` INTEGER DEFAULT 0, | ||
`trakt_user_name` TEXT, | ||
`plex_webhook_uuid` TEXT, | ||
`jellyfin_webhook_uuid` TEXT, | ||
`emby_webhook_uuid` TEXT, | ||
`trakt_client_id` TEXT, | ||
`jellyfin_scrobble_views` INTEGER DEFAULT 1, | ||
`emby_scrobble_views` INTEGER DEFAULT 1, | ||
`plex_scrobble_views` INTEGER DEFAULT 1, | ||
`plex_scrobble_ratings` INTEGER DEFAULT 0, | ||
`watchlist_automatic_removal_enabled` INTEGER DEFAULT 0, | ||
`core_account_changes_disabled` INTEGER DEFAULT 0, | ||
`created_at` TEXT NOT NULL, | ||
PRIMARY KEY (`id`), | ||
UNIQUE (`email`), | ||
UNIQUE (`name`) | ||
) | ||
SQL, | ||
); | ||
|
||
$this->execute( | ||
'INSERT INTO `tmp_user` ( | ||
`id`, | ||
`email`, | ||
`name`, | ||
`password`, | ||
`is_admin`, | ||
`dashboard_visible_rows`, | ||
`dashboard_extended_rows`, | ||
`dashboard_order_rows`, | ||
`privacy_level`, | ||
`date_format_id`, | ||
`trakt_user_name`, | ||
`plex_webhook_uuid`, | ||
`jellyfin_webhook_uuid`, | ||
`emby_webhook_uuid`, | ||
`trakt_client_id`, | ||
`jellyfin_scrobble_views`, | ||
`emby_scrobble_views`, | ||
`plex_scrobble_views`, | ||
`plex_scrobble_ratings`, | ||
`watchlist_automatic_removal_enabled`, | ||
`core_account_changes_disabled`, | ||
`created_at` | ||
) SELECT | ||
`id`, | ||
`email`, | ||
`name`, | ||
`password`, | ||
`is_admin`, | ||
`dashboard_visible_rows`, | ||
`dashboard_extended_rows`, | ||
`dashboard_order_rows`, | ||
`privacy_level`, | ||
`date_format_id`, | ||
`trakt_user_name`, | ||
`plex_webhook_uuid`, | ||
`jellyfin_webhook_uuid`, | ||
`emby_webhook_uuid`, | ||
`trakt_client_id`, | ||
`jellyfin_scrobble_views`, | ||
`emby_scrobble_views`, | ||
`plex_scrobble_views`, | ||
`plex_scrobble_ratings`, | ||
`watchlist_automatic_removal_enabled`, | ||
`core_account_changes_disabled`, | ||
`created_at` FROM user', | ||
); | ||
$this->execute('DROP TABLE `user`'); | ||
$this->execute('ALTER TABLE `tmp_user` RENAME TO `user`'); | ||
} | ||
|
||
public function up() : void | ||
{ | ||
$this->execute( | ||
<<<SQL | ||
CREATE TABLE `tmp_user` ( | ||
`id` INTEGER, | ||
`email` TEXT NOT NULL, | ||
`name` TEXT NOT NULL, | ||
`password` TEXT NOT NULL , | ||
`is_admin` TINYINT(1) DEFAULT 0, | ||
`dashboard_visible_rows` TEXT DEFAULT NULL, | ||
`dashboard_extended_rows` TEXT DEFAULT NULL, | ||
`dashboard_order_rows` TEXT DEFAULT NULL, | ||
`privacy_level` INTEGER DEFAULT 1, | ||
`date_format_id` INTEGER DEFAULT 0, | ||
`trakt_user_name` TEXT, | ||
`plex_webhook_uuid` TEXT, | ||
`jellyfin_webhook_uuid` TEXT, | ||
`emby_webhook_uuid` TEXT, | ||
`trakt_client_id` TEXT, | ||
`plex_client_id` TEXT DEFAULT NULL, | ||
`plex_client_temporary_code` TEXT DEFAULT NULL, | ||
`plex_access_token` TEXT DEFAULT NULL, | ||
`plex_account_id` TEXT DEFAULT NULL, | ||
`plex_server_url` TEXT DEFAULT NULL, | ||
`jellyfin_scrobble_views` INTEGER DEFAULT 1, | ||
`emby_scrobble_views` INTEGER DEFAULT 1, | ||
`plex_scrobble_views` INTEGER DEFAULT 1, | ||
`plex_scrobble_ratings` INTEGER DEFAULT 0, | ||
`watchlist_automatic_removal_enabled` INTEGER DEFAULT 0, | ||
`core_account_changes_disabled` INTEGER DEFAULT 0, | ||
`created_at` TEXT NOT NULL, | ||
PRIMARY KEY (`id`), | ||
UNIQUE (`email`), | ||
UNIQUE (`name`) | ||
) | ||
SQL, | ||
); | ||
$this->execute( | ||
'INSERT INTO `tmp_user` ( | ||
`id`, | ||
`email`, | ||
`name`, | ||
`password`, | ||
`is_admin`, | ||
`dashboard_visible_rows`, | ||
`dashboard_extended_rows`, | ||
`dashboard_order_rows`, | ||
`privacy_level`, | ||
`date_format_id`, | ||
`trakt_user_name`, | ||
`plex_webhook_uuid`, | ||
`jellyfin_webhook_uuid`, | ||
`emby_webhook_uuid`, | ||
`trakt_client_id`, | ||
`jellyfin_scrobble_views`, | ||
`emby_scrobble_views`, | ||
`plex_scrobble_views`, | ||
`plex_scrobble_ratings`, | ||
`watchlist_automatic_removal_enabled`, | ||
`core_account_changes_disabled`, | ||
`created_at` | ||
) SELECT * FROM user', | ||
); | ||
$this->execute('DROP TABLE `user`'); | ||
$this->execute('ALTER TABLE `tmp_user` RENAME TO `user`'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.