Skip to content

Commit

Permalink
v1.1.30-felnull.1
Browse files Browse the repository at this point in the history
  • Loading branch information
MG8853 committed Jan 30, 2023
2 parents c7e8e74 + 17df6d8 commit 68502f3
Show file tree
Hide file tree
Showing 13 changed files with 779 additions and 577 deletions.
1,057 changes: 548 additions & 509 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "felnullgdlauncher-v2",
"version": "1.1.29-felnull.7",
"version": "1.1.30-felnull.1",
"description": "FelNullGDlauncherはシンプルでありながら、ユーザーエクスペリエンスに重点を置いた強力なMinecraftカスタムランチャーです。",
"keywords": [
"minecraft",
Expand Down Expand Up @@ -53,7 +53,7 @@
"release": "npm run napi-build && rimraf ./deploy && npm run release:setup && npm run release:portable",
"prepare": "husky install",
"napi-build": "cd napi && npm run build && node ../scripts/moveNapi.js",
"nsfw-move": "node scripts/moveNsfw.js"
"nsfw-move": "cd node_modules/nsfw && npm install && cd ../.. && node scripts/moveNsfw.js"
},
"lint-staged": {
"*.{js,jsx}": [
Expand Down Expand Up @@ -143,7 +143,7 @@
"eslint-plugin-react-hooks": "^4.3.0",
"husky": "^7.0.4",
"native-ext-loader": "^2.3.0",
"nsfw": "2.1.1",
"nsfw": "2.1.2",
"prettier": "^2.5.1",
"react-scripts": "4.0.3",
"rimraf": "^3.0.2",
Expand Down
59 changes: 55 additions & 4 deletions public/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,17 @@ const userAgent = new UserAgent({
// app.allowRendererProcessReuse = true;
Menu.setApplicationMenu(Menu.buildFromTemplate(edit));

app.setPath(
'userData',
path.join(app.getPath('appData'), 'felnullgdlauncher_next')
const baseUserPath = path.join(
app.getPath('appData'),
'felnullgdlauncher_next'
);

if (!fss.existsSync(baseUserPath)) {
fss.mkdirSync(baseUserPath);
}

app.setPath('userData', baseUserPath);

let allowUnstableReleases = false;
const releaseChannelExists = fss.existsSync(
path.join(app.getPath('userData'), 'rChannel')
Expand Down Expand Up @@ -787,6 +793,51 @@ ipcMain.handle('download-optedout-mods', async (e, { mods, instancePath }) => {
error: false,
warning: true
});
} else if (details.statusCode > 400) {
/**
* Check for Cloudflare blocking automated downloads.
*
* Sometimes, Cloudflare prevents the internal browser from navigating to the
* Curseforge mod download page and starting the download. The HTTP status code
* it returns is (generally) either 403 or 503. The code below retrieves the
* HTML of the page returned to the browser and checks for the title and some
* content on the page to determine if the returned page is Cloudflare.
* Unfortunately using the `webContents.getTitle()` returns an empty string.
*/
details.webContents
.executeJavaScript(
`
function getHTML () {
return new Promise((resolve, reject) => { resolve(document.documentElement.innerHTML); });
}
getHTML();
`
)
.then(content => {
const isCloudflare =
content.includes('Just a moment...') &&
content.includes(
'needs to review the security of your connection before proceeding.'
);

if (isCloudflare) {
resolve();
mainWindow.webContents.send(
'opted-out-download-mod-status',
{
modId: modManifest.id,
error: false,
warning: true,
cloudflareBlock: true
}
);
}

return null;
})
.catch(() => {
// no-op
});
}
}
);
Expand Down Expand Up @@ -937,7 +988,7 @@ ipcMain.handle('installUpdateAndQuitOrRestart', async (e, quitAfterInstall) => {

await fs.writeFile(
path.join(tempFolder, updaterVbs),
`Set WshShell = CreateObject("WScript.Shell")
`Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & "${path.join(
tempFolder,
updaterBat
Expand Down
1 change: 1 addition & 0 deletions scripts/createDeploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ const createDeployFiles = async () => {
if (err) {
reject();
}
destination.close();
resolve();
});
});
Expand Down
3 changes: 3 additions & 0 deletions src/app/desktop/utils/downloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,10 @@ const downloadFileInstance = async (fileName, url, sha1, legacyPath) => {

data.on('end', () => {
wStream.end();
wStream.close();
if (legacyPath) {
wStreamLegacy.end();
wStreamLegacy.close();
}
resolve();
});
Expand Down Expand Up @@ -148,6 +150,7 @@ export const downloadFile = async (fileName, url, onProgress) => {
return new Promise((resolve, reject) => {
data.on('end', () => {
out.end();
out.close();
resolve();
});

Expand Down
5 changes: 2 additions & 3 deletions src/common/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import qs from 'querystring';
import {
MOJANG_APIS,
FORGESVC_URL,
MC_MANIFEST_URL,
FABRIC_APIS,
JAVA_MANIFEST_URL,
IMGUR_CLIENT_ID,
Expand All @@ -15,7 +14,7 @@ import {
FTB_API_URL,
JAVA_LATEST_MANIFEST_URL
} from './utils/constants';
import { sortByDate } from './utils';
import { sortByDate, getMcManifestUrl } from './utils';
import ga from './utils/analytics';

const axioInstance = axios.create({
Expand Down Expand Up @@ -198,7 +197,7 @@ export const mcInvalidate = (accessToken, clientToken) => {
};

export const getMcManifest = () => {
const url = `${MC_MANIFEST_URL}?timestamp=${new Date().getTime()}`;
const url = `${getMcManifestUrl()}?timestamp=${new Date().getTime()}`;
return axios.get(url);
};

Expand Down
28 changes: 12 additions & 16 deletions src/common/modals/ChangeLogs/changeLog.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
module.exports = {
new: [],
improvements: [],
bugfixes: [
new: [
{
header: 'ランチャーを閉じた時にゲームを強制終了させてしまうバグを修正',
content: 'ランチャーを閉じてもゲームは継続されます。',
advanced: { cm: '391dd9cc', pr: '1412' }
},
{
header: 'ゲームの解像度に関するバグを修正',
content: '設定が反映されないバグがありました。',
advanced: { cm: '87f89ed9', pr: '1429' }
},
header: 'ARMへの正式サポート',
content: 'ARM(Apple M1 M2,Snapdragonなど)のに対応しました。',
advanced: { cm: '4fd9a4', pr: '1451' }
}
],
improvements: [
{
header: 'エラーコード1を修正',
content: 'Javaの引数が足りていませんでした。',
advanced: { cm: 'cdae501a', pr: '1420' }
header: 'NewsのURLを変更しました。',
content: 'インスタンスホーム画面のMinecraftNewsのURLを変更しました。',
advanced: { cm: 'efa324', pr: '1443' }
}
]
],
bugfixes: [{}]
};
7 changes: 6 additions & 1 deletion src/common/modals/InstanceDeleteConfirmation.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,12 @@ const InstanceDeleteConfirmation = ({ instanceName }) => {
>
いいえ
</Button>
<Button onClick={deleteInstance} loading={loading}>
<Button
danger
type="primary"
onClick={deleteInstance}
loading={loading}
>
完全削除
</Button>
</div>
Expand Down
28 changes: 23 additions & 5 deletions src/common/modals/InstanceDownloadFailed.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
removeDownloadFromQueue,
updateInstanceConfig
} from '../reducers/actions';
import { closeModal } from '../reducers/modals/actions';
import { openModal, closeModal } from '../reducers/modals/actions';
import { _getInstancesPath, _getTempPath } from '../utils/selectors';
import { rollBackInstanceZip } from '../utils';

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

const cancelDownload = async () => {
const deleteDownload = async () => {
await dispatch(removeDownloadFromQueue(instanceName, true));

dispatch(closeModal());
await new Promise(resolve => setTimeout(resolve, 1000));
dispatch(openModal('InstanceDeleteConfirmation', { instanceName }));
};

const restoreDownload = async () => {
await dispatch(removeDownloadFromQueue(instanceName, true));
setLoading(true);
await new Promise(resolve => setTimeout(resolve, 1000));
Expand Down Expand Up @@ -87,11 +95,21 @@ const InstanceDownloadFailed = ({
<Button
variant="contained"
color="primary"
onClick={cancelDownload}
loading={loading}
onClick={deleteDownload}
disabled={loading}
>
ダウンロードをキャンセルする
インスタンスを削除する
</Button>
{isUpdate && (
<Button
variant="contained"
color="primary"
onClick={restoreDownload}
loading={loading}
>
インスタンスをそのままにする
</Button>
)}
<Button danger type="primary" onClick={retry} disabled={loading}>
ダウンロードを再度実行する
</Button>
Expand Down
Loading

0 comments on commit 68502f3

Please sign in to comment.