@xcpcio/core 0.38.3 → 0.39.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1270,9 +1270,12 @@ function createContestIndexList(contestListJSON) {
1270
1270
  return contestIndexList;
1271
1271
  }
1272
1272
 
1273
- function getImageSource(image) {
1273
+ function getImageSource(image, asset_host) {
1274
1274
  if (image?.url) {
1275
- return image.url;
1275
+ if (image.url.startsWith("http")) {
1276
+ return image.url;
1277
+ }
1278
+ return `${asset_host}/${image.url}`;
1276
1279
  }
1277
1280
  if (image?.base64) {
1278
1281
  return `data:image/${image.type ?? "png"};base64,${image.base64}`;
package/dist/index.d.ts CHANGED
@@ -318,7 +318,7 @@ type ContestIndexList = Array<ContestIndex>;
318
318
  declare function createContestIndex(contestIndexJSON: ContestIndex$1): ContestIndex;
319
319
  declare function createContestIndexList(contestListJSON: any): ContestIndexList;
320
320
 
321
- declare function getImageSource(image: Image): string;
321
+ declare function getImageSource(image: Image, asset_host?: string): string;
322
322
 
323
323
  declare class ResolverOperation {
324
324
  id: number;
package/dist/index.mjs CHANGED
@@ -1239,9 +1239,12 @@ function createContestIndexList(contestListJSON) {
1239
1239
  return contestIndexList;
1240
1240
  }
1241
1241
 
1242
- function getImageSource(image) {
1242
+ function getImageSource(image, asset_host) {
1243
1243
  if (image?.url) {
1244
- return image.url;
1244
+ if (image.url.startsWith("http")) {
1245
+ return image.url;
1246
+ }
1247
+ return `${asset_host}/${image.url}`;
1245
1248
  }
1246
1249
  if (image?.base64) {
1247
1250
  return `data:image/${image.type ?? "png"};base64,${image.base64}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xcpcio/core",
3
- "version": "0.38.3",
3
+ "version": "0.39.1",
4
4
  "description": "XCPCIO Core",
5
5
  "author": "Dup4 <lyuzhi.pan@gmail.com>",
6
6
  "license": "MIT",
@@ -46,7 +46,7 @@
46
46
  "lodash": "^4.17.21",
47
47
  "string-width": "^6.1.0",
48
48
  "xlsx-js-style": "^1.2.0",
49
- "@xcpcio/types": "0.38.3"
49
+ "@xcpcio/types": "0.39.1"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@babel/types": "^7.22.4",
package/src/image.ts CHANGED
@@ -1,8 +1,12 @@
1
1
  import type { Image } from "@xcpcio/types";
2
2
 
3
- export function getImageSource(image: Image): string {
3
+ export function getImageSource(image: Image, asset_host?: string): string {
4
4
  if (image?.url) {
5
- return image.url;
5
+ if (image.url.startsWith("http")) {
6
+ return image.url;
7
+ }
8
+
9
+ return `${asset_host}/${image.url}`;
6
10
  }
7
11
 
8
12
  if (image?.base64) {