⌈⌋ branch:  freshcode


Check-in [49047f4b8d]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
SHA1:49047f4b8d710495d1d8eff19bbf269d8c615a5b
Date: 2015-04-21 19:52:03
User: mario
Comment:Return just HTTP 200 status with project:{name:null} on non-existing entries. Alias "hide" and "hidden" fields.
Tags And Properties
  • branch=trunk inherited from [82405bb421]
  • sym-trunk inherited from [82405bb421]
Context
2015-04-29
20:53
[570f97a5af] Summarized changes directly from /changelog (user: mario, tags: trunk)
2015-04-21
19:52
[49047f4b8d] Return just HTTP 200 status with project:{name:null} on non-existing entries. Alias "hide" and "hidden" fields. (user: mario, tags: trunk)
2015-04-20
23:00
[82a553d62c] Separate 501-Not-Implemented for unknown request methods. Copy "image" URL as literal field, but use "image" link from urls{} dict only with valid file "extensions". Use 495-Cert-Error for SSL authorization (status code from nginx). Use HTTP_USER_AGENT now generally as `submitter_openid` placeholder. (user: mario, tags: trunk)
Changes

Changes to handler_api.php.

25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
...
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
...
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
 *    DELETE   projects/<name>/releases/<vs>.json  version_DELETE
 *       GET   feed/<name>.json                    external (data federation)
 *
 * All requests should be sent onto `https://api .freshcode.club/...`,
 * where only CREATE requires a client SSL cert, see `submit.pem`.
 *
 * Retrieval requests usually come with an ?auth_code= token. For POST
 * or PUT access it's part of the JSON request body. Which comes with
 * varying payloads depending on request type:
 *
 *   {
 *     "auth_code": "pw123",
 *     "project": {
 *       "license_list": "GNU GPL",
 *       "project_tags": "kernel,operating-system",
................................................................................
     */
    function dispatch() {
    
        // Fetch latest revision
        $project = new release($this->name);
        if (empty($project["name"]) && ($this->api !== "new_project")) {
            // Return 204 with empty →project→name field.
            $this->error_exit(NULL, "204 No content", "Unknown project name");
        }
        
        // Run dialed method, then output JSON response.
        if ($this->api) {
            $this->json_exit($this->{$this->api}($project));
        }
        else {
................................................................................
        // automatically use NEWS file if present
        if (preg_match("/NEWS/", $new["autoupdate_url"])) {
            $new["autoupdate_module"] = "changelog";
        }
        
        // Update flags
        $flags = array(
            "hidden" => $in->int["hide"], //hidden_from_frontpage  //or empty version,changes
            "deleted" => 0,   // empty title,description,homepage
        );

        return $this->insert($project, $new, $flags);
    }









|







 







|







 







|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
...
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
...
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
 *    DELETE   projects/<name>/releases/<vs>.json  version_DELETE
 *       GET   feed/<name>.json                    external (data federation)
 *
 * All requests should be sent onto `https://api .freshcode.club/...`,
 * where only CREATE requires a client SSL cert, see `submit.pem`.
 *
 * Retrieval requests usually come with an ?auth_code= token. For POST
 * or PUT access it's part of the JSON request body. Which can have
 * varying payloads depending on request type:
 *
 *   {
 *     "auth_code": "pw123",
 *     "project": {
 *       "license_list": "GNU GPL",
 *       "project_tags": "kernel,operating-system",
................................................................................
     */
    function dispatch() {
    
        // Fetch latest revision
        $project = new release($this->name);
        if (empty($project["name"]) && ($this->api !== "new_project")) {
            // Return 204 with empty →project→name field.
            $this->error_exit(NULL, "200 No content", "Unknown project name");
        }
        
        // Run dialed method, then output JSON response.
        if ($this->api) {
            $this->json_exit($this->{$this->api}($project));
        }
        else {
................................................................................
        // automatically use NEWS file if present
        if (preg_match("/NEWS/", $new["autoupdate_url"])) {
            $new["autoupdate_module"] = "changelog";
        }
        
        // Update flags
        $flags = array(
            "hidden" => $in->int["hidden"] || $in->int["hide"] || !empty($new["hidden"]),
            "deleted" => 0,   // empty title,description,homepage
        );

        return $this->insert($project, $new, $flags);
    }