mirror of
https://github.com/linuxserver/Heimdall-Apps.git
synced 2026-02-20 04:16:08 +08:00
Add ArchiSteamFarm enhanced app
This commit is contained in:
parent
5013bbfdc0
commit
abf4bb1ef2
65
ArchiSteamFarm/ArchiSteamFarm.php
Normal file
65
ArchiSteamFarm/ArchiSteamFarm.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php namespace App\SupportedApps\ArchiSteamFarm;
|
||||
|
||||
use Carbon\Carbon;
|
||||
|
||||
class ArchiSteamFarm extends \App\SupportedApps implements \App\EnhancedApps {
|
||||
|
||||
public $config;
|
||||
|
||||
//protected $login_first = true; // Uncomment if api requests need to be authed first
|
||||
//protected $method = 'POST'; // Uncomment if requests to the API should be set by POST
|
||||
|
||||
function __construct() {
|
||||
//$this->jar = new \GuzzleHttp\Cookie\CookieJar; // Uncomment if cookies need to be set
|
||||
}
|
||||
|
||||
public function test()
|
||||
{
|
||||
if(!isset($this->config->password))
|
||||
{
|
||||
echo "Invalid password";
|
||||
return;
|
||||
}
|
||||
|
||||
$test = parent::appTest($this->url('status?password='.$this->config->password));
|
||||
echo $test->status;
|
||||
}
|
||||
|
||||
public function livestats()
|
||||
{
|
||||
if(!isset($this->config->password))
|
||||
return parent::getLiveStats("Inactive", []);
|
||||
$status = 'inactive';
|
||||
$res = parent::execute($this->url('api/bot/asf?password='.$this->config->password));
|
||||
$details = json_decode($res->getBody());
|
||||
|
||||
$totalSecondsLeft = 0;
|
||||
$cardToFarmLeft = 0;
|
||||
foreach ($details->Result as $bot) {
|
||||
foreach ($bot->CardsFarmer->GamesToFarm as $game) {
|
||||
$cardToFarmLeft += $game->CardsRemaining;
|
||||
}
|
||||
if(preg_match("@([0-9].*).([0-9]+):([0-9]+):([0-9]+)@", $bot->CardsFarmer->TimeRemaining, $matches))
|
||||
{
|
||||
$totalSecondsLeft += $matches[1] * 24 * 60 * 60; // Days
|
||||
$totalSecondsLeft += $matches[2] * 60 * 60; // Hours
|
||||
$totalSecondsLeft += $matches[3] * 60; // Minutes
|
||||
$totalSecondsLeft += $matches[4]; // Seconds
|
||||
}
|
||||
}
|
||||
|
||||
$d = Carbon::now();
|
||||
$d->addSeconds($totalSecondsLeft);
|
||||
$data = [
|
||||
"time_left" => $d->diffForHumans(null, true, true, 3),
|
||||
"cards_left" => $cardToFarmLeft,
|
||||
];
|
||||
return parent::getLiveStats($status, $data);
|
||||
|
||||
}
|
||||
public function url($endpoint)
|
||||
{
|
||||
$api_url = parent::normaliseurl($this->config->url).$endpoint;
|
||||
return $api_url;
|
||||
}
|
||||
}
|
||||
10
ArchiSteamFarm/app.json
Normal file
10
ArchiSteamFarm/app.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"appid": "7779bfb41003301f1b395c0691002423773d68c1",
|
||||
"name": "ArchiSteamFarm",
|
||||
"website": "https://github.com/JustArchiNET/ArchiSteamFarm",
|
||||
"license": "Apache License 2.0",
|
||||
"description": "ASF is a C# application with primary purpose of idling Steam cards from multiple accounts simultaneously. Unlike Idle Master which works only for one account at given time, while requiring Steam client running in the background and launching additional processes imitating \"game playing\" status, ASF doesn't require any Steam client running in the background, doesn't launch any additional processes and is made to handle unlimited Steam accounts at once. In addition to that, it's meant to be run on servers or other desktop-less machines, and features full cross-OS support, which makes it possible to launch on any operating system with .NET Core runtime, such as Windows, Linux and OS X. ASF is possible thanks to gigantic amount of work done in marvelous SteamKit2 library.\r\n\r\nToday, ASF is one of the most versatile Steam power tools, allowing you to make use of many features that were implemented over time. Apart from idling Steam cards, which remains the primary focus, ASF includes bunch of features on its own, such as a possibility to use it as Steam authenticator or chat logger. In addition to that, ASF includes plugin system, thanks to which anybody can further extend it to his/her needs.",
|
||||
"enhanced": true,
|
||||
"tile_background": "dark",
|
||||
"icon": "archisteamfarm.png"
|
||||
}
|
||||
BIN
ArchiSteamFarm/archisteamfarm.png
Normal file
BIN
ArchiSteamFarm/archisteamfarm.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 36 KiB |
15
ArchiSteamFarm/config.blade.php
Normal file
15
ArchiSteamFarm/config.blade.php
Normal file
@ -0,0 +1,15 @@
|
||||
<h2>{{ __('app.apps.config') }} ({{ __('app.optional') }}) @include('items.enable')</h2>
|
||||
<div class="items">
|
||||
<div class="input">
|
||||
<label>{{ strtoupper(__('app.url')) }}</label>
|
||||
{!! Form::text('config[override_url]', (isset($item) && isset($item->getconfig()->override_url) ? $item->getconfig()->override_url : null), array('placeholder' => __('app.apps.override'), 'id' => 'override_url', 'class' => 'form-control')) !!}
|
||||
</div>
|
||||
<div class="input">
|
||||
<label>{{ __('app.apps.password') }}</label>
|
||||
{!! Form::text('config[password]', (isset($item) && isset($item->getconfig()->password) ? $item->getconfig()->password : null), array('placeholder' => __('app.apps.password'), 'data-config' => 'password', 'class' => 'form-control config-item')) !!}
|
||||
</div>
|
||||
<div class="input">
|
||||
<button style="margin-top: 32px;" class="btn test" id="test_config">Test</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
19
ArchiSteamFarm/livestats.blade.php
Normal file
19
ArchiSteamFarm/livestats.blade.php
Normal file
@ -0,0 +1,19 @@
|
||||
<ul class="livestats">
|
||||
@if(isset($time_left))
|
||||
<li>
|
||||
<span class="title">Time</span>
|
||||
<strong>{{ $time_left }}</strong>
|
||||
</li>
|
||||
@else
|
||||
<li>
|
||||
<span class="title">Connection failed</span>
|
||||
<strong></strong>
|
||||
</li>
|
||||
@endif
|
||||
@if(isset($cards_left))
|
||||
<li>
|
||||
<span class="title">Cards</span>
|
||||
<strong>{{ $cards_left }}</strong>
|
||||
</li>
|
||||
@endif
|
||||
</ul>
|
||||
Loading…
x
Reference in New Issue
Block a user