Skip to content

Conversation

xiaoyaohanyue
Copy link

评论区上传图片到Lsky Pro v2

@bymoye
Copy link
Collaborator

bymoye commented Sep 22, 2025

@nicocatxzc

@bymoye bymoye requested a review from Copilot September 22, 2025 04:18
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for Lsky Pro V2 API alongside the existing V1 support for image uploads in comments. The changes allow users to configure which API version to use and provide necessary V2-specific configuration options.

  • Adds API version selection with dropdown for V1/V2 choice
  • Implements V2 API upload functionality with different endpoint and parameters
  • Adds Storage ID configuration field required for V2 API

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
opt/options/theme-options.php Adds configuration options for API version selection and V2 Storage ID
inc/classes/Images.php Implements V2 API upload method and routing logic between V1/V2

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

* LSky Pro upload interface
*/
public function LSKY_API($image) {
if ($this->lsky_api_version == 'v1') {
Copy link

Copilot AI Sep 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Case mismatch in version comparison. The configuration options use uppercase 'V1' and 'V2', but this comparison uses lowercase 'v1'. This will cause V1 API calls to incorrectly route to V2.

Suggested change
if ($this->lsky_api_version == 'v1') {
if (strtoupper($this->lsky_api_version) == 'V1') {

Copilot uses AI. Check for mistakes.

'link' => $link,
'proxy' => $proxy,
);
error_log("LSKY API Response:\n" . print_r($output, true));
Copy link

Copilot AI Sep 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug logging should not be left in production code. This error_log statement should be removed or wrapped in a debug flag check.

Suggested change
error_log("LSKY API Response:\n" . print_r($output, true));
if (defined('WP_DEBUG') && WP_DEBUG) {
error_log("LSKY API Response:\n" . print_r($output, true));
}

Copilot uses AI. Check for mistakes.

error_log("LSKY API Response:\n" . print_r($output, true));
return $output;


Copy link

Copilot AI Sep 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Unnecessary blank lines should be removed to maintain consistent code formatting.

Suggested change

Copilot uses AI. Check for mistakes.

@nicocatxzc
Copy link
Contributor

@Shiroiame-Kusu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants