IrcMiRCARTBot.py, MiRCARTCanvasInterface.py: remove Imgur API key from repository (via aaa, alghazi, amomp, anji, arab, astra, astra`, biobag, biobag__, bj0rn, blomp, boomp, bromp, brr, butts, buttvomit, c003y, Caku, chomp, chrono_, cooey, CosbyX, darkmage_, dboard, dehuman, dOm3r, eddb, efukt, ep^, er, era, eraser, erratic, erratic_, gnomp, gromp, interdom3, JEWS, kobach, l1tup, Lions, lul, lulz, lulzee, lulzy, Matthew, MercyX, moomp, mr_vile, muff, munki, n0v, nk9k, ooomp, OVH, pcap, pinchy, plop, pngbot, poccri, poomp, promp, pump-, pumpbull, pyrex, rain, rObOtNiK, rondito, scd, SEEEEN, Shapes, snadge, spidy, spinsane, spoke, spomp, stomp, TACO, tetedupet, toohighto, tromp, twomp, vap0r, vapor, venus, virtuald, vixen, whomp, wreathman, wromp, yoomp, z0z0, zen_, and zoomp.)

This commit is contained in:
Lucio Andrés Illanes Albornoz 2018-05-24 08:52:20 +02:00
parent e5ef8503c6
commit 19b29d1714
5 changed files with 37 additions and 3 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
MiRCARTImgurApiKey.py
__pycache__/
*.sw[op]

View File

@ -28,12 +28,14 @@ import json
import IrcClient
import requests, urllib.request
from MiRCARTCanvasImportStore import MiRCARTCanvasImportStore
from MiRCARTImgurApiKey import MiRCARTImgurApiKey
from MiRCARTToPngFile import MiRCARTToPngFile
class IrcMiRCARTBot(IrcClient.IrcClient):
"""IRC<->MiRC2png bot"""
clientChannelLastMessage = clientChannelOps = clientChannel = None
clientChannelRejoin = None
imgurApiKey = MiRCARTImgurApiKey.imgurApiKey
# {{{ ContentTooLargeException(Exception): Raised by _urlretrieveReportHook() given download size > 1 MB
class ContentTooLargeException(Exception):
@ -154,7 +156,7 @@ class IrcMiRCARTBot(IrcClient.IrcClient):
canvasStore.outMap.insert(0, [[1, 1, 0, " "]] * len(canvasStore.outMap[0]))
canvasStore.outMap.append([[1, 1, 0, " "]] * len(canvasStore.outMap[0]))
MiRCARTToPngFile(canvasStore.outMap, "DejaVuSansMono.ttf", 11).export(imgTmpFilePath)
imgurResponse = self._uploadToImgur(imgTmpFilePath, "MiRCART image", "MiRCART image", "c9a6efb3d7932fd")
imgurResponse = self._uploadToImgur(imgTmpFilePath, "MiRCART image", "MiRCART image", self.imgurApiKey)
if imgurResponse[0] == 200:
self._log("Uploaded as: {}".format(imgurResponse[1]))
self.queue("PRIVMSG", message[2], "8/!\\ Uploaded as: {}".format(imgurResponse[1]))

View File

@ -27,6 +27,7 @@ from MiRCARTCanvasJournal import MiRCARTCanvasJournal
from MiRCARTCanvasExportStore import MiRCARTCanvasExportStore, haveMiRCARTToPngFile, haveUrllib
from MiRCARTCanvasImportStore import MiRCARTCanvasImportStore
from MiRCARTCanvasInterface import MiRCARTCanvasInterface
from MiRCARTImgurApiKey import MiRCARTImgurApiKey
import wx
class MiRCARTCanvas(wx.Panel):
@ -38,6 +39,7 @@ class MiRCARTCanvas(wx.Panel):
canvasBackend = canvasJournal = None
canvasExportStore = canvasImportStore = None
canvasInterface = None
imgurApiKey = MiRCARTImgurApiKey.imgurApiKey
# {{{ _commitPatch(self, patch): XXX
def _commitPatch(self, patch):

View File

@ -34,6 +34,7 @@ import os, wx
class MiRCARTCanvasInterface():
"""XXX"""
imgurApiKey = None
parentCanvas = parentFrame = canvasPathName = canvasTool = None
# {{{ _dialogSaveChanges(self)
@ -136,8 +137,8 @@ class MiRCARTCanvasInterface():
# {{{ canvasExportImgur(self, event): XXX
def canvasExportImgur(self, event):
self.parentCanvas.SetCursor(wx.Cursor(wx.CURSOR_WAIT))
imgurResult = self.parentCanvas.canvasExportStore.exportBitmapToImgur( \
"c9a6efb3d7932fd", self.parentCanvas.canvasBackend.canvasBitmap, \
imgurResult = self.parentCanvas.canvasExportStore.exportBitmapToImgur( \
self.imgurApiKey, self.parentCanvas.canvasBackend.canvasBitmap, \
"", "", wx.BITMAP_TYPE_PNG)
self.parentCanvas.SetCursor(wx.Cursor(wx.NullCursor))
if imgurResult[0] == 200:

View File

@ -0,0 +1,28 @@
#!/usr/bin/env python3
#
# MiRCARTImgurApiKey.py -- melp?
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
class MiRCARTImgurApiKey(object):
imgurApiKey = None
# vim:expandtab foldmethod=marker sw=4 ts=4 tw=120