获取PlayStation NPSSO token的方法

方法1 在 https://www.playstation.com/ 登录你的账号(无需切换区域) 访问 https://ca.account.sony.com/api/v1/ssocookie 如果成功会出现npsso: '64位字符' 引号中的64位字符,即为NPSSO授权码。 由于频繁使用方法1可能会遭到Sony防御显示HTTP Status 429 – Too Many Requests,可使用方法2获取token: 方法2 访问 https://account.sonyentertainmentnetwork.com/ 并登录你的账号 使用F12或 Ctrl+Shift+J 打开浏览器控制台 复制并粘贴以下代码到控制台并回车 (function(open) { XMLHttpRequest.prototype.open = function(method, url, async, user, pass) { this.addEventListener("readystatechange", function() { if (this.readyState == XMLHttpRequest.DONE) { let response = JSON.parse(this.responseText); if (response && "npsso" in response) { console.log('found npsso', response.npsso); } } }, false); open.call(this, method, url, async, user, pass); }; window.onbeforeunload = function(){ return 'Are you sure you want to leave?'; }; })(XMLHttpRequest.prototype.open); 左侧菜单中点击“个人资料” 控制台如果出现found npsso +<64位代码> 即为成功。

2024-08-12 · 1 min · Duke Yin

WordPress 将Debug写入文件

在wp-config中打开debug后,出错会直接显示在前端,但这会影响成品站点的用户体验,添加如下两个定义后可以不显示在前端,并且记录在wp-content/debug.log中。 define( 'WP_DEBUG_LOG', true ); define( 'WP_DEBUG_DISPLAY', false ); 但是由于WordPress内核本身年代久远,如果你使用新的PHP版本比如8,log将会记录大量由WordPress本身造成的deprecated的提示,虽然官方文档针对log的等级可以用如下来设置: error_reporting( E_ALL & ~E_DEPRECATED ); 但是由于wp-config加载比较靠前,错误报告设置极大可能会被后面的某一些项给改写。我尝试过在新安装的WordPress中,剔除Depreacated信息都是不起作用的。 所以有了如下解决方案: define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', true ); define( 'WP_DEBUG_DISPLAY', false ); $GLOBALS['wp_filter'] = array( 'enable_wp_debug_mode_checks' => array( 10 => array( array( 'accepted_args' => 0, 'function' => function () { if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { // *** This is the key line - change to adjust to whatever logging state you want error_reporting( E_ALL & ~E_DEPRECATED ); ini_set( 'display_errors', defined( 'WP_DEBUG_DISPLAY' ) &amp;&amp; WP_DEBUG_DISPLAY ? 1 : 0 ); if ( in_array( strtolower( (string) WP_DEBUG_LOG ), array( 'true', '1' ), true ) ) { $log_path = WP_CONTENT_DIR . '/debug.log'; } elseif ( is_string( WP_DEBUG_LOG ) ) { $log_path = WP_DEBUG_LOG; } else { $log_path = false; } if ( $log_path ) { ini_set( 'log_errors', 1 ); ini_set( 'error_log', $log_path ); } if ( defined( 'XMLRPC_REQUEST' ) || defined( 'REST_REQUEST' ) || defined( 'MS_FILES_REQUEST' ) || ( defined( 'WP_INSTALLING' ) &amp;&amp; WP_INSTALLING ) || wp_doing_ajax() || wp_is_json_request() ) { ini_set( 'display_errors', 0 ); } } return false; }, ), ), ));</code></pre> 使用wp_filter去处理,不会被覆写,有多种情况处理,log文件不记录depracated信息,甚至你可以根据自己的需求去编辑log等级。

2024-07-29 · 1 min · Duke Yin

纯JavaSript 读取 写入Cookie

通常会推荐安装jquery-cookie插件,但是本着尽量少依赖的原则,根本不需要更多臃肿的依赖,使用两个function即可解决读写cookie: 读取Cookie: const getCookieValue = (name) => ( document.cookie.match('(^|;)\\s*' + name + '\\s*=\\s*([^;]+)')?.pop() || '' ) 写入Cookie const setCookie = (name, value, days = 7, path = '/') => { const expires = new Date(Date.now() + days * 864e5).toUTCString() document.cookie = name + '=' + encodeURIComponent(value) + '; expires=' + expires + '; path=' + path } 读取cookie用到了正则表达,方程非常简洁。

2024-07-18 · 1 min · Duke Yin

CentOS7 安装Docker 安装Nginx Proxy Manager

防火墙放行端口: sudo firewall-cmd --permanent --add-service=http sudo firewall-cmd --permanent --add-service=https sudo firewall-cmd --permanent --add-port=81/tcp 重载防火墙 sudo firewall-cmd --reload 尝试卸载旧版Docker sudo yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-engine 如果没有旧版 会提示没安装 安装yum-utils,并使用yum-config-manager设置docker仓库 sudo yum install -y yum-utils sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo 安装Docker引擎(最新版) ...

2024-03-14 · 2 min · Duke Yin

禁止Edge桌面搜索栏和新标签页广告

将以下内容存储为 .reg 文件,并选择合并进注册表即可。 REGEDIT4 [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Edge] ;桌面搜索栏 “WebWidgetAllowed”=dword:00000000 ;新标签页广告 “NewTabPageContentEnabled”=dword:00000000 可以禁止Edge开启桌面搜索栏,以及新标签页的广告。

2023-08-05 · 1 min · Duke Yin

WinSCP典型批处理脚本

使用WinSCP有一个技巧是,可以把FTP动作存为一个脚本,日后如果需要重复这个FTP操作,就只需要运行脚本就可以。 如果我们可以自己写脚本,那就很方便了。 例如,我要把本地文件夹 c:\files\abcd 文件夹上传到两个服务器, 服务器1,firstserver.com目标为 /docker/file/abcd/, 服务器2,secondserver.com目标为 /www/file/abcd/, 并且 只上传新的修改过的,文件一致就跳过(-neweronly), 不上传隐藏文件(ExcludeHiddenFiles=1), 不上传.git .gitattributes等git配置文件(-filemask=""| .gitattributes; .git/""), 那么脚本就可以这么写: @echo off “C:\Program Files (x86)\WinSCP\WinSCP.com” ^ /log=“D:\WinSCP.log” /ini=nul ^ /command ^ “open ftp://user1:[email protected]/ -rawsettings Utf=1 ProxyPort=0” ^ “lcd c:\files” ^ “cd /docker/file/” ^ “put -filemask=”"| .gitattributes; .git/"" -neweronly -rawtransfersettings[1] ExcludeHiddenFiles=1 abcd" ^ “open ftp://user2:[email protected] -rawsettings Utf=1 ProxyPort=0” ^ “lcd c:\files” ^ “cd /www/file/” ^ “put -filemask=”"| .gitattributes; .git/"" -neweronly -rawtransfersettings[1] ExcludeHiddenFiles=1 abcd" ^ “exit” ...

2023-07-30 · 1 min · Duke Yin

SteamGridDB API

Base URL https://www.steamgriddb.com/api/v2 Authorization header Authorization: Bearer <token> endpoints https://www.steamgriddb.com/api/v2/games/id/{gameId} //Retrieve game by game ID. https://www.steamgriddb.com/api/v2/games/steam/{steamAppId} //Retrieve game by Steam App ID. https://www.steamgriddb.com/api/v2/grids/game/{gameId} //Retrieve grids by game ID. https://www.steamgriddb.com/api/v2/grids/{platform}/{id*} //Retrieve grids by platform ID. https://www.steamgriddb.com/api/v2/heroes/game/{gameId} //Retrieve heroes by game ID. ...

2023-06-15 · 1 min · Duke Yin

IGDB API Documents

from: https://api-docs.igdb.com/ Getting Started One of the principles behind IGDB.com is accessibility of data. We wish to share the data with anyone who wants to build cool video game oriented websites, apps and services. This means that you are not only contributing to the value of IGDB but to thousands of other projects as well. We are looking forward to see what exciting game related projects you come up with. Happy coding! ...

2023-06-14 · 45 min · Duke Yin

PlayStaiton API

商店 获取游戏商店TITlE信息 https://store.playstation.com/store/api/chihiro/00_09_000/titlecontainer/US/en/999/{GAME_ID} 示范 https://store.playstation.com/store/api/chihiro/00_09_000/titlecontainer/US/en/999/CUSA08283_00 港服 https://store.playstation.com/store/api/chihiro/00_09_000/titlecontainer/HK/zh/999/CUSA08283_00 商店详细信息 https://store.playstation.com/store/api/chihiro/00_09_000/container/{Region}/{lang}/999/{GMAE_ID_FULL} 示范:https://store.playstation.com/store/api/chihiro/00_09_000/container/HK/zh/999/UP0082-CUSA08283_00-ASIA000000000000 zh简体中文 ch繁体中文 搜索商店 https://store.playstation.com/store/api/chihiro/00_09_000/tumbler/{country}/{language}/{age}/{searchString} 以关键词搜索商店游戏,例如: https://store.playstation.com/store/api/chihiro/00_09_000/tumbler/ae/ar/999/? size=1& start=0& sort=release_date& direction=asc& gameContentType=games& gameDemo=false& price=100& genre=unique& topCategory=downloadable_game& game_type=ps4_full_games 图像 https://store.playstation.com/store/api/chihiro/00_09_000/container/{country}/{language}/{age}/{cusa}/image 例如 https://store.playstation.com/store/api/chihiro/00_09_000/container/ae/ar/999/CUSA07187_00/image? w=500& h=500& opacity=100 商店国家地区信息 https://store.playstation.com/kamaji/api/chihiro/00_09_000/geo 回应: { "header": { "status_code": "0x0000", "message_key": "success", "details": null, "errorUUID": null }, "data": "HK", "postal_code": null, "timezone": "GMT+8" }

2023-06-04 · 1 min · Duke Yin

SteamWeb API 整理

输出格式 json xml vdf 变量 {appid} App ID eg 440 {steamid} Steam id for user eg 76561197960435530 {steamids} Steam ids for user eg 76561197960435530,76561197960435532 {key} Steam web api key eg XXXXXXXXXXXXXXXXXXXXXXX {format} json,xml,vdf default is json {language} language, default is english 获取指定APP全球成就状态 https://api.steampowered.com/ISteamUserStats/GetGlobalAchievementPercentagesForApp/v0001/ ?gameid={appid} &format={format} https://api.steampowered.com/ISteamUserStats/GetGlobalAchievementPercentagesForApp/v0002/ ?gameid={appid} &format={format} 返回成就列表及各成就百分比 ...

2023-05-20 · 2 min · Duke Yin