mirror of
https://github.com/artegoser/pimi-launcher-core.git
synced 2024-11-22 12:16:21 +03:00
better way to auth, prepping for client use
This commit is contained in:
parent
9f1f972d0e
commit
a1d4bd8d3b
3 changed files with 192 additions and 22 deletions
177
.idea/workspace.xml
generated
Normal file
177
.idea/workspace.xml
generated
Normal file
|
@ -0,0 +1,177 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ChangeListManager">
|
||||||
|
<list default="true" id="5025c58e-a68a-4c53-b921-d7679e7c01fc" name="Default Changelist" comment="" />
|
||||||
|
<ignored path="$PROJECT_DIR$/.tmp/" />
|
||||||
|
<ignored path="$PROJECT_DIR$/temp/" />
|
||||||
|
<ignored path="$PROJECT_DIR$/tmp/" />
|
||||||
|
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||||
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||||
|
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||||
|
</component>
|
||||||
|
<component name="FileEditorManager">
|
||||||
|
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||||
|
<file pinned="false" current-in-tab="true">
|
||||||
|
<entry file="file://$PROJECT_DIR$/components/launcher.js">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="-552">
|
||||||
|
<caret line="6" lean-forward="true" selection-start-line="6" selection-end-line="6" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file pinned="false" current-in-tab="false">
|
||||||
|
<entry file="file://$PROJECT_DIR$/components/handler.js">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="-3289">
|
||||||
|
<caret line="4" column="32" selection-start-line="4" selection-start-column="32" selection-end-line="4" selection-end-column="32" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file pinned="false" current-in-tab="false">
|
||||||
|
<entry file="file://$PROJECT_DIR$/components/authenticator.js">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="667">
|
||||||
|
<caret line="29" column="46" selection-start-line="29" selection-start-column="46" selection-end-line="29" selection-end-column="46" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
</leaf>
|
||||||
|
</component>
|
||||||
|
<component name="Git.Settings">
|
||||||
|
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||||
|
</component>
|
||||||
|
<component name="IdeDocumentHistory">
|
||||||
|
<option name="CHANGED_PATHS">
|
||||||
|
<list>
|
||||||
|
<option value="$PROJECT_DIR$/components/handler.js" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectFrameBounds">
|
||||||
|
<option name="x" value="238" />
|
||||||
|
<option name="y" value="1" />
|
||||||
|
<option name="width" value="1484" />
|
||||||
|
<option name="height" value="980" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
||||||
|
<component name="ProjectView">
|
||||||
|
<navigator proportions="" version="1">
|
||||||
|
<foldersAlwaysOnTop value="true" />
|
||||||
|
</navigator>
|
||||||
|
<panes>
|
||||||
|
<pane id="Scope" />
|
||||||
|
<pane id="ProjectPane">
|
||||||
|
<subPane>
|
||||||
|
<expand>
|
||||||
|
<path>
|
||||||
|
<item name="MinecraftLauncher-core" type="b2602c69:ProjectViewProjectNode" />
|
||||||
|
<item name="MinecraftLauncher-core" type="462c0819:PsiDirectoryNode" />
|
||||||
|
</path>
|
||||||
|
<path>
|
||||||
|
<item name="MinecraftLauncher-core" type="b2602c69:ProjectViewProjectNode" />
|
||||||
|
<item name="MinecraftLauncher-core" type="462c0819:PsiDirectoryNode" />
|
||||||
|
<item name="components" type="462c0819:PsiDirectoryNode" />
|
||||||
|
</path>
|
||||||
|
</expand>
|
||||||
|
<select />
|
||||||
|
</subPane>
|
||||||
|
</pane>
|
||||||
|
</panes>
|
||||||
|
</component>
|
||||||
|
<component name="PropertiesComponent">
|
||||||
|
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||||
|
<property name="javascript.nodejs.core.library.configured.version" value="8.9.1" />
|
||||||
|
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
||||||
|
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
|
||||||
|
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
|
||||||
|
<property name="nodejs_package_manager_path" value="npm" />
|
||||||
|
<property name="settings.editor.selected.configurable" value="settings.nodejs" />
|
||||||
|
</component>
|
||||||
|
<component name="RunDashboard">
|
||||||
|
<option name="ruleStates">
|
||||||
|
<list>
|
||||||
|
<RuleState>
|
||||||
|
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
|
||||||
|
</RuleState>
|
||||||
|
<RuleState>
|
||||||
|
<option name="name" value="StatusDashboardGroupingRule" />
|
||||||
|
</RuleState>
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="SvnConfiguration">
|
||||||
|
<configuration />
|
||||||
|
</component>
|
||||||
|
<component name="TaskManager">
|
||||||
|
<task active="true" id="Default" summary="Default task">
|
||||||
|
<changelist id="5025c58e-a68a-4c53-b921-d7679e7c01fc" name="Default Changelist" comment="" />
|
||||||
|
<created>1540860518939</created>
|
||||||
|
<option name="number" value="Default" />
|
||||||
|
<option name="presentableId" value="Default" />
|
||||||
|
<updated>1540860518939</updated>
|
||||||
|
<workItem from="1540860521681" duration="869000" />
|
||||||
|
<workItem from="1541372305068" duration="702000" />
|
||||||
|
<workItem from="1541620927076" duration="172000" />
|
||||||
|
<workItem from="1541625466787" duration="79000" />
|
||||||
|
</task>
|
||||||
|
<servers />
|
||||||
|
</component>
|
||||||
|
<component name="TimeTrackingManager">
|
||||||
|
<option name="totallyTimeSpent" value="1822000" />
|
||||||
|
</component>
|
||||||
|
<component name="ToolWindowManager">
|
||||||
|
<frame x="238" y="1" width="1484" height="980" extended-state="0" />
|
||||||
|
<editor active="true" />
|
||||||
|
<layout>
|
||||||
|
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.24965422" />
|
||||||
|
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
||||||
|
<window_info id="npm" order="2" side_tool="true" />
|
||||||
|
<window_info id="Favorites" order="3" side_tool="true" />
|
||||||
|
<window_info anchor="bottom" id="Message" order="0" />
|
||||||
|
<window_info anchor="bottom" id="Find" order="1" />
|
||||||
|
<window_info anchor="bottom" id="Run" order="2" />
|
||||||
|
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
|
||||||
|
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
||||||
|
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
||||||
|
<window_info anchor="bottom" id="TODO" order="6" />
|
||||||
|
<window_info anchor="bottom" id="Docker" order="7" show_stripe_button="false" />
|
||||||
|
<window_info anchor="bottom" id="Version Control" order="8" show_stripe_button="false" />
|
||||||
|
<window_info anchor="bottom" id="Event Log" order="9" side_tool="true" />
|
||||||
|
<window_info anchor="bottom" id="Terminal" order="10" />
|
||||||
|
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
|
||||||
|
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
||||||
|
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
||||||
|
</layout>
|
||||||
|
</component>
|
||||||
|
<component name="TypeScriptGeneratedFilesManager">
|
||||||
|
<option name="version" value="1" />
|
||||||
|
</component>
|
||||||
|
<component name="editorHistoryManager">
|
||||||
|
<entry file="file://$PROJECT_DIR$/components/authenticator.js">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="667">
|
||||||
|
<caret line="29" column="46" selection-start-line="29" selection-start-column="46" selection-end-line="29" selection-end-column="46" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/components/handler.js">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="-3289">
|
||||||
|
<caret line="4" column="32" selection-start-line="4" selection-start-column="32" selection-end-line="4" selection-end-column="32" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/components/launcher.js">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="-552">
|
||||||
|
<caret line="6" lean-forward="true" selection-start-line="6" selection-end-line="6" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -3,8 +3,20 @@ const uuid = require('uuid/v1');
|
||||||
const api_url = "https://authserver.mojang.com";
|
const api_url = "https://authserver.mojang.com";
|
||||||
|
|
||||||
|
|
||||||
function login(username, password) {
|
function getAuth(username, password) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
|
if(!password) {
|
||||||
|
const user = {
|
||||||
|
access_token: uuid(),
|
||||||
|
client_token: uuid(),
|
||||||
|
uuid: uuid(),
|
||||||
|
name: username,
|
||||||
|
user_object: JSON.stringify({})
|
||||||
|
};
|
||||||
|
|
||||||
|
resolve(user);
|
||||||
|
}
|
||||||
|
|
||||||
const requestObject = {
|
const requestObject = {
|
||||||
url: api_url + "/authenticate",
|
url: api_url + "/authenticate",
|
||||||
json: {
|
json: {
|
||||||
|
@ -37,23 +49,6 @@ function login(username, password) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function offline(username) {
|
module.exports = async function(username, password) {
|
||||||
let user = {
|
return await getAuth(username, password);
|
||||||
access_token: uuid(),
|
|
||||||
client_token: uuid(),
|
|
||||||
uuid: uuid(),
|
|
||||||
name: username,
|
|
||||||
user_object: JSON.stringify({})
|
|
||||||
};
|
|
||||||
|
|
||||||
return user;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = async function(_offline, username, password) {
|
|
||||||
if(_offline) {
|
|
||||||
return offline(username);
|
|
||||||
}
|
|
||||||
|
|
||||||
return await login(username, password);
|
|
||||||
};
|
};
|
|
@ -9,8 +9,6 @@ const shelljs = require('shelljs');
|
||||||
module.exports = async function (options) {
|
module.exports = async function (options) {
|
||||||
if (!fs.existsSync(options.root)) fs.mkdirSync(options.root);
|
if (!fs.existsSync(options.root)) fs.mkdirSync(options.root);
|
||||||
|
|
||||||
options.authorization = await ygg(options.login.offline, options.login.username, options.login.password);
|
|
||||||
|
|
||||||
const versionFile = await handler.getVersion(options.version.number);
|
const versionFile = await handler.getVersion(options.version.number);
|
||||||
const directory = path.join(options.root, 'versions', options.version.number);
|
const directory = path.join(options.root, 'versions', options.version.number);
|
||||||
options.directory = directory;
|
options.directory = directory;
|
||||||
|
|
Loading…
Add table
Reference in a new issue