Skip to content

Commit

Permalink
Merge pull request #213 from entrylabs/develop
Browse files Browse the repository at this point in the history
version up 2.1.20
  • Loading branch information
Tnks2U authored Oct 29, 2024
2 parents 76a19b7 + 94e5126 commit ccde1be
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 135 deletions.
2 changes: 1 addition & 1 deletion build/entryx64.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
!define MUI_UNICON "icon.ico"
!define PRODUCT_NAME "Entry"
!define APP_NAME "Entry.exe"
!define PRODUCT_VERSION "2.1.19"
!define PRODUCT_VERSION "2.1.20"
!define PRODUCT_PUBLISHER "EntryLabs"
!define PRODUCT_WEB_SITE "http://www.playentry.org/"

Expand Down
2 changes: 1 addition & 1 deletion build/entryx86.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
!define MUI_UNICON "icon.ico"
!define PRODUCT_NAME "Entry"
!define APP_NAME "Entry.exe"
!define PRODUCT_VERSION "2.1.19"
!define PRODUCT_VERSION "2.1.20"
!define PRODUCT_PUBLISHER "EntryLabs"
!define PRODUCT_WEB_SITE "http://www.playentry.org/"

Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"private": true,
"productName": "Entry",
"name": "entry",
"version": "2.1.19",
"version": "2.1.20",
"description": "Entry for offline",
"main": "src/main_build/main.bundle.js",
"scripts": {
Expand Down Expand Up @@ -39,8 +39,8 @@
"async-csv": "^2.1.3",
"axios": "^0.19.2",
"cross-spawn": "^7.0.3",
"entry-hw": "git+https://github.com/entrylabs/entry-hw.git#dist/v1.9.57_2",
"entry-js": "git+https://github.com/entrylabs/entryjs.git#dist/offline_v2.1.19",
"entry-hw": "git+https://github.com/entrylabs/entry-hw.git#dist/v1.9.58_2",
"entry-js": "git+https://github.com/entrylabs/entryjs.git#dist/offline_v2.1.20",
"entry-tool": "git+https://github.com/entrylabs/entry-tool.git#dist/20231026",
"@entrylabs/legacy-video": "^1.0.0",
"excel4node": "^1.7.0",
Expand All @@ -59,7 +59,7 @@
"sass": "^1.57.1",
"socket.io": "^2.2.0",
"socket.io-client": "^2.2.0",
"tar": "^4.4.10",
"tar": "^6.1.11",
"uid": "^0.0.2",
"winston": "^3.2.1",
"winston-daily-rotate-file": "^4.4.2",
Expand Down
99 changes: 31 additions & 68 deletions src/main/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,24 @@ export default class {
return {
fromExternal: (fileUrl) => {
let result = fileUrl.replace(/%5C/gi, '\\'); // 1.6.x 버전 대응
if (result.startsWith('./bower_components')) { // 웹 기본 오브젝트 대응
if (result.startsWith('./bower_components')) {
// 웹 기본 오브젝트 대응
result = result
.replace('./bower_components', '../../../node_modules')
.replace('entryjs', 'entry-js'); // 과거 웹 WS 대응
} else if (result.startsWith('/lib')) { // 신규 웹 기본 오브젝트 대응
} else if (result.startsWith('/lib')) {
// 신규 웹 기본 오브젝트 대응
result = result.replace('/lib', '../../../node_modules');
} else if (result.indexOf('temp') > -1) { // 일반 오브젝트 대응
} else if (result.indexOf('temp') > -1) {
// 일반 오브젝트 대응
result = result.substring(result.indexOf('temp'));
result = path.join(this.appPath, result)
.replace(/\\/gi, '/');
result = path.join(this.appPath, result).replace(/\\/gi, '/');
} else if (result.match('/node_modules/@entrylabs/entry') !== null) {
result = result.replace(
'/node_modules/@entrylabs/entry',
'../../../node_modules/entry-js'
);
}

// TODO: 히스토리 파악 후 완전 제거
// if (fileUrl.endsWith('.svg')) {
// // svg 파일의 경우 png 파일로 교체한다.
Expand All @@ -33,15 +39,16 @@ export default class {

if (result.startsWith('renderer')) {
result = result.replace('renderer', '.');
} else if (result.startsWith('../../../node_modules')) {
// 웹 업로드시 bower 에서 받던 구조 그대로 사용할 것이므로, 그 사이에 혼동을 주지 않기 위해
// node_modules 로 링크되는 구조를 과거 로직으로 재치환 하여 export 함
result = result.replace('../../../node_modules', './bower_components');
} else if (result.match('/node_modules/@entrylabs/entry') !== null) {
result = result.replace('/node_modules/@entrylabs/entry', './bower_components');
}

// 웹 업로드시 bower 에서 받던 구조 그대로 사용할 것이므로, 그 사이에 혼동을 주지 않기 위해
// node_modules 로 링크되는 구조를 과거 로직으로 재치환 하여 export 함
if (result.startsWith('../../../node_modules')) {
result = result.replace('../../../node_modules','./bower_components');
}

return result.substring(result.indexOf('temp'))
return result
.substring(result.indexOf('temp'))
.replace(/\\/gi, '/')
.replace(/.*\/\//, ''); // 외부 접속 프로토콜 스키마 보안 대응
},
Expand All @@ -51,7 +58,7 @@ export default class {
if (result.startsWith('renderer')) {
result = result.replace('renderer', '.');
} else if (result.startsWith('../../../node_modules')) {
result = result.replace('../../../node_modules','./bower_components');
result = result.replace('../../../node_modules', './bower_components');
} else {
result = undefined;
}
Expand Down Expand Up @@ -105,87 +112,43 @@ export default class {
}

static tempPathForExport(objectId: string) {
return path.join(
this.appPath,
'import',
objectId,
path.sep,
);
return path.join(this.appPath, 'import', objectId, path.sep);
}

// 사용위치는 join 을 사용 (프로젝트 외 경로)
static get tempPath() {
return path.join(
this.appPath,
'temp',
path.sep,
);
return path.join(this.appPath, 'temp', path.sep);
}

static tempImagePath(filename: string) {
return path.join(
this.tempPath,
this.subDirectoryPath(filename),
'image',
path.sep,
);
return path.join(this.tempPath, this.subDirectoryPath(filename), 'image', path.sep);
}

static tempThumbnailPath(filename: string) {
return path.join(
this.tempPath,
this.subDirectoryPath(filename),
'thumb',
path.sep,
);
return path.join(this.tempPath, this.subDirectoryPath(filename), 'thumb', path.sep);
}

static tempSoundPath(filename: string) {
return path.join(
this.tempPath,
this.subDirectoryPath(filename),
'sound',
path.sep,
);
return path.join(this.tempPath, this.subDirectoryPath(filename), 'sound', path.sep);
}

static get resourcePath() {
return path.resolve(
app.getAppPath(), 'src', 'renderer', 'resources', 'uploads',
);
return path.resolve(app.getAppPath(), 'src', 'renderer', 'resources', 'uploads');
}

static resourceImagePath(filename: string) {
return path.join(
this.resourcePath,
this.subDirectoryPath(filename),
'image',
path.sep,
);
return path.join(this.resourcePath, this.subDirectoryPath(filename), 'image', path.sep);
}

static resourceThumbnailPath(filename: string) {
return path.join(
this.resourcePath,
this.subDirectoryPath(filename),
'thumb',
path.sep,
);
return path.join(this.resourcePath, this.subDirectoryPath(filename), 'thumb', path.sep);
}

static resourceSoundPath(filename: string) {
return path.join(
this.resourcePath,
this.subDirectoryPath(filename),
path.sep,
);
return path.join(this.resourcePath, this.subDirectoryPath(filename), path.sep);
}

static subDirectoryPath(filename: string) {
return path.join(
filename.substr(0, 2),
filename.substr(2, 2),
path.sep,
);
return path.join(filename.substr(0, 2), filename.substr(2, 2), path.sep);
}
}
14 changes: 4 additions & 10 deletions src/main/fileUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,17 @@ import tar, { CreateOptions, FileOptions } from 'tar';
import { nativeImage, NativeImage } from 'electron';
import createLogger from './utils/functions/createLogger';
import ffmpeg from 'fluent-ffmpeg';
import ffmpegInstaller from '@ffmpeg-installer/ffmpeg'
import ffprobeInstaller from '@ffprobe-installer/ffprobe'
import ffmpegInstaller from '@ffmpeg-installer/ffmpeg';
import ffprobeInstaller from '@ffprobe-installer/ffprobe';
import get from 'lodash/get';

type tarCreateOption = FileOptions & CreateOptions;
type readFileOption = { encoding?: string | null; flag?: string } | string | undefined | null;
type Dimension = { width: number; height: number };

const logger = createLogger('main/fileUtils.ts');
const ffmpegPath = ffmpegInstaller.path.replace(
'app.asar',
'app.asar.unpacked'
);
const ffprobePath = ffprobeInstaller.path.replace(
'app.asar',
'app.asar.unpacked'
);
const ffmpegPath = ffmpegInstaller.path.replace('app.asar', 'app.asar.unpacked');
const ffprobePath = ffprobeInstaller.path.replace('app.asar', 'app.asar.unpacked');
ffmpeg.setFfmpegPath(ffmpegPath);
ffmpeg.setFfprobePath(ffprobePath);

Expand Down
6 changes: 5 additions & 1 deletion src/main/mainUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default class MainUtils {
const workingDirectoryPath = path.join(baseAppPath, 'temp');
const tempDirectoryPath = path.join(baseAppPath, 'uploads', CommonUtils.createFileId());
await FileUtils.mkdirRecursive(tempDirectoryPath);
await FileUtils.unpack(filePath, tempDirectoryPath, (path) => path.startsWith('temp/'));
await FileUtils.unpack(filePath, tempDirectoryPath);

const projectBuffer = await fsp.readFile(
path.resolve(tempDirectoryPath, 'temp', 'project.json')
Expand Down Expand Up @@ -105,6 +105,10 @@ export default class MainUtils {
return;
}
picture.fileurl = replaceStrategy(fileUrl);
const thumbUrl = picture.thumbUrl;
if (thumbUrl) {
picture.thumbUrl = replaceStrategy(thumbUrl);
}
});
sounds.forEach((sound: any) => {
const fileUrl = sound.fileurl;
Expand Down
Loading

0 comments on commit ccde1be

Please sign in to comment.