Special partner_builds for Razer Forge TV
[stouyapi.git] / README.rst
1 **************************
2 stouyapi - Static OUYA API
3 **************************
4
5 A static API for the OUYA gaming console that still lets you sign in
6 and install games, despite the OUYA server shutdown in 2019.
7
8
9 =====
10 Setup
11 =====
12
13 OUYA config change
14 ==================
15 - Mount via USB (Micro USB cable)
16 - Create file ``ouya_config.properties``
17 - Add::
18
19     OUYA_SERVER_URL=http://stouyapi.boo
20     OUYA_STATUS_SERVER_URL=http://stouyapi.boo/api/v1/status
21
22 The changes should take effect immediately.
23 If they do not, reboot the OUYA once.
24
25
26 OUYA setup
27 ==========
28
29 1. User registration: "Existing account"
30 2. Enter any username, leave password empty. Continue.
31 3. Skip credit card registration
32
33 The username will appear on your ouya main screen.
34
35
36 Apache setup
37 ============
38
39 .. note:: Step-by-step setup instructions can be found in
40           `HOWTO-SETUP.rst <HOWTO-SETUP.rst>`__.
41
42
43 Virtual host configuration::
44
45   <VirtualHost *:80>
46     ServerName stouyapi.test
47     DocumentRoot /path/to/stouyapi/www
48
49     CustomLog /var/log/apache2/stouyapi-access.log combined
50     ErrorLog  /var/log/apache2/stouyapi-error.log
51
52     Script PUT /empty-json.php
53     Script DELETE /api/v1/queued_downloads_delete.php
54
55     <Directory "/path/to/stouyapi/www">
56       AllowOverride All
57       Require all granted
58     </Directory>
59   </VirtualHost>
60
61 The following modules need to be enabled in Apache 2.4
62 (with e.g. ``a2enmod``):
63
64 - ``actions``
65 - ``expires``
66 - ``php`` (or php-fpm via fastcgi)
67 - ``rewrite``
68
69 The virtual host's document root needs to point to the ``www`` folder.
70
71
72 Test your Apache setup
73 ----------------------
74 ::
75
76    # check if normal API routes work
77    $ curl -I http://stouyapi.cwboo/api/firmware_builds
78    HTTP/1.1 200 OK
79    [...]
80
81    # check if rewritten API routes work
82    $ curl -I http://stouyapi.cwboo/api/v1/discover/discover
83    HTTP/1.1 200 OK
84    [...]
85
86    # check if PHP routes work
87    curl -I http://stouyapi.cwboo/api/v1/gamers/me
88    HTTP/1.1 200 OK
89    [...]
90
91
92 Building API data
93 =================
94 Download the OUYA game data repository from
95 https://github.com/ouya-saviors/ouya-game-data
96 and then generate the API files with it::
97
98     $ git clone https://github.com/ouya-saviors/ouya-game-data.git
99     $ ./bin/import-game-data.php ouya-game-data/folders
100
101
102 Building the web discover store
103 ===============================
104 After building the API files, generate the HTML::
105
106   $ ./bin/build-html.php
107
108
109 ===============
110 Push to my OUYA
111 ===============
112 stouyapi's HTML game detail page have a "Push to my OUYA" button that
113 allows anyone to tell his own OUYA to install that game.
114 It works without any user accounts, and is only based on IP addresses.
115
116 If your PC that you click the Push button on and your OUYA have the same
117 public IP address (IPv4 NAT), or the same IPv6 64bit prefix, then
118 the OUYA will install the game within 5 minutes.
119
120 It will also work if you run stouyapi inside your local network, because
121 all private IP addresses are mapped to a special "local" address.
122
123 You can inspect your own download queue by simply opening
124 ``/api/v1/queued_downloads`` in your browser.
125
126
127 ========
128 See also
129 ========
130
131 - https://gitlab.com/devirich/BrewyaOnOuya - alternative storefront
132 - https://archive.org/details/ouyalibrary - Archived OUYA games
133 - https://github.com/ouya-saviors/ouya-game-data/ - OUYA game data repository
134
135
136 ===========
137 Discoveries
138 ===========
139
140 - data/data/tv.ouya/cache/ion/
141
142   - image cache for main menu image
143
144 - Don't put a trailing slash into ``OUYA_SERVER_URL`` - it will make double slashes