Code Monkey home page Code Monkey logo

destinystatus's Introduction

DestinyStatus

Join the chat at https://gitter.im/TrackerNetwork/DestinyStatus Build Status

This project is based on the Laravel framework [v7.x].

Understanding Branches

  • master - developer branch of production destinystatus.com (automatic deploy)
  • destiny1 - legacy version of d1.destinystatus.com
  • legacy - original Laravel 4.2 version of d1 destinystatus

Project dependencies:

Install the framework

  1. Copy the file .env.example to .env
  2. Edit .env with any information needed (Bugsnag, environment, db information)
  3. Visit the Destiny API Registration Portal to sign up for an API key
  4. Add your key to .env under the DESTINY_KEY
  5. Add your oauth information to .env under the BUNGIE_CLIENT (client id) and BUNGIE_SECRET (client secret) codes.
  6. Remember that the API key and oauth information need to be from same Application at Bungie.
  7. composer install
  8. php artisan key:generate
  9. php artisan migrate

Compile CSS/JS

  1. Install yarn.
  2. Install node dependencies: yarn install
  3. Build:
    • Local: yarn run dev
    • Production: yarn run prod

Things to know

  1. DESTINY_CACHE_DEFAULT is the default for endpoint caches. We tend to use 5 minutes. That is enough time for people to load a profile, spam a few clicks around the site and keep getting fed cache values instead of API. Any value over 5 minutes adds a message to the homepage explaining the reason for out of date stats.

  2. PROXY_URL is the URL to a service that takes a request and simply proxies it onward, this allows us to get around API limits as a server side application cannot issue requests as fast as the users use the product.

  3. BUGSNAG_API_KEY is for the Bugsnag service. This tracks all PHP/Destiny errors, this lets us quickly know what clan/profile/page is broken.

  4. php artisan destiny:manifest --download will force a redownload of the Manifest and process all entities into the file system.

  5. php artisan destiny:medal [give|take] gamertag console badge is the command for giving/taking badges. For example php artisan destiny:medal give iBot xbl donator gives iBot on Xbox Live the donator badge.

destinystatus's People

Contributors

dependabot[bot] avatar gmsteuart avatar ibotpeaches avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

destinystatus's Issues

Login via Bungie

Lots of sites now have the ability to authenticate through Bungie. This gives you access to those endpoints and more on behalf of the user authenticating. We can enable this to

  1. Save the user viewing for quick access
  2. Access endpoints that may be blocked for public access, but authenticated access over that user
  3. Confirm that user has signed into DS before, perhaps a "Confirmed" badge

Prettify XBL profile urls

The links to Xbox profiles at the moment are: http://destinystatus.com/xbl/HT%20xorth.

Since the - character is an illegal character in gamertags we can replace the space like this:
http://destinystatus.com/xbl/HT-xorth

Missing app/config folder

Had to cross reference the composer.json file to figure out which dependencies needed to be added to /app/config/app.php and more. I understand probably db keys, secret keys and so on are in configurations and ENV isn't available in 4.2.

So maybe just commit the stock 4.2 config folder + the dependency needed changes. Developers can add in own api key, db, etc.

Add T3-COO next to nightfall

Since the weekly was removed, there is empty space. T3 follows a strict cycle and can be coded in if not available through the API

Record Book Final Steps

  • - Add JS tooltip feature from DestinyTracker
  • - Completion Book percentage complete on intro page
  • - Force a Page 0 on all books with an overview page (Description, percent complete, other random stats)
  • - Order books by release date
  • - Move tab storage to localStage (stop storing cookies)
  • - Total percentage complete per page in addition to total book.

Investigate Legacy/Private/Salvagable modes that D1 had.

In D1 of DS we had some interesting problems

  1. Legacy - An Xbox 360 / PS3 could no longer use the site after a random Bungie update. Since the platforms for D2 are Xbox/PSN/PC, I don't imagine we will need Legacy anymore. This can be removed.

  2. Private - Accounts could make their advisors/inventory private from the public endpoints. This meant we had to survive without that data. This meant that we'd simply not show advisors and explain to the user that account is private. In D2, lets provide a link in case that user is the user searched so they can fix their settings.

  3. Salvageable - A lot of times in D1, API endpoints would just stop working. This was advisors, xur, progress and more. The problem is the entire profile died because this wasn't available. We introduced something known as salvagable, which would allow the request to fail and just skip that data from the view. The only request that wasn't salvagable was the main profile request.

Merged Stats - Count Activities

Question: How can I see raid completion figures for a gamer tag, combined across all characters? "Stats" offers combined figures across all characters, but nothing to accommodate Raid figures which only appear under "checklist".

We need to add 3 endpoints, aggregate for all 3 chars on this page. Iterate them all, storing/summing them into one final. Store counts of activities. Order by Story, Strikes, Raids

Move to JS - AJAX - CORS

So Tetron dropped a bomb - https://www.bungie.net/en/Clan/Post/39966/216552251/0/0

In short, you can register your host with Bungie and make requests client side against their API. This is great because the IP limitation is pushed onto the clients instead of our servers so the need for proxies is gone.

The newest problem is our entire logic for parsing data, reading it, rendering it needs to move the JS level. However, we can skip this massive need for a rewrite by chaining the power of events/promises. Our goal.

  1. Page Load.
  2. Character at a time or tab at a time, not sure. We either send 4 requests per character, or 3 requests for each tab 4 times.
  3. Once the CORS request from client -> bungie returns, we will send that data to server and it will be parsed and rendered when PJAX will take over and render that block/fragment.

Badges

People love badges, aka DestinyTrialsReport. While I might need to work with DestinyTracker to work out a way for donations to be processed (So we can have a donation badge, but money goes back to those hosting it - aka DestinyTracker) or we can just roll a manual process of donations to DestinyTracker with "DestinyStatus" included in title can be forward for a manual badge approval.

We won't do challenges or anything. That would be flat out copying, but a limited number of badges like

  • Donator - donated (manual)
  • Confirmed - Signed into account through Bungie.net into DS (Automated)
  • Committer - Anyone who committed to DS (manual)
  • Veteran - Has D1 stats associated with the account (Automated)

The Automated badges will be processed and inserted into the badge table. Using membershipId and membershipType so renames won't effect anything.

Two CLI commands badge award|remove membershipId membershipType badge will be used to give badges for the manual ones.

Support for PC, in addition to PSN/Xbox

The problem with codebase is its littered with if xbox, then psn. This is no longer the case. Lots of methods need to be adapted for 3 platform support. This includes the loose search and select screen.

The profile needs to list the platform using the url identifier - pc.

Unicode character urldecoding

Firstly, I think your site is great and has been very useful!

I noticed a problem with the grimoire generation of the following URL:
http://db.destinytracker.com/grimoire/enemies/exalted-hive/ir-yut-the-deathsinger

The generated URL is:
http://db.destinytracker.com/grimoire/enemies/exalted-hive/ir-yt-the-deathsinger

Having had a quick glance over the codebase (familiarity with Laravel is minimal), I noticed that the following could potentially strip the character away:

function slug($name)
{
/*
This method generates url slugs:
- Converts accented characters
- Makes the string lowercase
- Converts multiple spaces to one
- Trim to a max length of 45 characters.
- Replace spaces with hypens.
*/
$name = html_entity_decode($name);
$name = strtolower(iconv("UTF-8", "ASCII//TRANSLIT//IGNORE", $name));
$name = preg_replace('/[^a-z0-9 -]/', '', $name);
$name = preg_replace('!\s+!', ' ', $name);
$name = trim(mb_strimwidth($name, 0, 45));
$name = str_replace(' ', '-', $name);
return $name;
}

Apologies as I have not got a development setup so was unable to test this more thoroughly.

April Update Cleanup

  1. New PoE (Taken) is not like the others in terms of API. Each week has a different "activityHash", but then there is a Hash for the Playlist. This is like the new Nightfall endpoint. We have to change up the detection because in the current state it will never match thus always return 0 completed and never completed for that week. Additional there are Skulls and Bonuses instead of flat out Skulls. Finally there are also scores.
  2. The advisors endpoint might be easier to use than levering activities and summary. I could be spitting nonsense, but I just need to familiarize myself with the endpoints and how they relate to DS. Maybe we can cut down # of requests made.
  3. The max light & level is wrong in code but doesn't seem to matter.
  4. Could clean-up homepage. Upcoming Trials card, Weekly/Daily Crucible cards, Arena Taken PoE card.

Notes as I discovered changed things. Nothing dead and broken so thats good.

pretty numbers on stats page

So sometimes for me, looking at 8 digits in a row 00000000 is difficult for me to process what that number is. Simply creating a new mutator for formattedValues which allows us to return formatted numbers like so.

commas

vs the old

old

However, then I realized not all locales use this method. Maybe a locale aware (just read request heads for Accept-Language or HTTP_ACCEPT_LANGUAGE - I think browsers sent this). If we can find a locale based on those properties we can instruct the framework to use it.

CSP, Security, SSL & More

My goal with DestinyStatus v3 is to really step up the security of things.

  • CSP rules relaxed enough to work with Google ads / Google Analytics
  • Forced SSL at the nginx level so PHP doesn't have to worry about it
  • Any non-SSL source will be rejected (Assets/Plugins/etc)
  • Investigate if HTTP2 is possible with the software stack we have
  • Treat 403 as 404 at nginx level, don't need to expose no permission pages
  • Confirm GZIP compression is enabled on nginx server block
  • Add able "X-Frame" protections (may be limited by ads)
  • Use Strict-Transport-Security
  • Drop cipher list down to acceptable, explicitly drop MD5
  • Investigate security of PHP
  • Investigate security of Redis (if using)

Should "Activities Cleared" count patrol?

As far as I know, patrol missions can't be cleared... I have cleared all the story missions I've started, but DS shows 19/25 as cleared. Or is this one of those things that can't be helped since Bungie counts them that way?

Moving to `/summary/` endpoints.

Returns Destiny account information for the supplied membership. DEPRECATED - Please use GetAccountSummary instead, pretty please with sugar on top. Seriously, we'll be BFFs 4 evah.

Returns the inventory for the supplied character. DEPRECATED - please use GetCharacterInventorySummary, pretty please with sugar on top.

https://www.bungie.net/platform/destiny/help/

We use Deprecated endpoints. I can see why they are deprecated. They are huge in comparison to the summary endpoints. Though we lose a great deal of detail that those endpoints have. Thankfully the manifest feels that void.

We simply cross reference the summary endpoints and fill in the missing details from our cached manifest. Boom. PR incoming.

Private Users

I'm not sure what endpoint is protected yet, but a few accounts return

The user has chosen for this data to be private. No peeking!

So one of the endpoints we use is throwing this and then killing entire viewing of profile. Lets see if we can load a slim view if a private user is encountered.

ExampleException in home#example

Test error in Example.com

ExampleException in home#example
Something really bad happened

View on Bugsnag

Stacktrace

app/controllers/home_controller.rb:123 - example
app/controllers/other_controller.rb:12 - broken
lib/important/magic.rb:4 - load_something

View full stacktrace

Created by Connor via Bugsnag

Suggestion/Request

I think it'd be nice to have a site that indicated which of your characters has successfully completed the Black Spindle task. Would this be something you guys could add to this site?

Rate Limiting

The current system does not have rate limiting implemented (it sends out tons of errors to Bugsnag)

To counter this we need to implement a rate limit at 250 requests per 10 seconds (25/s)

D2 Endpoints to map

system

  • Destiny2.GetDestinyManifest
  • Destiny2.SearchDestinyPlayer
  • Destiny2.GetPublicMilestoneContent ?
  • Destiny2.GetPublicMilestones

profile

  • Destiny2.GetProfile
  • Destiny2.GetCharacter
  • Destiny2.GetVendors
  • Destiny2.GetDestinyAggregateActivityStats
  • Destiny2.GetHistoricalStatsForAccount

clan

  • Destiny2.GetClanWeeklyRewardState

Leaderboard endpoints will be left best for others. We might dab in clan endpoints a tad as it provides a "status" of your clan which is what we are about :)

Player Name input validation

The profile search box does not properly validate the entered values.

It should be limited to 16 characters which is the maximum for PSN (15 for XBL). The only allowed characters should be: a-zA-Z0-9 _-.

The API method should also check for this so we don't send invalid requests to the Bungie API.

Enhanced GetProfile Request

So D2 uses components now. You include the components you want in request and get those back. So we can ask for exactly what we want. So lets extend requests to a DestinyProfileRequest that has methods for compounding the components.

  • VendorReceipts
  • ProfileInventories
  • ProfileCurrencies
  • Profiles
  • Kiosks
  • Characters
  • CharacterInventories
  • CharacterProgressions
  • CharacterRenderData
  • CharacterActivities
  • CharacterEquipment

I've bolded the components I think DestinyStatus will need to make a profile.

Laravel 5.1 / New Homepage / Advisors v2 - Completed

So I'm done or enough for edge cases to be found. Merge requests won't work, since it actually is a brand new project. The recommendation action for a Laravel 4.2 to Laravel 5.1 upgrade was a new project and move in the needed dependencies.

I would recommend this course of action for getting my new branch to track as master here.

git clone [email protected]:TrackerNetwork/DestinyStatus.git
cd DestinyStatus
git checkout -b legacy
git push origin legacy
git branch -D master
git remote add peaches [email protected]:iBotPeaches/DestinyStatus.git
git fetch peaches -v
git checkout peaches/feature/laravel51
git checkout -b master
git push origin master -f

Basically what this does.

  1. Clones brand new project for clean slate.
  2. Checks out existing master branch to legacy. This will become the home of the 4.2 Laravel install (old).
  3. Delete the old tracking master which is now tracked in legacy and push legacy to remote.
  4. Add my remote and pull it down, then check out my Laravel51 branch.
  5. From that branch (feature/laravel51), check out a new master branch.
  6. The new master is based off feature/laravel51 now.
  7. Force push that master to repo.

Alternatively to the above. Rename this repo to [Deprecated] in favour of a new one, which would have a clean bug tracker and the Laravel 5.1 install, in which I could push the fresh repo to.

The recap of changes

  • DTR links to all weapons still there
  • The new ad system (from that commit 6 hours ago)
  • HTTPS assets
  • 3 minute cache for profiles (saves people clicking between Grimoire/Profile)
  • [net -3 requests] from previous iteration
  • Checklist tracks (Nightfall, PVP/PVE Daily, All Raids, All Arenas)
  • All bower stuff removed (including random ruby dependency)
  • Laravel Elixir is used (gulp --production) to build the public assets. Compiled assets are not tracked in repo now.
  • Laravel .env feature is used for environment control. After a clone on production, the hidden file .env is used for configuration. The bugsnag api key, destiny api key, etc should all be in there.

Todo

  • Module for XUR (to show weapons)
  • Module for SRL (unknown what it would show)
  • Module for ArmsDay (unknown what to show, weapons seem boring)
  • Add support for ROI Raid

A production styled demo has been installed here - http://destiny.ibotpeaches.com/ (It is running in production so ads are shown, etc).

Tweet/gitter/hangouts me if you wanna talk live about it since its obviously a huge change.

Autocomplete names

A big feature of other sites is the ability to type names and have auto complete help you. This helps for those strange names that are like iLiLiL xXx r0aDsniPes, so after a profile is successfully loaded lets record the following in a new table

  • name - proper capitalization
  • slug - name, slugged
  • membershipId
  • membershipType
  • last_updated

index on name.

A fear is during a name change, this information may incorrect. So during every profile load, do a simple query for slug & membershipId & membershipType. If that isn't found, delete the records with that same membershipId and membershipType and insert a new one.

This will be API`d to the search bar on the front page.

This is a enhancement to be done after initial D2 support.

Survive with down endpoints

So the stats and activity history endpoints are down, coming up on 48 hours. This breaks the profiles completely. We can survive without vendors, because we disable the checklist. However, the stats endpoint ties into header and stats tab and runs in the account/stats pull before the other endpoints are requested, so if it dies, the page dies.

This leads to the "Destiny is offline" message. Need to adapt the request system to have an additional parameter for each request. This could be called salvageable or something. This variable would be used for requests that fail that we can recover from. We can survive without inventory - just hide that tab. We can survive without vendors - just hide the checklist tab. We can survive without progressions - just hide the progression tab. We can survive without stats - just hide the stats and tweak header. The only request we actually need is account endpoint. The rest we can hide info and recover from. The UI and logic needs massive work for this, but then DestinyStatus can remain functioning no matter the endpoint down.

I'd hoped this would be short term, but long term fixes for these problems look weeks away. Its best to patch DestinyStatus just in case this happens in the future.

Snippet of D1 stats on D2 profiles

A common request I've heard is to get a snippet of D1 stats (On a D2 profile) if they exist. This allows someone to tell if anyone has experience in pvp/raid in the previous game, which will be key as D2 is new.

However, the D1 version of DS has no support for stored data. Data after 59 minutes of any request is gone until the next request. This keeps things very fresh and no dependency on a DB.

I will implement a single db table for storing a couple fields

  • membershipId
  • membershipType
  • raidCompletions
  • totalPlaytime
  • kd (pvp)
  • grimoire
  • last_updated

This can be API`d locally, or even have the D2 iteration of DS talk to the same db/table that D1 will populate. If the request for data fails, a queue will be made to request this data outside of the normal request. This will load the needed data to create this record and then add it to the table, so the future request will work.

  • D1 saving component when viewing validated records
  • DB element
  • console command for D1 to trigger update
  • caller for D2 to call D1 console

Interesting Character Failure

Can you also fix the fact that when i look up my GT(Goldenfang) it comes back with the stats of another GT(Golden Fang)?

API returns 2 accounts on XBL

  • GoldenFang (XBL)
  • Golden Fang (XBL)

Our Character switcher can handle cross platform, but not same platform so it tosses out the first one when it overwrites, then only one account exists (Golden Fang)

Checkmark incorrect for 390LL Featured (WoTM only?)

Not for me.

Look at my characters: http://destinystatus.com/psn/LucentBeam

My Warlock and Hunter have done full raids this week (note how Normal and Heroic are checked off), but their full raids were from the Featured raid, which is not checked off. My Titan, however, does not have a check for completion on any raid: I did only Aksis P2 on my Titan (accurately shows I did it twice as featured boss). The completion is not checked off for anyone.

For reference, here's how checklist.net is showing it to confirm my story:

https://www.destinychecklist.net/tabs/2/lucentbeam

Laravel 5.1 Upgrade

Lots of the talk on Reddit/chat already has been upgrading to Laravel 5.1, I don't see any immediate concern to upgrade, but if the production server has PHP 5.5 then I don't see why not.

The upgrade path has to go 4.2 -> 5.0 -> 5.1 (The 4.2 -> 5.0) jump is the big one, but I thought I would document what caught my eye in looking at this upgrade.

  • Update controllers w/ proper namespacing
  • The PSR4 app/destiny namespace is already registered so should work fine.
  • The 5.1 ENV systems means all configurations need to be moved to .env and abstracted in loading.
  • The AssetBuster 4.2 dependency doesn't exist in 5.1, because of the addition of Laravel's exlixir.
  • Guzzlehttp 5.0 might work in 5.1, but maybe the new version required is 6.0 which has changes to syntax

The real problem area is the Exlixir/Asset manager change. Lots of changes required there.

Character Ordering

My main is my warlock and it's on the far right and on mobile on the bottom. Profile..

Need to order better, not sure how. Number of games? Time played? Last played?

Raid Completion Difference

As of this moment, if I go to the "checklist" and add up all the raids in the 'Raids' section the result is '169'.

My 'RAIDS INTRODUCTION' grim card at bungie.net shows 165 completions.

XB1 GT: L0r3

Minor bug.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.