⌈⌋ ⎇ branch:  freshcode


Check-in [49047f4b8d]

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

Overview
Comment:Return just HTTP 200 status with project:{name:null} on non-existing entries. Alias "hide" and "hidden" fields.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 49047f4b8d710495d1d8eff19bbf269d8c615a5b
User & Date: mario 2015-04-21 19:52:03
Context
2015-04-29
20:53
Summarized changes directly from /changelog check-in: 570f97a5af user: mario tags: trunk
2015-04-21
19:52
Return just HTTP 200 status with project:{name:null} on non-existing entries. Alias "hide" and "hidden" fields. check-in: 49047f4b8d user: mario tags: trunk
2015-04-20
23:00
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. check-in: 82a553d62c user: mario tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to handler_api.php.

25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
 *    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",







|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
 *    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",
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
     */
    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 {







|







168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
     */
    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 {
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
        // 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);
    }









|







310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
        // 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);
    }