omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Config Profile Generator

    Pythonista
    3
    7
    8619
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • scj643
      scj643 last edited by

      With the webclip and font installer app I have seen the potential of pythonista being a way to completely configure your device with configuration profiles. I just need to figure out how to make a profile that has multiple font payloads.

      1 Reply Last reply Reply Quote 0
      • briarfox
        briarfox last edited by

        @scj643 I'm sorry but I'm not quite sure what you are trying to do. Are you wanting to use a config file in a project you are working on or another app (font installer)?

        1 Reply Last reply Reply Quote 0
        • scj643
          scj643 last edited by

          I'm working on an app that takes a set of fonts (ubuntu font family) and puts them into one config profile.
          Eventually to try and make an app that can manage all the devices options through generating config profiles (VPN, mail, calendar, etc.)
          Config files can have multiple payloads.

          https://developer.apple.com/library/ios/featuredarticles/iPhoneConfigurationProfileRef/Introduction/Introduction.html

          1 Reply Last reply Reply Quote 0
          • dgelessus
            dgelessus last edited by

            If you have a Mac, you can use the Apple Configurator app (free in the Mac App Store) to generate mobileconfig profiles. It allows you to include multiple fonts, so you can generate one as a test and see how it's done.

            1 Reply Last reply Reply Quote 0
            • scj643
              scj643 last edited by

              The problem is that I don't want to use Apple Configurator since I don't have a Mac.

              1 Reply Last reply Reply Quote 0
              • scj643
                scj643 last edited by

                # FontInstaller (by @olemoritz)
                
                # This script installs a custom TTF font on iOS (system-wide).
                # It can be used in one of two ways:
                
                # 1. Simply run it in Pythonista, you'll be prompted for the URL of the font 
                #    you'd like to install (if there's a URL in the clipboard, it'll be used by default)
                
                # 2. Use it as an 'Open in...' handler, i.e. select this file in Pythonista's 'Open in...
                #    menu' setting. This way, you can simply download a ttf file in Safari and open it in
                #    Pythonista. The script will then automatically install the downloaded font.
                
                # The script is inspired by the AnyFont app (https://itunes.apple.com/us/app/anyfont/id821560738)
                # and the iOS integration of MyFonts (http://meta.myfonts.com/post/80802984786/install-fonts-from-myfonts-on-ios-7-devices)
                
                import plistlib
                import BaseHTTPServer
                import webbrowser
                import uuid
                import urllib
                import sys
                import console
                import clipboard
                import os
                
                uuid1=uuid.uuid4().urn[9:].upper()
                uuid2=uuid.uuid4().urn[9:].upper()
                
                
                # Request handler for serving the config profile:
                class ConfigProfileHandler (BaseHTTPServer.BaseHTTPRequestHandler):
                	config = None
                	def do_GET(s):
                		s.send_response(200)
                		s.send_header('Content-Type', 'application/x-apple-aspen-config')
                		s.end_headers()
                		plist_string = plistlib.writePlistToString(ConfigProfileHandler.config)
                		s.wfile.write(plist_string)
                	def log_message(self, format, *args):
                		
                		 pass
                
                def run_server(config):
                	ConfigProfileHandler.config = config
                	server_address = ('', 0)
                	httpd = BaseHTTPServer.HTTPServer(server_address, ConfigProfileHandler)
                	sa = httpd.socket.getsockname()
                	# Point Safari to the local http server:
                	webbrowser.open('safari-http://localhost:' + str(sa[1]))
                	# Handle a single request, then stop the server:
                	httpd.handle_request()
                	
                def main():
                	with open('Ubuntu-R.ttf', 'r') as f:
                			ur = f.read()
                	with open('Ubuntu-RI.ttf', 'r') as f:
                			uri = f.read()
                	# Create the configuration profile:
                	unique_id = uuid.uuid4().urn[9:].upper()
                	config = {'PayloadContent': [{
                              'Font': plistlib.Data(ur),
                              'PayloadIdentifier': 'org.scj643.font.' + uuid1, 
                              'PayloadOrganization': 'scj643',
                              'PayloadType': 'com.apple.font',
                              'PayloadUUID': uuid1, 'PayloadVersion': 1},
                              {'Font': plistlib.Data(uri),
                               'PayloadIdentifier': 'org.scj643.font.' + uuid1, 
                              'PayloadOrganization': 'scj643',
                              'PayloadType': 'com.apple.font',
                              'PayloadUUID': uuid2, 'PayloadVersion': 1}
                              ], 
                            'PayloadDescription': 'Ubuntu Font',
                            'PayloadDisplayName': 'Ubuntu Font',
                            'PayloadIdentifier': 'org.scj643.font.' + uuid1,
                            'PayloadOrganization': 'scj643', 
                            'PayloadRemovalDisallowed': False, 
                            'PayloadType': 'Configuration',
                            'PayloadUUID': unique_id,
                            'PayloadVersion': 1}
                	run_server(config)
                
                if __name__ ==  '__main__':
                	main()
                
                1 Reply Last reply Reply Quote 0
                • scj643
                  scj643 last edited by

                  Figured it out all you have to do is add another list to the payload content now just need to make it so that it looks for all the files with .ttf in my folder and adds them to it.

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post
                  Powered by NodeBB Forums | Contributors