PR

【8/23】リクエストヘッダに応じてyamadaAPIを使用しない #1032

wada opened this at 2021-08-10T12:21:47; closed

Description

opened by wada at 2021-08-10T12:21:47; updated 2025-03-31T13:59:16

概要

PFで問題がある時にyamadaAPIを使用すると、エラーでアプリをプレイできないので、
リクエストヘッダにsapkey設定時、yamadaAPIを使用しない
所持コインは10万を基準にキャッシュで管理
(12時間保持して、時間切れで10万にリセット)

テスト方法、確認した内容

リクエストヘッダに以下をModHeaderなどで設定

sapkey: {使用したいsapkey}

他人のsapkeyを設定すると、そのユーザでプレイできます
登録していないsapkey(適当な文字列でも可)を設定すると、ユーザ登録されます
チュートリアルやデバッグ用ユーザの追加に利用してください

TODO

apiの戻り値は、使用していないものはnullかダミーデータを返しています
必要に応じてダミーデータ追加します

wada add_label at 2021-08-11T15:29:46: レビュー待ち
wada change_title at 2021-08-11T15:31:06: [WIP]リクエストヘッダに応じてyamadaAPIを使用しない リクエストヘッダに応じてyamadaAPIを使用しない
wada change_title at 2021-08-11T15:33:44: リクエストヘッダに応じてyamadaAPIを使用しない 【8/23】リクエストヘッダに応じてyamadaAPIを使用しない

Comment

#12908 by wada at 2021-08-11T15:38:56; updated 2021-08-11T15:38:56

@iwamoto @kouho
レビューお願いします。

実際にpfで問題が出ないと正しい効果は確認できないですが、
yamadaAPIを使用しないことで、デバッグで以下のメリットがあります。
・所持コイン数を改竄
・新規ユーザの登録が簡単
・他のユーザへの成り代わり

wada assign at 2021-08-11T15:40:26: Not assigned:wada

Comment

#13012 by wada at 2021-08-18T10:46:22; updated 2021-08-18T10:46:22

@iwamoto
S_yamada_GetUserDataBySapKeyの引数について、
使用している箇所は修正、使用していない箇所は削除しました。

Comment

#13067 by kouho at 2021-08-19T18:29:18; updated 2021-08-19T18:29:18

@wada
以下確認しました。動作は問題なかったです。

  • HTTP_SAPKEYにsapkeyを格納してのユーザーなりすまし
  • HTTP_SAPKEYにsapkeyを格納しての新規ユーザー登録
  • 所持コイン数の改鋳と使用
  • YamadaApiでエラー時に動作

exec_get, exec_postの関数で以下を強制的にreturnさせてゲームを動かしてみました

		return [
			'code' => 404,
			'info' => [],
			'data' => [],
		];

確認時に リクエストヘッダに以下をModHeaderなどで設定
こちらに手間取りましてMod Headerやその他のGoogle Chromeの拡張プラグインを使ってもヘッダーの書き換えができませんでした。最終的に/etc/nginx/conf.d/jrye-web.conf を直接書き換えることでヘッダーの書き換えに成功しました。
環境の違い等に起因するものかもしれませんが一応共有です。

kouho add_label at 2021-08-19T18:35:12: 皇甫 LGTM

Comment

#13080 by iwamoto at 2021-08-20T11:18:38; updated 2021-08-20T11:18:38

@wada
修正箇所確認しました大丈夫ですー

下記一通り確認しましたが、問題ないように思います。
・所持コイン数を改竄
・新規ユーザの登録が簡単
・他のユーザへの成り代わり

iwamoto add_label at 2021-08-20T11:19:10: 岩本 LGTM
wada close_comment at 2021-08-25T14:27:57: マージ済み
wada refer at 2022-03-28T14:23:13: 1686:[WIP]【3/30】基本のチュートリアルをスクロールに設定
wada refer at 2022-03-30T10:01:34: 1686:【3/30】基本のチュートリアルをスクロールに設定

commit comment

#81 by iwamoto at 2021-08-17T19:03:27; lib/class/platform/yamada/YamadaWithoutAPI.class.php / old:None new:55
47e7b7e4b91658b8760285179ecdf27f28525201

@wada
実処理では通っていないので、問題はないかもしれませんが…
checkTokenの引数($token)が使用されてません。
$token = $pt の間違いかと思われます。

commit comment

#82 by iwamoto at 2021-08-17T19:07:24; lib/class/platform/yamada/YamadaWithoutAPI.class.php / old:None new:71
ede42e6e53eeb5084aa0cc54a3b80e27aba86682

@wada
S_yamada_GetUserDataBySapKeyの引数間違いになります。

修正前は
`「他のユーザへの成り代わり」を行った際に
自分の島へ移動してしまうと、user_info.nicknameが "名無し" に上書きされる` 状態になっていました

Commit range

base554b135e4624f7d3866f0a49e9e25812307abbf8
head47e7b7e4b91658b8760285179ecdf27f28525201
base branchjolly/jr-web:develop
head branchjolly/jr-web:without_pf

View commits

Commit details are loaded from Git when a dynamic archive server is running, or can be embedded with --include-commits.
Files changed59 filesView patch
statusfile
modifiedlib/SubFunc.inc
modifiedlib/SubFunc/SubFunc_yamada.inc
modifiedlib/class/platform/yamada/YamadaPlatformService.class.php
addedlib/class/platform/yamada/YamadaWithoutAPI.class.php
modifiedlib/conf/class/RaidMonsterConfig.class.php
modifiedlib/conf/class/RaidMonsterTypeConfig.class.php
modifiedlib/conf/define_y.inc
modifiedlib/exec/tool_monthly_user_ltv.inc
modifiedlib/exec/tool_monthly_user_ltv.sh
modifiedlib/exec/tool_monthly_user_ltv_cron.inc
modifiedlib/models/Yamada_point_quest.php
modifiedlib/models/dao/master_yamada_campaign.php
modifiedlib/public/Location.inc
addedpublic_html/img/banner/build_10008_1_1.jpg
addedpublic_html/img/banner/build_10008_1_2.jpg
addedpublic_html/img/banner/build_10008_2_1.jpg
addedpublic_html/img/banner/build_10008_2_2.jpg
addedpublic_html/img/info_event/info_event_250_1.jpg
addedpublic_html/img/info_event/info_event_250_2.jpg
addedpublic_html/img/info_event/info_event_251_1.jpg
addedpublic_html/img/info_event/info_event_251_2.jpg
addedpublic_html/img/info_jrye/887/info1.jpg
addedpublic_html/img/info_jrye/887/info2.jpg
addedpublic_html/img/info_jrye/887/info3.jpg
addedpublic_html/img/info_jrye/887/info4.jpg
addedpublic_html/img/info_jrye/887/info5.jpg
addedpublic_html/img/info_jrye/887/info6.jpg
addedpublic_html/img/info_jrye/887/info7.jpg
addedpublic_html/img/info_jrye/888/info1.jpg
addedpublic_html/img/info_jrye/888/info1_end.jpg
addedpublic_html/img/info_jrye/888/info2.jpg
addedpublic_html/img/info_jrye/888/info3.jpg
addedpublic_html/img/info_jrye/888/info4.jpg
addedpublic_html/img/info_jrye/888/info4_1.jpg
addedpublic_html/img/info_jrye/889/info2_1.jpg
addedpublic_html/img/info_jrye/889/info2_2.jpg
addedpublic_html/img/info_jrye/889/info2_3.jpg
addedpublic_html/img/info_jrye/889/info4.jpg
addedpublic_html/img/info_jrye/889/info5.jpg
addedpublic_html/img/info_jrye/889/info6.jpg
addedpublic_html/img/info_jrye/889/info6_1.jpg
addedpublic_html/img/info_jrye/889/info7.jpg
addedpublic_html/img/island/object/object_6281.png
addedpublic_html/img/island/object/object_6282.png
addedpublic_html/img/island/object/object_event_10092_1.png
addedpublic_html/img/island/object/object_event_10092_2.png
addedpublic_html/img/island/object/object_event_10092_3.png
addedpublic_html/img/island/object/object_event_10092_4.png
addedpublic_html/img/island/object/object_event_10092_5.png
addedpublic_html/img/main/event_icon/raid/589.png
addedpublic_html/img/main/event_icon/raid/589_rare.png
addedpublic_html/img/main/event_icon/raid/589_team.png
addedpublic_html/img/raid/point_item/114_1.png
addedpublic_html/img/raid/point_item/114_2.png
addedpublic_html/img/ranking/event_raid/info_raid21.jpg
modifiedpublic_html/template/Quest-Daily.tpl
modifiedpublic_html/template/Raid-GetMedalVs.tpl
modifiedpublic_html/template/Raid-Ranking.tpl
modifiedtool/event/test_raid_event.php
Patch body is stored as a separate file to keep this page lightweight.

Review comment

#81 by iwamoto at 2021-08-17T19:03:27; lib/class/platform/yamada/YamadaWithoutAPI.class.php / old:None new:55
47e7b7e4b91658b8760285179ecdf27f28525201

@wada
実処理では通っていないので、問題はないかもしれませんが…
checkTokenの引数($token)が使用されてません。
$token = $pt の間違いかと思われます。

Review comment

#82 by iwamoto at 2021-08-17T19:07:24; lib/class/platform/yamada/YamadaWithoutAPI.class.php / old:None new:71
ede42e6e53eeb5084aa0cc54a3b80e27aba86682

@wada
S_yamada_GetUserDataBySapKeyの引数間違いになります。

修正前は
`「他のユーザへの成り代わり」を行った際に
自分の島へ移動してしまうと、user_info.nicknameが "名無し" に上書きされる` 状態になっていました