Skip to content

Commit

Permalink
修复PG tokenm (#458)
Browse files Browse the repository at this point in the history
  • Loading branch information
power721 authored Sep 29, 2024
1 parent b9dacba commit 3c6d0f1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
<dependency>
<groupId>com.github.sealedtx</groupId>
<artifactId>java-youtube-downloader</artifactId>
<version>3.2.3</version>
<version>3.2.4</version>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,12 @@
import com.fasterxml.jackson.databind.node.ObjectNode;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.core.io.ClassPathResource;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Map;
Expand Down Expand Up @@ -49,7 +46,7 @@ public PgTokenController(SubscriptionService subscriptionService,
}

@GetMapping("/version")
public Object update() throws IOException {
public Object version() throws IOException {
String remote = restTemplate.getForObject("https://gitlab.com/power0721/pg/-/raw/main/version.txt", String.class);
String local = "";
Path path = Path.of("/data/pg_version.txt");
Expand All @@ -63,9 +60,7 @@ public Object update() throws IOException {
public ObjectNode tokenm(String token) throws Exception {
subscriptionService.checkToken(token);

ClassPathResource resource = new ClassPathResource("tokentemplate.json");
InputStream inputStream = resource.getInputStream();
String json = new String(FileCopyUtils.copyToByteArray(inputStream));
String json = Files.readString(Path.of("/www/pg/lib/tokentemplate.json"));

ObjectNode objectNode = (ObjectNode) objectMapper.readTree(json);

Expand Down

0 comments on commit 3c6d0f1

Please sign in to comment.