Skip to content

Commit 68502f3

Browse files
committed
v1.1.30-felnull.1
2 parents c7e8e74 + 17df6d8 commit 68502f3

13 files changed

+779
-577
lines changed

package-lock.json

+548-509
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "felnullgdlauncher-v2",
3-
"version": "1.1.29-felnull.7",
3+
"version": "1.1.30-felnull.1",
44
"description": "FelNullGDlauncherはシンプルでありながら、ユーザーエクスペリエンスに重点を置いた強力なMinecraftカスタムランチャーです。",
55
"keywords": [
66
"minecraft",
@@ -53,7 +53,7 @@
5353
"release": "npm run napi-build && rimraf ./deploy && npm run release:setup && npm run release:portable",
5454
"prepare": "husky install",
5555
"napi-build": "cd napi && npm run build && node ../scripts/moveNapi.js",
56-
"nsfw-move": "node scripts/moveNsfw.js"
56+
"nsfw-move": "cd node_modules/nsfw && npm install && cd ../.. && node scripts/moveNsfw.js"
5757
},
5858
"lint-staged": {
5959
"*.{js,jsx}": [
@@ -143,7 +143,7 @@
143143
"eslint-plugin-react-hooks": "^4.3.0",
144144
"husky": "^7.0.4",
145145
"native-ext-loader": "^2.3.0",
146-
"nsfw": "2.1.1",
146+
"nsfw": "2.1.2",
147147
"prettier": "^2.5.1",
148148
"react-scripts": "4.0.3",
149149
"rimraf": "^3.0.2",

public/electron.js

+55-4
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,17 @@ const userAgent = new UserAgent({
168168
// app.allowRendererProcessReuse = true;
169169
Menu.setApplicationMenu(Menu.buildFromTemplate(edit));
170170

171-
app.setPath(
172-
'userData',
173-
path.join(app.getPath('appData'), 'felnullgdlauncher_next')
171+
const baseUserPath = path.join(
172+
app.getPath('appData'),
173+
'felnullgdlauncher_next'
174174
);
175175

176+
if (!fss.existsSync(baseUserPath)) {
177+
fss.mkdirSync(baseUserPath);
178+
}
179+
180+
app.setPath('userData', baseUserPath);
181+
176182
let allowUnstableReleases = false;
177183
const releaseChannelExists = fss.existsSync(
178184
path.join(app.getPath('userData'), 'rChannel')
@@ -787,6 +793,51 @@ ipcMain.handle('download-optedout-mods', async (e, { mods, instancePath }) => {
787793
error: false,
788794
warning: true
789795
});
796+
} else if (details.statusCode > 400) {
797+
/**
798+
* Check for Cloudflare blocking automated downloads.
799+
*
800+
* Sometimes, Cloudflare prevents the internal browser from navigating to the
801+
* Curseforge mod download page and starting the download. The HTTP status code
802+
* it returns is (generally) either 403 or 503. The code below retrieves the
803+
* HTML of the page returned to the browser and checks for the title and some
804+
* content on the page to determine if the returned page is Cloudflare.
805+
* Unfortunately using the `webContents.getTitle()` returns an empty string.
806+
*/
807+
details.webContents
808+
.executeJavaScript(
809+
`
810+
function getHTML () {
811+
return new Promise((resolve, reject) => { resolve(document.documentElement.innerHTML); });
812+
}
813+
getHTML();
814+
`
815+
)
816+
.then(content => {
817+
const isCloudflare =
818+
content.includes('Just a moment...') &&
819+
content.includes(
820+
'needs to review the security of your connection before proceeding.'
821+
);
822+
823+
if (isCloudflare) {
824+
resolve();
825+
mainWindow.webContents.send(
826+
'opted-out-download-mod-status',
827+
{
828+
modId: modManifest.id,
829+
error: false,
830+
warning: true,
831+
cloudflareBlock: true
832+
}
833+
);
834+
}
835+
836+
return null;
837+
})
838+
.catch(() => {
839+
// no-op
840+
});
790841
}
791842
}
792843
);
@@ -937,7 +988,7 @@ ipcMain.handle('installUpdateAndQuitOrRestart', async (e, quitAfterInstall) => {
937988

938989
await fs.writeFile(
939990
path.join(tempFolder, updaterVbs),
940-
`Set WshShell = CreateObject("WScript.Shell")
991+
`Set WshShell = CreateObject("WScript.Shell")
941992
WshShell.Run chr(34) & "${path.join(
942993
tempFolder,
943994
updaterBat

scripts/createDeploy.js

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ const createDeployFiles = async () => {
7777
if (err) {
7878
reject();
7979
}
80+
destination.close();
8081
resolve();
8182
});
8283
});

src/app/desktop/utils/downloader.js

+3
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,10 @@ const downloadFileInstance = async (fileName, url, sha1, legacyPath) => {
103103

104104
data.on('end', () => {
105105
wStream.end();
106+
wStream.close();
106107
if (legacyPath) {
107108
wStreamLegacy.end();
109+
wStreamLegacy.close();
108110
}
109111
resolve();
110112
});
@@ -148,6 +150,7 @@ export const downloadFile = async (fileName, url, onProgress) => {
148150
return new Promise((resolve, reject) => {
149151
data.on('end', () => {
150152
out.end();
153+
out.close();
151154
resolve();
152155
});
153156

src/common/api.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import qs from 'querystring';
44
import {
55
MOJANG_APIS,
66
FORGESVC_URL,
7-
MC_MANIFEST_URL,
87
FABRIC_APIS,
98
JAVA_MANIFEST_URL,
109
IMGUR_CLIENT_ID,
@@ -15,7 +14,7 @@ import {
1514
FTB_API_URL,
1615
JAVA_LATEST_MANIFEST_URL
1716
} from './utils/constants';
18-
import { sortByDate } from './utils';
17+
import { sortByDate, getMcManifestUrl } from './utils';
1918
import ga from './utils/analytics';
2019

2120
const axioInstance = axios.create({
@@ -198,7 +197,7 @@ export const mcInvalidate = (accessToken, clientToken) => {
198197
};
199198

200199
export const getMcManifest = () => {
201-
const url = `${MC_MANIFEST_URL}?timestamp=${new Date().getTime()}`;
200+
const url = `${getMcManifestUrl()}?timestamp=${new Date().getTime()}`;
202201
return axios.get(url);
203202
};
204203

+12-16
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
11
module.exports = {
2-
new: [],
3-
improvements: [],
4-
bugfixes: [
2+
new: [
53
{
6-
header: 'ランチャーを閉じた時にゲームを強制終了させてしまうバグを修正',
7-
content: 'ランチャーを閉じてもゲームは継続されます。',
8-
advanced: { cm: '391dd9cc', pr: '1412' }
9-
},
10-
{
11-
header: 'ゲームの解像度に関するバグを修正',
12-
content: '設定が反映されないバグがありました。',
13-
advanced: { cm: '87f89ed9', pr: '1429' }
14-
},
4+
header: 'ARMへの正式サポート',
5+
content: 'ARM(Apple M1 M2,Snapdragonなど)のに対応しました。',
6+
advanced: { cm: '4fd9a4', pr: '1451' }
7+
}
8+
],
9+
improvements: [
1510
{
16-
header: 'エラーコード1を修正',
17-
content: 'Javaの引数が足りていませんでした。',
18-
advanced: { cm: 'cdae501a', pr: '1420' }
11+
header: 'NewsのURLを変更しました。',
12+
content: 'インスタンスホーム画面のMinecraftNewsのURLを変更しました。',
13+
advanced: { cm: 'efa324', pr: '1443' }
1914
}
20-
]
15+
],
16+
bugfixes: [{}]
2117
};

src/common/modals/InstanceDeleteConfirmation.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,12 @@ const InstanceDeleteConfirmation = ({ instanceName }) => {
6666
>
6767
いいえ
6868
</Button>
69-
<Button onClick={deleteInstance} loading={loading}>
69+
<Button
70+
danger
71+
type="primary"
72+
onClick={deleteInstance}
73+
loading={loading}
74+
>
7075
完全削除
7176
</Button>
7277
</div>

src/common/modals/InstanceDownloadFailed.js

+23-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
removeDownloadFromQueue,
99
updateInstanceConfig
1010
} from '../reducers/actions';
11-
import { closeModal } from '../reducers/modals/actions';
11+
import { openModal, closeModal } from '../reducers/modals/actions';
1212
import { _getInstancesPath, _getTempPath } from '../utils/selectors';
1313
import { rollBackInstanceZip } from '../utils';
1414

@@ -28,7 +28,15 @@ const InstanceDownloadFailed = ({
2828
? `${instanceName.substring(0, 20)}...`
2929
: instanceName;
3030

31-
const cancelDownload = async () => {
31+
const deleteDownload = async () => {
32+
await dispatch(removeDownloadFromQueue(instanceName, true));
33+
34+
dispatch(closeModal());
35+
await new Promise(resolve => setTimeout(resolve, 1000));
36+
dispatch(openModal('InstanceDeleteConfirmation', { instanceName }));
37+
};
38+
39+
const restoreDownload = async () => {
3240
await dispatch(removeDownloadFromQueue(instanceName, true));
3341
setLoading(true);
3442
await new Promise(resolve => setTimeout(resolve, 1000));
@@ -87,11 +95,21 @@ const InstanceDownloadFailed = ({
8795
<Button
8896
variant="contained"
8997
color="primary"
90-
onClick={cancelDownload}
91-
loading={loading}
98+
onClick={deleteDownload}
99+
disabled={loading}
92100
>
93-
ダウンロードをキャンセルする
101+
インスタンスを削除する
94102
</Button>
103+
{isUpdate && (
104+
<Button
105+
variant="contained"
106+
color="primary"
107+
onClick={restoreDownload}
108+
loading={loading}
109+
>
110+
インスタンスをそのままにする
111+
</Button>
112+
)}
95113
<Button danger type="primary" onClick={retry} disabled={loading}>
96114
ダウンロードを再度実行する
97115
</Button>

0 commit comments

Comments
 (0)