refactor: message listeners (#447)

* Refactor API imports and update API endpoints

* Fix variable naming in FavoritesPop and Favorites components

* Fix variable naming inconsistency in getHistoryList function

* Fix API parameter naming conventions

* Refactor API_AUTH afterHandle functions

* Add API documentation links  and add function to be the api item

* Refactor API body and params

* Remove unused getAccessKey function in auth.ts

---------

Co-authored-by: pengyunfei <pengyunfei@360.cn>
Co-authored-by: Hakadao <a578457889743@gmail.com>
This commit is contained in:
cloudflypeng
2024-04-02 00:41:58 +08:00
committed by GitHub
parent 41a463dbaf
commit 433a2ed4cf
22 changed files with 509 additions and 538 deletions

View File

@@ -79,7 +79,7 @@ async function getFollowedUsersVideos() {
contentScriptQuery: 'getMoments',
type: 'video',
offset: offset.value,
updateBaseline: updateBaseline.value,
update_baseline: updateBaseline.value,
})
if (response.code === -101) {

View File

@@ -117,7 +117,7 @@ async function getRecommendVideos() {
try {
const response: forYouResult = await browser.runtime.sendMessage({
contentScriptQuery: 'getRecommendVideos',
refreshIdx: refreshIdx.value++,
fresh_idx: refreshIdx.value++,
})
if (!response.data) {
@@ -157,9 +157,9 @@ async function getAppRecommendVideos() {
try {
const response: AppForYouResult = await browser.runtime.sendMessage({
contentScriptQuery: 'getAppRecommendVideos',
accessKey: accessKey.value,
sLocale: settings.value.language !== LanguageType.Mandarin_CN ? 'zh-Hant_TW' : 'zh-Hans_CN',
cLocale: settings.value.language !== LanguageType.Mandarin_CN ? 'zh-Hant_TW' : 'zh-Hans_CN',
access_key: accessKey.value,
s_locale: settings.value.language !== LanguageType.Mandarin_CN ? 'zh-Hant_TW' : 'zh-Hans_CN',
c_locale: settings.value.language !== LanguageType.Mandarin_CN ? 'zh-Hant_TW' : 'zh-Hans_CN',
appkey: TVAppKey.appkey,
idx: appVideoList.length > 0 ? appVideoList[appVideoList.length - 1].idx : 1,
})

View File

@@ -140,7 +140,7 @@ function getRankingPgc() {
isLoading.value = true
browser.runtime.sendMessage({
contentScriptQuery: 'getRankingPgc',
seasonType: activatedRankingType.value.seasonType,
season_type: activatedRankingType.value.seasonType,
}).then((response: RankingPgcResult) => {
if (response.code === 0)
Object.assign(PgcList, response.result.list)

View File

@@ -84,7 +84,7 @@ async function getFollowedUsersVideos() {
contentScriptQuery: 'getMoments',
type: 'pgc',
offset: offset.value,
updateBaseline: updateBaseline.value,
update_baseline: updateBaseline.value,
})
if (response.code === -101) {