コード例 #1
0
ファイル: server.py プロジェクト: freabemania/assemblysrv
 def GET(self, targetuid, key, val):
     uid = check_headers()
     if utils.is_admin(uid):
         utils.add_user_attribute(targetuid, key, val)
         return result_ok()
     else:
         return result_nok()
コード例 #2
0
ファイル: server.py プロジェクト: freabemania/assemblysrv
    def GET(self):
        uid = check_headers()
        if uid is None:
            return result_nok()

        utils.add_user_attribute(uid,'lastlogin', datetime.datetime.now().strftime("%Y-%m-%d %H:%M"))
        return result_ok()
コード例 #3
0
ファイル: server.py プロジェクト: freabemania/assemblysrv
    def GET(self):
        uid = check_headers()
        if uid is None:
            return result_nok()

        utils.add_user_attribute(uid,'notifications', 'true')
        return result_ok()
コード例 #4
0
ファイル: assembly64.py プロジェクト: freabemania/assembly
    def on_open(self, e):
        global dir_name
        dlg = wx.DirDialog (None, "Choose input directory", "" , wx.DD_DEFAULT_STYLE | wx.DD_DIR_MUST_EXIST)
        if dlg.ShowModal() == wx.ID_OK:
            dir_name = dlg.GetPath()
        dlg.Destroy()

        if len(dir_name) > 0:
            utils.add_user_attribute(work_dir_key,dir_name)
            update_tree_view(self)
コード例 #5
0
ファイル: assembly64.py プロジェクト: freabemania/assembly
    def remove_from_view(self, e):
        dlg = wx.MessageDialog(self,'Are you sure?', 'Remove %s from view' % item.name ,wx.OK|wx.CANCEL | wx.ICON_QUESTION)
        if dlg.ShowModal() == wx.ID_OK:
            post_ga_event('application_click','hide_%s' % item.name)
            utils.add_user_attribute('exclude_%s' % item.name,'true')
            update_tree_view(self)
            dlg.Destroy()
        else:
            dlg.Destroy()
            return

        if os.path.exists('%s/%s/' % (dir_name, item.folder)):
            dlg = wx.MessageDialog(self,'Are you sure?', 'Folder was already installed, delete contents on disk?',wx.OK|wx.CANCEL | wx.ICON_QUESTION)
            if dlg.ShowModal() == wx.ID_OK:
                log_info('Deleting current folder %s' % item.folder)
                Thread(target=delete_folder,args=(self,item)).start()
                utils.delete_db(dir_name,item)
コード例 #6
0
ファイル: dialogs.py プロジェクト: freabemania/assembly
    def saveandclose_dialog(self, event):
        utils.add_user_attribute(delete_files_after_install,utils.bool2str(self.delete_after_unzip.GetValue()))
        mail = self.mail_field.GetValue()
        if len(mail) > 0:
            if not utils.is_valid_mail(mail):
                wx.MessageBox('Invalid format for mail address', 'Assembly Error',wx.OK | wx.ICON_WARNING)
                return

        if not utils.set_mail(self.uid, mail):
            wx.MessageBox('Unable to store mailaddress.', 'Assembly Error',wx.OK | wx.ICON_WARNING)
            return

        if len(mail) > 0:
            if self.notifications.IsChecked():
                if not utils.set_notifications(self.uid, True):
                    wx.MessageBox('Unable to activate notificationsetting.', 'Assembly Error',wx.OK | wx.ICON_WARNING)
                    return
            else:
                if not utils.set_notifications(self.uid, False):
                    wx.MessageBox('Unable to deactivate notificationsetting.', 'Assembly Error',wx.OK | wx.ICON_WARNING)
                    return

        self.Destroy()
コード例 #7
0
ファイル: dialogs.py プロジェクト: freabemania/assembly
 def OnDone(self,event):
     utils.add_user_attribute('show_info_popup',self.always_show.GetValue())
     self.Destroy()
コード例 #8
0
ファイル: server.py プロジェクト: freabemania/assemblysrv
 def GET(self, mail):
     uid = check_headers()
     if uid is None:
         return result_nok()
     utils.add_user_attribute(uid,'mail',mail)
     return result_ok()
コード例 #9
0
ファイル: assembly64.py プロジェクト: freabemania/assembly
    def OnInit(self):
        global client_id

        utils.assert_folders()
        utils.migrate_from_tmp()
        try:
            setup_log()
        except:
            wx.MessageBox('Another instance of Assembly is running', 'Unable to start',wx.OK | wx.ICON_ERROR)
            sys.exit(0)

        platform = utils.get_platform()
        auto_upgrade = utils.string2bool(platform['autoupgrade'])

        if len(sys.argv) > 1:
            utils.add_user_attribute('show_info_popup','True')
            utils.delete_folder_async('%s/upgrade' %os.getcwd())
            wx.MessageBox('Congratulations! Assembly64 was upgraded from version %s to %s.' %(sys.argv[1], version), 'Assembly64 upgraded!',wx.OK | wx.ICON_INFORMATION)

        try:
            utils.update_server_db()
            newer_available,force,available_version = utils.check_version(version)
            if newer_available and force:
                update_dia = UpdateDialog(None,"New version available", "New version available. Upgrade is vital!",auto_upgrade, True)
                update_dia.ShowModal()
                if update_dia.is_app_upgrade():
                    upgrade = UpgradeSplash()
                    upgrade.Show()
                    utils.do_upgrade(upgrade,version,platform)
                    os._exit(1)
            elif newer_available and not force:
                update_dia = UpdateDialog(None,"New version available", "New version available, but you can stay with this one.. For now!", auto_upgrade, False)
                update_dia.ShowModal()
                if update_dia.is_app_upgrade():
                    upgrade = UpgradeSplash()
                    upgrade.Show()
                    utils.do_upgrade(upgrade,version,platform)
                    os._exit(1)
        except FtpOverloadedException:
            wx.MessageBox('Too many users right now, please try later', 'Assembly Error',wx.OK | wx.ICON_WARNING)
            sys.exit(0)
        except ftplib.all_errors as a:
            wx.MessageBox('Unable to communicate with Assembly64 server.', 'Assembly Error',wx.OK | wx.ICON_WARNING)
            sys.exit(0)
        except:
            wx.MessageBox('Unable to communicate with assembly64 server.', 'Assembly Error',wx.OK | wx.ICON_WARNING)
            sys.exit(0)

        if not utils.has_attribute('uid'):
            client_id = str(uuid.uuid1())
            utils.add_user_attribute('uid',client_id)
            post_ga_event('application','startup_new_user')

        else:
            client_id = utils.get_user_attribute('uid')
            post_ga_event('application','startup_existing_user')

        if not utils.has_attribute('show_info_popup'):
            utils.add_user_attribute('show_info_popup','true')

        if utils.has_attribute(delete_files_after_install) is False:
            utils.add_user_attribute(delete_files_after_install,'true')

        thread = Thread(target = update_db,args = (10, ))
        thread.start()

        AssemblySplash().Show()
        return 1