forked from OpenWF/SpaceNinjaServer
		
	Compare commits
	
		
			9 Commits
		
	
	
		
			9823729aa8
			...
			a5d74b92c8
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| a5d74b92c8 | |||
| f15f2bfdbd | |||
| c1fcd3042e | |||
| fb232f74bd | |||
| c267ce47c3 | |||
| 3537c7e436 | |||
| 3b3edaced4 | |||
| e46b3c7d29 | |||
| 241f0c894a | 
							
								
								
									
										24
									
								
								.github/workflows/docker.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								.github/workflows/docker.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,24 @@
 | 
				
			|||||||
 | 
					name: Build Docker image
 | 
				
			||||||
 | 
					on:
 | 
				
			||||||
 | 
					    push:
 | 
				
			||||||
 | 
					        branches:
 | 
				
			||||||
 | 
					            - main
 | 
				
			||||||
 | 
					jobs:
 | 
				
			||||||
 | 
					    docker:
 | 
				
			||||||
 | 
					        runs-on: ubuntu-latest
 | 
				
			||||||
 | 
					        steps:
 | 
				
			||||||
 | 
					            - name: Set up Docker buildx
 | 
				
			||||||
 | 
					              uses: docker/setup-buildx-action@v3
 | 
				
			||||||
 | 
					            - name: Log in to container registry
 | 
				
			||||||
 | 
					              uses: docker/login-action@v3
 | 
				
			||||||
 | 
					              with:
 | 
				
			||||||
 | 
					                  username: openwf
 | 
				
			||||||
 | 
					                  password: ${{ secrets.DOCKERHUB_TOKEN }}
 | 
				
			||||||
 | 
					            - name: Build and push
 | 
				
			||||||
 | 
					              uses: docker/build-push-action@v6
 | 
				
			||||||
 | 
					              with:
 | 
				
			||||||
 | 
					                  platforms: linux/amd64,linux/arm64
 | 
				
			||||||
 | 
					                  push: true
 | 
				
			||||||
 | 
					                  tags: |
 | 
				
			||||||
 | 
					                      openwf/spaceninjaserver:latest
 | 
				
			||||||
 | 
					                      openwf/spaceninjaserver:${{ github.sha }}
 | 
				
			||||||
@ -1,7 +1,7 @@
 | 
				
			|||||||
services:
 | 
					services:
 | 
				
			||||||
    openwf:
 | 
					    spaceninjaserver:
 | 
				
			||||||
        # build: .
 | 
					        # build: .
 | 
				
			||||||
        image: ghcr.io/spaceninjaserver/SpaceNinjaServer:latest
 | 
					        image: openwf/spaceninjaserver:latest
 | 
				
			||||||
        environment:
 | 
					        environment:
 | 
				
			||||||
            APP_MONGODB_URL: mongodb://openwfagent:spaceninjaserver@mongodb:27017/
 | 
					            APP_MONGODB_URL: mongodb://openwfagent:spaceninjaserver@mongodb:27017/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -195,7 +195,7 @@ export const getInventoryResponse = async (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if (config.universalPolarityEverywhere) {
 | 
					    if (config.universalPolarityEverywhere) {
 | 
				
			||||||
        const Polarity: IPolarity[] = [];
 | 
					        const Polarity: IPolarity[] = [];
 | 
				
			||||||
        for (let i = 0; i != 10; ++i) {
 | 
					        for (let i = 0; i != 12; ++i) {
 | 
				
			||||||
            Polarity.push({
 | 
					            Polarity.push({
 | 
				
			||||||
                Slot: i,
 | 
					                Slot: i,
 | 
				
			||||||
                Value: ArtifactPolarity.Any
 | 
					                Value: ArtifactPolarity.Any
 | 
				
			||||||
 | 
				
			|||||||
@ -3,12 +3,23 @@ import { getAccountIdForRequest } from "@/src/services/loginService";
 | 
				
			|||||||
import { IEquipmentClient } from "@/src/types/inventoryTypes/commonInventoryTypes";
 | 
					import { IEquipmentClient } from "@/src/types/inventoryTypes/commonInventoryTypes";
 | 
				
			||||||
import { TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes";
 | 
					import { TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes";
 | 
				
			||||||
import { RequestHandler } from "express";
 | 
					import { RequestHandler } from "express";
 | 
				
			||||||
 | 
					import { ExportMisc } from "warframe-public-export-plus";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const addXpController: RequestHandler = async (req, res) => {
 | 
					export const addXpController: RequestHandler = async (req, res) => {
 | 
				
			||||||
    const accountId = await getAccountIdForRequest(req);
 | 
					    const accountId = await getAccountIdForRequest(req);
 | 
				
			||||||
    const inventory = await getInventory(accountId);
 | 
					    const inventory = await getInventory(accountId);
 | 
				
			||||||
    const request = req.body as IAddXpRequest;
 | 
					    const request = req.body as IAddXpRequest;
 | 
				
			||||||
    for (const [category, gear] of Object.entries(request)) {
 | 
					    for (const [category, gear] of Object.entries(request)) {
 | 
				
			||||||
 | 
					        for (const clientItem of gear) {
 | 
				
			||||||
 | 
					            const dbItem = inventory[category as TEquipmentKey].id(clientItem.ItemId.$oid);
 | 
				
			||||||
 | 
					            if (dbItem) {
 | 
				
			||||||
 | 
					                if (dbItem.ItemType in ExportMisc.uniqueLevelCaps) {
 | 
				
			||||||
 | 
					                    if ((dbItem.Polarized ?? 0) < 5) {
 | 
				
			||||||
 | 
					                        dbItem.Polarized = 5;
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        addGearExpByCategory(inventory, gear, category as TEquipmentKey);
 | 
					        addGearExpByCategory(inventory, gear, category as TEquipmentKey);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    await inventory.save();
 | 
					    await inventory.save();
 | 
				
			||||||
 | 
				
			|||||||
@ -155,7 +155,7 @@ export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<
 | 
				
			|||||||
    if (client.Upgrades !== undefined) {
 | 
					    if (client.Upgrades !== undefined) {
 | 
				
			||||||
        replaceArray<IUpgradeDatabase>(db.Upgrades, client.Upgrades.map(convertUpgrade));
 | 
					        replaceArray<IUpgradeDatabase>(db.Upgrades, client.Upgrades.map(convertUpgrade));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    for (const key of ["RawUpgrades", "MiscItems"] as const) {
 | 
					    for (const key of ["RawUpgrades", "MiscItems", "Consumables"] as const) {
 | 
				
			||||||
        if (client[key] !== undefined) {
 | 
					        if (client[key] !== undefined) {
 | 
				
			||||||
            db[key].splice(0, db[key].length);
 | 
					            db[key].splice(0, db[key].length);
 | 
				
			||||||
            client[key].forEach(x => {
 | 
					            client[key].forEach(x => {
 | 
				
			||||||
 | 
				
			|||||||
@ -240,7 +240,14 @@ export const addItem = async (
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
            };
 | 
					            };
 | 
				
			||||||
        } else if (ExportResources[typeName].productCategory == "CrewShips") {
 | 
					        } else if (ExportResources[typeName].productCategory == "CrewShips") {
 | 
				
			||||||
            const inventoryChanges = addCrewShip(inventory, typeName);
 | 
					            const inventoryChanges = {
 | 
				
			||||||
 | 
					                ...addCrewShip(inventory, typeName),
 | 
				
			||||||
 | 
					                // fix to unlock railjack modding, item bellow supposed to be obtained from archwing quest
 | 
				
			||||||
 | 
					                ...(!inventory.CrewShipHarnesses?.length
 | 
				
			||||||
 | 
					                    ? addCrewShipHarness(inventory, "/Lotus/Types/Game/CrewShip/RailJack/DefaultHarness")
 | 
				
			||||||
 | 
					                    : {})
 | 
				
			||||||
 | 
					            };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return { InventoryChanges: inventoryChanges };
 | 
					            return { InventoryChanges: inventoryChanges };
 | 
				
			||||||
        } else if (ExportResources[typeName].productCategory == "ShipDecorations") {
 | 
					        } else if (ExportResources[typeName].productCategory == "ShipDecorations") {
 | 
				
			||||||
            const changes = [
 | 
					            const changes = [
 | 
				
			||||||
@ -810,6 +817,17 @@ const addCrewShip = (
 | 
				
			|||||||
    return inventoryChanges;
 | 
					    return inventoryChanges;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const addCrewShipHarness = (
 | 
				
			||||||
 | 
					    inventory: TInventoryDatabaseDocument,
 | 
				
			||||||
 | 
					    typeName: string,
 | 
				
			||||||
 | 
					    inventoryChanges: IInventoryChanges = {}
 | 
				
			||||||
 | 
					): IInventoryChanges => {
 | 
				
			||||||
 | 
					    const index = inventory.CrewShipHarnesses.push({ ItemType: typeName }) - 1;
 | 
				
			||||||
 | 
					    inventoryChanges.CrewShipHarnesses ??= [];
 | 
				
			||||||
 | 
					    (inventoryChanges.CrewShipHarnesses as object[]).push(inventory.CrewShipHarnesses[index].toJSON());
 | 
				
			||||||
 | 
					    return inventoryChanges;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//TODO: wrong id is not erroring
 | 
					//TODO: wrong id is not erroring
 | 
				
			||||||
export const addGearExpByCategory = (
 | 
					export const addGearExpByCategory = (
 | 
				
			||||||
    inventory: TInventoryDatabaseDocument,
 | 
					    inventory: TInventoryDatabaseDocument,
 | 
				
			||||||
@ -823,12 +841,10 @@ export const addGearExpByCategory = (
 | 
				
			|||||||
            return;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        const itemIndex = ItemId ? category.findIndex(item => item._id?.equals(ItemId.$oid)) : -1;
 | 
					        const item = category.id(ItemId.$oid);
 | 
				
			||||||
        if (itemIndex !== -1) {
 | 
					        if (item) {
 | 
				
			||||||
            const item = category[itemIndex];
 | 
					 | 
				
			||||||
            item.XP ??= 0;
 | 
					            item.XP ??= 0;
 | 
				
			||||||
            item.XP += XP;
 | 
					            item.XP += XP;
 | 
				
			||||||
            inventory.markModified(`${categoryName}.${itemIndex}.XP`);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            const xpinfoIndex = inventory.XPInfo.findIndex(x => x.ItemType == item.ItemType);
 | 
					            const xpinfoIndex = inventory.XPInfo.findIndex(x => x.ItemType == item.ItemType);
 | 
				
			||||||
            if (xpinfoIndex !== -1) {
 | 
					            if (xpinfoIndex !== -1) {
 | 
				
			||||||
 | 
				
			|||||||
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 4.9 KiB  | 
@ -368,7 +368,7 @@
 | 
				
			|||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
            <div data-route="/webui/cheats, /webui/settings" data-title="Cheats | OpenWF WebUI">
 | 
					            <div data-route="/webui/cheats, /webui/settings" data-title="Cheats | OpenWF WebUI">
 | 
				
			||||||
                <div class="row g-3">
 | 
					                <div class="row g-3">
 | 
				
			||||||
                    <div class="col-lg-4">
 | 
					                    <div class="col-md-6">
 | 
				
			||||||
                        <div class="card mb-3">
 | 
					                        <div class="card mb-3">
 | 
				
			||||||
                            <h5 class="card-header">Server</h5>
 | 
					                            <h5 class="card-header">Server</h5>
 | 
				
			||||||
                            <div class="card-body">
 | 
					                            <div class="card-body">
 | 
				
			||||||
@ -479,7 +479,7 @@
 | 
				
			|||||||
                            </div>
 | 
					                            </div>
 | 
				
			||||||
                        </div>
 | 
					                        </div>
 | 
				
			||||||
                    </div>
 | 
					                    </div>
 | 
				
			||||||
                    <div class="col-lg-4">
 | 
					                    <div class="col-md-6">
 | 
				
			||||||
                        <div class="card mb-3">
 | 
					                        <div class="card mb-3">
 | 
				
			||||||
                            <h5 class="card-header">Account</h5>
 | 
					                            <h5 class="card-header">Account</h5>
 | 
				
			||||||
                            <div class="card-body">
 | 
					                            <div class="card-body">
 | 
				
			||||||
@ -488,26 +488,6 @@
 | 
				
			|||||||
                            </div>
 | 
					                            </div>
 | 
				
			||||||
                        </div>
 | 
					                        </div>
 | 
				
			||||||
                    </div>
 | 
					                    </div>
 | 
				
			||||||
                    <div class="col-lg-4">
 | 
					 | 
				
			||||||
                        <div class="card mb-3">
 | 
					 | 
				
			||||||
                            <h5 class="card-header">Client</h5>
 | 
					 | 
				
			||||||
                            <div id="client-cheats-nok" class="card-body">
 | 
					 | 
				
			||||||
                                Client cheats are currently unavailable. This could be because your client is not running or using a DLL without an HTTP interface.
 | 
					 | 
				
			||||||
                            </div>
 | 
					 | 
				
			||||||
                            <div id="client-cheats-ok" class="card-body d-none">
 | 
					 | 
				
			||||||
                                <div class="form-check">
 | 
					 | 
				
			||||||
                                    <input class="form-check-input" type="checkbox" id="skip_mission_start_timer" />
 | 
					 | 
				
			||||||
                                    <label class="form-check-label" for="skip_mission_start_timer">
 | 
					 | 
				
			||||||
                                        Skip Mission Start Timer
 | 
					 | 
				
			||||||
                                    </label>
 | 
					 | 
				
			||||||
                                </div>
 | 
					 | 
				
			||||||
                                <div class="form-group mt-3">
 | 
					 | 
				
			||||||
                                    <label class="form-label" for="fov_override">FOV Override (0 to disable)</label>
 | 
					 | 
				
			||||||
                                    <input id="fov_override" class="form-range" type="range" min="0" value="0" max="2260000" step="10000">
 | 
					 | 
				
			||||||
                                </div>
 | 
					 | 
				
			||||||
                            </div>
 | 
					 | 
				
			||||||
                        </div>
 | 
					 | 
				
			||||||
                    </div>
 | 
					 | 
				
			||||||
                </div>
 | 
					                </div>
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
            <div data-route="/webui/import" data-title="Import | OpenWF WebUI">
 | 
					            <div data-route="/webui/import" data-title="Import | OpenWF WebUI">
 | 
				
			||||||
 | 
				
			|||||||
@ -915,34 +915,6 @@ single.getRoute("/webui/cheats").on("beforeload", function () {
 | 
				
			|||||||
            });
 | 
					            });
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }, 10);
 | 
					    }, 10);
 | 
				
			||||||
 | 
					 | 
				
			||||||
    fetch("http://localhost:61558/ping", { mode: "no-cors" })
 | 
					 | 
				
			||||||
        .then(() => {
 | 
					 | 
				
			||||||
            $("#client-cheats-ok").removeClass("d-none");
 | 
					 | 
				
			||||||
            $("#client-cheats-nok").addClass("d-none");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            fetch("http://localhost:61558/skip_mission_start_timer")
 | 
					 | 
				
			||||||
                .then(res => res.text())
 | 
					 | 
				
			||||||
                .then(res => {
 | 
					 | 
				
			||||||
                    document.getElementById("skip_mission_start_timer").checked = res == "1";
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
            document.getElementById("skip_mission_start_timer").onchange = function () {
 | 
					 | 
				
			||||||
                fetch("http://localhost:61558/skip_mission_start_timer?" + this.checked);
 | 
					 | 
				
			||||||
            };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            fetch("http://localhost:61558/fov_override")
 | 
					 | 
				
			||||||
                .then(res => res.text())
 | 
					 | 
				
			||||||
                .then(res => {
 | 
					 | 
				
			||||||
                    document.getElementById("fov_override").value = parseFloat(res) * 10000;
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
            document.getElementById("fov_override").oninput = function () {
 | 
					 | 
				
			||||||
                fetch("http://localhost:61558/fov_override?" + this.value);
 | 
					 | 
				
			||||||
            };
 | 
					 | 
				
			||||||
        })
 | 
					 | 
				
			||||||
        .catch(function () {
 | 
					 | 
				
			||||||
            $("#client-cheats-nok").removeClass("d-none");
 | 
					 | 
				
			||||||
            $("#client-cheats-ok").addClass("d-none");
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function doUnlockAllFocusSchools() {
 | 
					function doUnlockAllFocusSchools() {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user