<commit_before>/**
 * The API Handler handles all API http requests
 */

/*
 * 2011 Peter 'Pita' Martischka (Primary Technology Ltd)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS-IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


var ERR = require("async-stacktrace");
var fs = require("fs");
var api = require("../db/API");
var padManager = require("../db/PadManager");
var randomString = require('ep_etherpad-lite/static/js/pad_utils').randomString;

//ensure we have an apikey
var apikey = null;
try
{
  apikey = fs.readFileSync("../APIKEY.txt","utf8");
}
catch(e) 
{
  apikey = randomString(32);
  fs.writeFileSync("../APIKEY.txt",apikey,"utf8");
}

//a list of all functions
var functions = {
  "createGroup"               : [],
  "createGroupIfNotExistsFor"  : ["groupMapper"], 
  "deleteGroup"               : ["groupID"], 
  "listPads"                  : ["groupID"], 
  "createPad"                 : ["padID", "text"], 
  "createGroupPad"            : ["groupID", "padName", "text"],
  "createAuthor"              : ["name"], 
  "createAuthorIfNotExistsFor": ["authorMapper" , "name"], 
  "createSession"             : ["groupID", "authorID", "validUntil"], 
  "deleteSession"             : ["sessionID"], 
  "getSessionInfo"            : ["sessionID"], 
  "listSessionsOfGroup"       : ["groupID"], 
  "listSessionsOfAuthor"      : ["authorID"], 
  "getText"                   : ["padID", "rev"],
  "setText"                   : ["padID", "text"],
  "getHTML"                   : ["padID", "rev"],
  "setHTML"                   : ["padID", "html"],
  "getRevisionsCount"         : ["padID"], 
  "deletePad"                 : ["padID"], 
  "getReadOnlyID"             : ["padID"],
  "setPublicStatus"           : ["padID", "publicStatus"], 
  "getPublicStatus"           : ["padID"], <commit_msg>Fix #655, wrong located APIKEY.txt<commit_after>/**
 * The API Handler handles all API http requests
 */

/*
 * 2011 Peter '<NAME> (Primary Technology Ltd)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS-IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


var ERR = require("async-stacktrace");
var fs = require("fs");
var api = require("../db/API");
var padManager = require("../db/PadManager");
var randomString = require('ep_etherpad-lite/static/js/pad_utils').randomString;

//ensure we have an apikey
var apikey = null;
try
{
  apikey = fs.readFileSync("./APIKEY.txt","utf8");
}
catch(e) 
{
  apikey = randomString(32);
  fs.writeFileSync("./APIKEY.txt",apikey,"utf8");
}

//a list of all functions
var functions = {
  "createGroup"               : [],
  "createGroupIfNotExistsFor"  : ["groupMapper"], 
  "deleteGroup"               : ["groupID"], 
  "listPads"                  : ["groupID"], 
  "createPad"                 : ["padID", "text"], 
  "createGroupPad"            : ["groupID", "padName", "text"],
  "createAuthor"              : ["name"], 
  "createAuthorIfNotExistsFor": ["authorMapper" , "name"], 
  "createSession"             : ["groupID", "authorID", "validUntil"], 
  "deleteSession"             : ["sessionID"], 
  "getSessionInfo"            : ["sessionID"], 
  "listSessionsOfGroup"       : ["groupID"], 
  "listSessionsOfAuthor"      : ["authorID"], 
  "getText"                   : ["padID", "rev"],
  "setText"                   : ["padID", "text"],
  "getHTML"                   : ["padID", "rev"],
  "setHTML"                   : ["padID", "html"],
  "getRevisionsCount"         : ["padID"], 
  "deletePad"                 : ["padID"], 
  "getReadOnlyID"             : ["padID"],
  "setPublicStatus"           : ["padID", "publicStatus"], 
  "getPublicStatus"           : ["padID"], 
{'fraction_non_alphanumeric': 0.15499451152579583, 'fraction_numerical': 0.005927552140504939, 'mean_word_length': 2.5845790715971675, 'pattern_counts': {'":': 2, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3805774', 'n_tokens_mistral': 1373, 'n_tokens_neox': 1316, 'n_words': 371}